SA-MP Forums Archive
Is there a way to make my server change gamemodes every hour? - 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: Is there a way to make my server change gamemodes every hour? (/showthread.php?tid=84450)



Is there a way to make my server change gamemodes every hour? - Donnie_Viper - 30.06.2009

I was wondering, is there a way to make the gamemode change every hour, so I wouldn't have to do it manually? Thanks.


Re: Is there a way to make my server change gamemodes every hour? - Correlli - 30.06.2009

Make a every_hour_timer in which you're going to use SendRconCommand function which will send rcon command to change gamemode (SendRconCommand("changemode modename");).

But if you're using same gamemode every time, you can just set one_hour_timer to restart the gamemode (SendRconCommand("gmx");).


Re: Is there a way to make my server change gamemodes every hour? - Donnie_Viper - 30.06.2009

I am using 2 different gamemodes

Edit: Which area of the script do I put it in (example: OnPlayerConnect), I checked through my script, and I have a timer in GameModeInit, so I believe it goes here right?


Re: Is there a way to make my server change gamemodes every hour? - Correlli - 30.06.2009

Quote:
Originally Posted by Donnie_Viper
I am using 2 different gamemodes
So you can make it like this:
In first gamemode add one hour timer when the gamemode starts by using this (don't forget the timer):
pawn Код:
SendRconCommand("changemode SecondGameModeName");
and one hour timer in other gamemode by using this (don't forget the timer):
pawn Код:
SendRconCommand("changemode FirstGameModeName");



Re: Is there a way to make my server change gamemodes every hour? - watkijkje - 30.06.2009

Or use a filterscript.. (that will make it less complex)


Re: Is there a way to make my server change gamemodes every hour? - Donnie_Viper - 30.06.2009

It asks for a interval for the timer, what number will mean 1 Hour?


Re: Is there a way to make my server change gamemodes every hour? - Correlli - 30.06.2009

Quote:
Originally Posted by Donnie_Viper
It asks for a interval for the timer, what number will mean 1 Hour?
It's in miliseconds. Once second is 1000 miliseconds, one hour is 3600 seconds.
3600 * 1000 = 3600000


Re: Is there a way to make my server change gamemodes every hour? - kaisersouse - 30.06.2009

Quote:
Originally Posted by Donnie_Viper
It asks for a interval for the timer, what number will mean 1 Hour?
Timers are in milliseconds (1000 = 1 second)


Re: Is there a way to make my server change gamemodes every hour? - Donnie_Viper - 30.06.2009

OK, thanks, it works right (well, compiled right :P), thanks for the help (now I do believe I put both if them in the server.cfg? lol)


Re: Is there a way to make my server change gamemodes every hour? - Correlli - 30.06.2009

Quote:
Originally Posted by Donnie_Viper
OK, thanks, it works right (well, compiled right :P), thanks for the help (now I do believe I put both if them in the server.cfg? lol)
Put both gamemodes in folder called 'gamemodes'. In server.cfg add line 'gamemode0 FirstGameModeName'.
If you did like i told you, then after one hour the OneHourTimerFunction in FirstGameModeName will change mode to SecondGameModeName which will do the same for FirstGameModeName.
I hope it isn't too much complicated for you.