Jump to content

Can someone give me this script?


GamerDeMTA

Recommended Posts

Posted
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 
   ) 

Posted

Pai[N] Code doesn't work, I only deleted the outputchatbox.

Ah, but that code you posted Pres[T]ege does what I want? I also want when a player recuperate health [i've a script that does that] the image isn't showed, not only when the player die

Posted

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 
   ) 
    
Posted

But that puts the image when I attack someone, can you say me to put the image when a player has 10 Health or less, and when he recuperates the health image isn't, also when he die the image isn't? No with attacking.

Posted

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 
   ) 
    

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...