Jump to content

Can someone give me this script?


GamerDeMTA

Recommended Posts

no it's not wrong why it well be worng ?

and also he say when player he got damge and die the image wont hide because the health he should use setTimer .

You will spam the chat with you're code and use source > not defined .

try this "GamerDeMTA" :

addEventHandler ( 'onClientPlayerDamage', localPlayer, 
    function ( ) 
  setTimer(function() 
        local health = getElementHealth ( localPlayer ) 
        outputChatBox ( "Your health is: ".. math.floor ( health ) .."%" ) 
        if ( health <= 10 ) then 
            guiSetVisible ( image, true ) 
    end 
  end, 1000, 1) 
end 
) 
  
addEventHandler( 'onClientPlayerWasted', localPlayer, 
   function ( ) 
       guiSetVisible( image, false ) 
   end 
   ) 

Link to comment

Ok,Try :

  
local sx, sy = guiGetScreenSize ( ) 
local image = guiCreateStaticImage(0,0,sx,sy,"image.png",false) 
guiSetVisible ( image, false ) 
  
addEventHandler ( 'onClientPlayerDamage', root, 
    function( attacker, weapon, bodypart, loss) 
        if ( attacker and attacker ~= source and attacker == localPlayer ) then 
            if ( loss <=10 and guiGetVisible(image) == false) then 
                guiSetVisible ( image, true ) 
            elseif ( loss > 10 and guiGetVisible(image) ) then 
                guiSetVisible ( image, false ) 
            end 
        end 
    end 
) 
  
  
addEventHandler( 'onClientPlayerWasted', localPlayer, 
   function ( ) 
       guiSetVisible( image, false ) 
   end 
   ) 
    
Link to comment

local sx, sy = guiGetScreenSize ( ) 
local image = guiCreateStaticImage(0,0,sx,sy,"image.png",false) 
guiSetVisible ( image, false ) 
  
addEventHandler ( 'onClientRender', root, 
    function() 
    local health = getElementHealth(localPlayer) 
        if ( health > 10 and guiGetVisible(image) ) then 
            guiSetVisible ( image, false ) 
        end 
    end  
) 
  
addEventHandler ( 'onClientPlayerDamage', root, 
    function( attacker,weapon, bodypart, loss) 
        if ( loss <= 10 and guiGetVisible(image) == false) then 
           guiSetVisible ( image, true ) 
        end 
    end  
) 
  
  
addEventHandler( 'onClientPlayerWasted', localPlayer, 
   function ( ) 
       guiSetVisible( image, false ) 
   end 
   ) 
    
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...