Gaimo Posted August 28, 2020 Posted August 28, 2020 Quero fazer a vida do jogador descer num periodo de 2 minutos. Pensei logo no timer, mas no caso teria que fazer o timer rodar várias vezes? Ou existe uma maneira melhor? setTimer( function() local current_life = getElementHealth(source) setElementHealth(source, current_life - 1) end, 1000, 60*2, source)
Other Languages Moderators Lord Henry Posted August 28, 2020 Other Languages Moderators Posted August 28, 2020 Eu também faria com timer. Pois se trata de um curto período de tempo com repetições.
ber Posted August 31, 2020 Posted August 31, 2020 timerVida = {} timerVida[source] = setTimer(function(source) local vida = getElementHealth(source) if vida >= 1 then setElementHealth(source, vida - 1) else killTimer(timerVida[source]) timerVida[source] = nil end end, 500, 0, source)
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