xXMADEXx Posted February 6, 2013 Posted February 6, 2013 I don't know how to destroy the timer so "The crack time has ended" spams. function crack(player) if (not isPedInVehicle(player)) then outputChatBox("you're jump height has been set to double.",player,0,255,0) setTimer( function () setPedGravity ( source, 50 ) outputChatBox("The crack time has ended.",source,255,255,0) end ,5000,0) else outputChatBox("You cannot use crack in a vehicle.",player,255,0,0) end end addCommandHandler("crack",crack)
manawydan Posted February 6, 2013 Posted February 6, 2013 try function crack(player) if (not isPedInVehicle(player)) then outputChatBox("you're jump height has been set to double.",player,0,255,0) setTimer( function () setPedGravity ( source, 50 ) outputChatBox("The crack time has ended.",source,255,255,0) end ,5000,1) else outputChatBox("You cannot use crack in a vehicle.",player,255,0,0) end end addCommandHandler("crack",crack)
Renkon Posted February 6, 2013 Posted February 6, 2013 save the timer in memory by storing it in a variable. When you need to destroy it: if isTimer(timer) then killTimer(timer end
xXMADEXx Posted February 6, 2013 Author Posted February 6, 2013 save the timer in memory by storing it in a variable.When you need to destroy it: if isTimer(timer) then killTimer(timer end I tried this, but it didn't work. setTimer( function () setPedGravity ( source, 50 ) outputChatBox("The crack time has ended.",source,255,255,0) if isTimer(timer) then killTimer(timer) end end ,5000,0)
manawydan Posted February 6, 2013 Posted February 6, 2013 timer = setTimer( function () setPedGravity ( source, 50 ) outputChatBox("The crack time has ended.",source,255,255,0) if isTimer(timer) then killTimer(timer) end end ,5000,0)
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