Sasu Posted March 15, 2013 Share Posted March 15, 2013 local tiempo = setTimer(setElementPosition, theTimeBan, 1, thePlayer, 1543.29, -1675.92, 13.55) I use to killTimer... if isTimer(tiempo) then killTimer(tiempo) end But it dont kill Timer. And no error on debug 3. I am doing a panel jail system. Link to comment
Renkon Posted March 15, 2013 Share Posted March 15, 2013 (edited) I'd suggest you to use tiempo = nil inside the if isTimer(tiempo) statement in addition to killTimer cause it happens to me generally and I gotta use that to make it work. edit: Use this example if isTimer(tiempo) then killTimer(tiempo) tiempo = nil end Edited March 15, 2013 by Guest Link to comment
Sasu Posted March 15, 2013 Author Share Posted March 15, 2013 OFF: Use english in this section . How? I didnt understand. Link to comment
50p Posted March 15, 2013 Share Posted March 15, 2013 Your timer is a local variable. This will not be available outside the block it was defined in. function name( ) local a = "hello world"; end print( a ); -- this will print "nil" because 'a' is not a global variable If you want to make timers for each player then you need to use table and store timers in a table, otherwise you will have 1 global timer variable which you will kill for all players. There was a discussion about the same problem you're having yesterday: viewtopic.php?f=91&t=55691 Also, please search the forum before you post. Link to comment
Sasu Posted March 15, 2013 Author Share Posted March 15, 2013 For each players not. Only see... function banear(text, adminJail, timeJail, editText) local thePlayer = getPlayerFromName(text) if not thePlayer then outputChatBox("Selecciona a un jugador de la lista", source,255,0,0,true) return end if (getElementData(thePlayer, "jail") == "si") then setElementPosition(thePlayer, 1543.29, -1675.92, 13.55) outputChatBox(text.." ha sido liberado por "..adminJail..".", getRootElement(), 255, 0, 0, false) if isTimer(tiempo) then killTimer(tiempo) end setElementData(thePlayer, "jail", "no") else if (timeJail) then theTimeBan = math.floor ( tonumber ( timeJail )*60*1000 ) setElementPosition(thePlayer, 5562.25, -2121.5, 19.9) tiempo = setTimer(setElementPosition, theTimeBan, 1, thePlayer, 1543.29, -1675.92, 13.55) setElementData(thePlayer, "jail", "si") outputChatBox(text.." ha sido encarcelado por "..adminJail..". Razon: "..editText.." ( "..timeJail.." Min )", getRootElement(), 255, 0, 0, false) end end end addEvent("jailHim", true) addEventHandler("jailHim", getRootElement(), banear) 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