14.08.2015, 07:16
Hi, I'm getting some AMX Backtrace in my Server.log, have a look on them,
The filterscript in which it occurs:
Код:
[22:16:36] [debug] Run time error 4: "Array index out of bounds" [22:16:36] [debug] Accessing element at index 5 past array upper bound 4 [22:16:36] [debug] AMX backtrace: [22:16:36] [debug] #0 000001b8 in public switchmode () from missions.amx [22:16:36] [debug] #1 00000008 in ?? () from missions.amx
Код:
new changemodetimer, currentmode = 0;
enum smode
{
Mode[256],
Time
}
stock const ModeInfo[][smode] =
{
{"GrandTheftHeli1", 300000},
{"Technical Issues 1", 300000},
{"Construction Issues 1", 300000},
{"Dealership Fight 1", 300000},
{"The Press Club 1", 300000}
};
public OnGameModeInit()
{
changemodetimer = SetTimer("switchmode", ModeInfo[currentmode][Time], false); //This timer will be started everytime a new Gamemode is loaded
return 1;
}
public OnGameModeExit()
{
KillTimer(changemodetimer); //This will prevent errors if you manually change the Gamemode
return 1;
}
forward switchmode();
public switchmode()
{
new modestring[400];
//This works like a loop, so when it reach the last Gamemode it will change to the first again
if(currentmode < sizeof(ModeInfo))
++currentmode;
else
currentmode = 0;
format(modestring, sizeof(modestring), "{007CFF}» Mission: {3CB8FF}The Next Mission will be %s!", ModeInfo[currentmode][Mode]);
SendClientMessageToAll(0x32CD32FF, modestring);
format(modestring,sizeof(modestring), "changemode %s", ModeInfo[currentmode][Mode]);
SendRconCommand(modestring);
return 1;
}

