Jump to content

Setar vida conforme o time


Recommended Posts

Ola boa tarde, como faço para essa função funcionar e adicionar vida ao player conforme o time. Segui o código abaixo. No caso a cada 2 segundos setar +1 de vida ao player até que se complete todo o life.

 

function oneLife(player)
if isElement(player) then	
	unbindKey(player, "F", "down", oneLife)
		
	theTimer = setTimer(function()
	    if getElementHealth(player) >= 100 then
		    toggleAllControls (player, true)	
            setPedAnimation(player)	
            killTimer(theTimer)	        
		    return 
		end
		setElementHealth(player, getElementHealth(player) + 0.5)        		
	end,2*1000,1)
		
		setElementPosition(player, 2006.3161621094, -1390.7022705078, 27.355516433716)
		setElementRotation(player, -0, 0, 180)
		setPedAnimation( player, "CRACK", "crckidle2", -1, false, false, false, true)
		setPedHeadless(player, false)
		toggleAllControls ( player, false )		
	end
end

 

Link to comment

Use uma bindkey, quando eu aperto ela deveria definir a vida de pouco em pouco até concluir os 100 de vida. Mas quando aperto a bindkey ela só seta vida uma vez que no caso no script acima é +0,5. Estou usando o lado server.

 

Edited by Cristtk
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...