12.07.2015, 20:17
Previously i made a thread and @jamester gave me some codes to change the gamemode from gamemodes folder randomly. but today when i was going to work on it, i saw something that is not suitable for my gamemodes and the thing was timer of changing particular gamemode. It was set to 5 minutes for every gamemode to change.
BUT I WANT to make it different changing timer for each of the gamemodes. is this possible to make from the default codes given by jamester to me?
Here are the codes :
BUT I WANT to make it different changing timer for each of the gamemodes. is this possible to make from the default codes given by jamester to me?
Here are the codes :
Код:
forward switchmode();
new changemodetimer;
new ModeNames[][] =
{
{"Racing"},
{"Fighting"},
{"anothergame"}
};
public OnGameModeInit()
{
changemodetimer = SetTimer("switchmode",300000,false);
return 1;
}
public OnGameModeExit()
{
KillTimer(changemodetimer);//Kill the timer incase it's still running.
return 1;
}
public switchmode()
{
new modestring[50];
new randmode = random(sizeof(ModeNames)); //Select a random mode name from the array.
format(modestring,sizeof(modestring),"The Next mode will be %s!",ModeNames[randmode]);
SendClientMessageToAll(0x32CD32FF,modestring);//Send a message to all online players.
format(modestring,sizeof(modestring),"changemode %s",ModeNames[randmode]);
SendRconCommand(modestring);//Change the mode.
return 1;
}


