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; }
forward switchmode(); static changemodetimer, currentmode ; enum smode { Mode[10], Time } static const ModeInfo[3][smode] = { {"Racing", 300000}, {"Fighting", 200000}, {"anothergame", 100000} }; public OnGameModeInit() { new randmode = random( sizeof (ModeNames) ); currentmode = randmode; changemodetimer = SetTimer("switchmode", ModeInfo[currentmode][Time], false); return 1; } public OnGameModeExit() { KillTimer(changemodetimer); currentmode = 0; return 1; } public switchmode() { new modestring[50], randmode = random( sizeof (ModeNames) ) ; format(modestring, sizeof(modestring), "The Next mode will be %s!", ModeInfo[currentmode][Mode]); SendClientMessageToAll(0x32CD32FF, modestring); format(modestring,sizeof(modestring), "changemode %s", ModeInfo[currentmode][Mode]); SendRconCommand(modestring); currentmode = randmode; changemodetimer = SetTimer("switchmode", ModeInfo[currentmode][Time], false); return 1; }
(50) : warning 228: length of initialler exceeds size of the enum field. (50) : error 018: initialization data exceeds declared size
static const ModeInfo[3][smode] = { {"Racing", 300000}, {"Fighting", 200000}, {"anothergame", 100000} //line 50 };
CMD:cmap1(playerid,params[])
{
for(new i; i < MAX_PLAYERS; i++)
{
SetPVarInt(i, "map1",1);
}
return 1;
}
I think you can use a player variable to do so, like an administrator can change the map by just a command.
Use something like this [maybe works]: PHP код:
|
forward switchmode(); static changemodetimer, currentmode ; enum smode { Mode[10], Time } static const ModeInfo[][smode] = { {"Racing", 300000}, {"Fighting", 200000}, {"anothergame", 100000} }; public OnGameModeInit() { new randmode = random( sizeof (ModeInfo) ); currentmode = randmode; changemodetimer = SetTimer("switchmode", ModeInfo[currentmode][Time], false); return 1; } public OnGameModeExit() { KillTimer(changemodetimer); currentmode = 0; return 1; } public switchmode() { new modestring[50], randmode = random( sizeof (ModeInfo) ) ; format(modestring, sizeof(modestring), "The Next mode will be %s!", ModeInfo[currentmode][Mode]); SendClientMessageToAll(0x32CD32FF, modestring); format(modestring,sizeof(modestring), "changemode %s", ModeInfo[currentmode][Mode]); SendRconCommand(modestring); currentmode = randmode; changemodetimer = SetTimer("switchmode", ModeInfo[currentmode][Time], false); return 1; }