boro Posted August 19, 2014 Posted August 19, 2014 Hi i have stamina script, it work good but when i am killed and then respawned then timers dont are killed why? i have set killtimer for ( checktimer ). ty for help stamina = 100 addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), function () stamina = 100 if isTimer( checktimer ) then killTimer ( checktimer ) else local checktimer = setTimer(checkKeyone,1000,0) -- this timer dont are killed end end) function checkKeyone() if ( getControlState ( "sprint" ) ) and stamina ~= 0 then stamina = stamina -1 end if ( stamina == 0 ) then local updatetimer = setTimer(updateStamina,10000,1) setControlState( "sprint", false ) end end function updateStamina() if stamina == 0 and getControlState ( "sprint" ) == false then stamina = stamina +100 if isTimer( updatetimer ) then killTimer ( updatetimer ) end end end
Et-win Posted August 19, 2014 Posted August 19, 2014 Please use the [lu.a]--Stuff[/lu.a] tags without dots for scripts And that is because the timers are 'local'. Remove 'local'.
boro Posted August 19, 2014 Author Posted August 19, 2014 yes i try it with local checktimer = setTimer(checkKeyone,1000,1) but i need caled checkKeyone function always, and not only 1x
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