timer - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: timer (
/showthread.php?tid=295217)
Sovled -
manchestera - 05.11.2011
Ok ive got a timer that works great but i want asecond time the same but ust with a different time on it but when i try to moddify it i get errors i do not understand totally.
Код:
forward TimedCountdown(playerid);
public TimedCountdown(playerid) {
if(iTimedCountdown == -1) {
iTimedCountdown = 81;
}
new
szMessage[10];
iTimedCountdown--;
format(szMessage, sizeof(szMessage), "~r~%d",iTimedCountdown); // Add more in if you wish.
GameTextForPlayer(playerid, szMessage, 950, 6);
if(iTimedCountdown == 0) {
KillTimer(Sfracetimer);
DisablePlayerRaceCheckpoint(playerid);
}
return 1;
}
So i need another one like this but im not sure what i need to change in it ?
Re: timer -
sleepysnowflake - 05.11.2011
pawn Код:
forward TimedCountdown1(playerid); // Also make a new SetTimerEx function in which you just add the number 1 in the funciton name.
public TimedCountdown1(playerid) {
if(iTimedCountdown[1] == -1) { // Under there on iTimedCountDown put: new iTimedCountdown[2];
iTimedCountdown[1] = 81; // At the other timer put : iTimedCountdown[0] Or you can do it it like this:
}
/* if(iTimedCountdown1 == -1) { // UYou need a >> new iTimedCountdown1;
iTimedCountdown1 = 81; // Just uncomment and comment the other one.
}
*/
new
szMessage[10];
iTimedCountdown--; // v down there, I have put ~n~ because that makes a new row, you don't want the timers to be in the same row and get one over an other.
format(szMessage, sizeof(szMessage), "~n~~r~%d",iTimedCountdown); // Add more in if you wish.
GameTextForPlayer(playerid, szMessage, 950, 6);
if(iTimedCountdown == 0) {
KillTimer(Sfracetimer);
DisablePlayerRaceCheckpoint(playerid);
}
return 1;
}
Try this one.
Re: timer -
manchestera - 05.11.2011
Yep that work thanks. So now if i want to make another i just chane the 1 to 2.
Re: timer -
sleepysnowflake - 05.11.2011
Yes. There are better methods tohugh, what do you need the timers for ?
Re: timer -
manchestera - 05.11.2011
They are for races. So if the timer runs out disableracecheckpoints happens.
Re: timer -
sleepysnowflake - 05.11.2011
You know you shoul store the timer in a variable and at the end of the race destoy the timer.
Re: timer -
manchestera - 05.11.2011
How would i do that do you know any guides or links for doing that?
Re: timer -
sleepysnowflake - 05.11.2011
There you go :
https://sampwiki.blast.hk/wiki/KillTimer
https://sampwiki.blast.hk/wiki/SetTimer
https://sampwiki.blast.hk/wiki/SetTimerEx
Re: timer -
manchestera - 05.11.2011
sovled
Re: timer -
manchestera - 05.11.2011
Half Solved