SA-MP Forums Archive
Change gamemode time - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Change gamemode time (/showthread.php?tid=90031)



Change gamemode time - mige - 05.08.2009

So how would i set a timer which changes the gamemode??


Re: Change gamemode time - Correlli - 05.08.2009

https://sampwiki.blast.hk/wiki/SetTimer
https://sampwiki.blast.hk/wiki/SetTimerEx


Re: Change gamemode time - mige - 05.08.2009

Quote:
Originally Posted by Don Correlli
Im a bit dum so can u tell me if i understood this correct?

This is the code:

Код:
forward message();
 
public OnGameModeInit( )
{
	print("Starting timer...");
	SetTimer("message",1000,false);
}
 
public message()
{
	print("1 second has passed.");
}
Код:
SetTimer("message",1000,false);
So that makes it call that public message(), and that 1000 means 1sec?

So for changing gamemode i would need to put there something like this?: (but where should i put this?)

Код:
gamemode = 1;



Re: Change gamemode time - Correlli - 05.08.2009

Yes, 1 second is 1000 miliseconds.

So, the gamemode restart would look like this:
pawn Код:
forward Timer();
 
public OnGameModeInit()
{
  SetTimer("Timer", 3600000, false); // 3600000 is 1 hour.
  return 1;
}
 
public Timer()
{
  SendRconCommand("gmx");
  return 1;
}
If you want to change to another gamemode then use:
pawn Код:
SendRconCommand("changemode modename");



Re: Change gamemode time - mige - 05.08.2009

Quote:
Originally Posted by Don Correlli
Yes, 1 second is 1000 miliseconds.

So, the gamemode restart would look like this:
pawn Код:
forward Timer();
 
public OnGameModeInit()
{
  SetTimer("Timer", 3600000, false); // 3600000 is 1 hour.
  return 1;
}
 
public Timer()
{
  SendRconCommand("gmx");
  return 1;
}
If you want to change to another gamemode then use:
pawn Код:
SendRconCommand("changemode modename");
ok that helps very much, but i have like 5 good gamemods, so how i can make it work with all of them, or do i have to put that in every gamemod...?


Re: Change gamemode time - Correlli - 05.08.2009

pawn Код:
SendRconCommand("changemode modename");
This is what you need.

In first gamemode, enter the name of the gamemode2, in the gamemode2 enter the name of the gamemode3 and so on.