09.12.2011, 21:22
[00:26:30]: Additional information:
[00:26:30]: Array max index is 3 but accessing an element at 4
[00:26:30]: Call stack (most recent call first):
[00:26:30]: public PingKick()
[00:26:57]: Script[gamemodes/rp.amx]: During execution of PingKick():
[00:26:57]: Script[gamemodes/rp.amx]: Run time error 4: "Array index out of bounds"
Solution?
[00:26:30]: Array max index is 3 but accessing an element at 4
[00:26:30]: Call stack (most recent call first):
[00:26:30]: public PingKick()
[00:26:57]: Script[gamemodes/rp.amx]: During execution of PingKick():
[00:26:57]: Script[gamemodes/rp.amx]: Run time error 4: "Array index out of bounds"
Quote:
forward PingKick(); public PingKick() { if(ServerInfo[MaxPing] != 0) { PingPos++; if(PingPos > PING_MAX_EXCEEDS) PingPos = 0; for(new i=0; i<MAX_PLAYERS; i++) { PlayerInfo[i][pPing][PingPos] = GetPlayerPing(i); if(GetPlayerPing(i) > ServerInfo[MaxPing]) { if(PlayerInfo[i][PingCount] == 0) PlayerInfo[i][PingTime] = TimeStamp(); PlayerInfo[i][PingCount]++; if(TimeStamp() - PlayerInfo[i][PingTime] > PING_TIMELIMIT) { PlayerInfo[i][PingTime] = TimeStamp(); PlayerInfo[i][PingCount] = 1; } else if(PlayerInfo[i][PingCount] >= PING_MAX_EXCEEDS) { new Sum, Average, x, string[128]; while (x < PING_MAX_EXCEEDS) { Sum += PlayerInfo[i][pPing][x]; x++; } Average = (Sum / PING_MAX_EXCEEDS); format(string,sizeof(string),"%s has been kicked from the server. (Reason: High Ping (%d) | Average (%d) | Max Allowed (%d) )", PlayerName2(i), GetPlayerPing(i), Average, ServerInfo[MaxPing] ); SendClientMessageToAll(grey,string); SaveToFile("KickLog",string); Kick(i); } } else if(GetPlayerPing(i) < 1 && ServerInfo[AntiBot] == 1) { PlayerInfo[i][BotPing]++; if(PlayerInfo[i][BotPing] >= 3) BotCheck(i); } else { PlayerInfo[i][BotPing] = 0; } } } } |