07.12.2013, 15:54
Alright, I've been going through with timers a couple of times now the past two days and I do not understand them fully. I have read about the timers on samp wiki many times and I never fully understand them so please do not link me to them, I know where I can find them.
So my problem is, I am making an ajail command. Wouldn't be so hard, right? Well for me it was easy until I got to the last part where I had to put a timer. I have noticed that you may only save a time variable (interval in a timer) only after or before the timer is going on. Once it is going, you cannot pause it and save the interval sadly. So I downloaded a couple of gamemodes from the section on these forums and either they didn't have a timer or they made me even more confused.
Basically my questions or problems are:
1. Can you pause a SetTimer or SetTimerEx, so that you can save the interval into a variable. Why saving them? Because if a player disconnects I want the player to continue his ajail once he spawns again.
Right now my command saves the time from /ajail command into a ini file BEFORE the timer starts. Therefore if the player disconnects he has to complete the whole ajail again even though he spent 90% of the time.
2. The difference between SetTimerEx and SetTimer. I know that some people have answered me that question before but then I have a follow up question. What can you do with the two last parameters in SetTimerEx? Example:
What can you do with the variable "x"? Like what's the purpose of x?
Really helpful for those helping me, also don't give me the code of /ajail. I wanna understand the problems so I don't have to ask the same thing in 2 weeks when I do something else with SetTimer or SetTimerEx...
So my problem is, I am making an ajail command. Wouldn't be so hard, right? Well for me it was easy until I got to the last part where I had to put a timer. I have noticed that you may only save a time variable (interval in a timer) only after or before the timer is going on. Once it is going, you cannot pause it and save the interval sadly. So I downloaded a couple of gamemodes from the section on these forums and either they didn't have a timer or they made me even more confused.
Basically my questions or problems are:
1. Can you pause a SetTimer or SetTimerEx, so that you can save the interval into a variable. Why saving them? Because if a player disconnects I want the player to continue his ajail once he spawns again.
Right now my command saves the time from /ajail command into a ini file BEFORE the timer starts. Therefore if the player disconnects he has to complete the whole ajail again even though he spent 90% of the time.
2. The difference between SetTimerEx and SetTimer. I know that some people have answered me that question before but then I have a follow up question. What can you do with the two last parameters in SetTimerEx? Example:
Code:
SetTimerEx("mafunction", 5000, false, "i", x);
Really helpful for those helping me, also don't give me the code of /ajail. I wanna understand the problems so I don't have to ask the same thing in 2 weeks when I do something else with SetTimer or SetTimerEx...