help with 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: help with timer (
/showthread.php?tid=321585)
help with timer -
ServerScripter - 27.02.2012
Hi , i want to create a timer who is starts whene i run samp-server (cause for map change) a 4:00 min timer countdown so if 0 wait will the next map load then start it again , do you have any idea how to do it ? thanks.
Re: help with timer -
Roperr - 28.02.2012
OnGamemodeInit
SetTimerEx --->
SendRconCommand("changemode (name of new gamemode)");
Re: help with timer -
Roperr - 28.02.2012
forward changeGM(second, msg[]);
public OnGameModeInit()
{
print("Starting timer...");
new changeMSG[50];
format(changeMSG, sizeof(changeMS), "Gamemode changing! Hold on to your hats");
SetTimerEx("changeGM", 240000, false, "s", changeGM);
}
public changeGM(msg[])
{
SendClientMessageToAll(color_red, msg);
SendRconCommand("changemode (new gamemode name)");
return 1;
}
This was just scripted in browser, but this should work.
REP if it did
Re: help with timer -
niels44 - 28.02.2012
i think he means a MAP not a gamemode... and yes you can do it with settimerex:
https://sampwiki.blast.hk/wiki/SetTimerEx
and put in the public function:
pawn Код:
forward YourTimer(); // here you define it that it is a public function, you always have to forward a public function
public YourTimer() // here is the public function
{ // opening bracket :D
// destroy all the objects from the map you want to delete so you have to define them first and then use DestroyObject here, so for example: Object[0] = CreateObject.... in your ongamemodeinit and then here use: DestroyObject(Object[0]); make sure you first define the Object[0] so paste on top of your script under #define and #include: new Object[ MAX_OBJECTS];
// and then put here also the new objects you want to load :D
// and also a return
return 1;
} // closing bracket
hope i helped you a little bit... AND READ THE WIKI I POSTED HERE!
greets niels
Re: help with timer -
Champ - 28.02.2012
these threats will help you ↓
https://sampforum.blast.hk/showthread.php?tid=223550
https://sampforum.blast.hk/showthread.php?tid=269336
https://sampforum.blast.hk/showthread.php?tid=72842