08.05.2015, 22:06
Meu server fica aparecendo toda hora essa mensagem do crasherdetect da public ping, alguйm corrige o cуdigo pra mim?
Esse pingkick e da Ladmin (https://sampforum.blast.hk/showthread.php?tid=19819)
Код:
[18:10:53] [debug] Run time error 4: "Array index out of bounds" [18:10:53] [debug] Accessing element at index 4 past array upper bound 3 [18:10:53] [debug] AMX backtrace: [18:10:53] [debug] #0 00085c10 in public PingKick () from Adminr.amx
Код:
//EM CIMA #define PING_MAX_EXCEEDS 4 #define PING_TIMELIMIT 60 // SECONDS new ServerInfo[MaxPing] = 1000, PingPos; forward PingKick(); public PingKick() { if(ServerInfo[MaxPing] != 0) { PingPos++; if(PingPos > PING_MAX_EXCEEDS) PingPos = 0; for(new i,a = GetMaxPlayers();i < a;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 foi kickado do servidor. (Motivo: Alto Ping (%d) | Media (%d) | Maximo Permitido (%d) )", PlayerName2(i), GetPlayerPing(i), Average, ServerInfo[MaxPing] ); SendClientMessageToAll(grey,string); Kick(i); } } } } }