Cristtk Posted February 11, 2021 Share Posted February 11, 2021 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
Joaovit13 Posted February 11, 2021 Share Posted February 11, 2021 Tente usar o comando addEventHandler mals pelo next page kk Link to comment
miiguelz Posted February 12, 2021 Share Posted February 12, 2021 Acredito que o evento onPlayerDamage possa atender suas necessidades. Link to comment
Cristtk Posted February 12, 2021 Author Share Posted February 12, 2021 (edited) 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 February 12, 2021 by Cristtk Link to comment
miiguelz Posted February 12, 2021 Share Posted February 12, 2021 @Cristtkvocê não acha melhor setar 100 diretamente? Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now