[Ajuda] Crashdetect - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Non-English (
https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (
https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (
https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Crashdetect (
/showthread.php?tid=573566)
Crashdetect -
SatanMessenger - 08.05.2015
Meu server fica aparecendo toda hora essa mensagem do crasherdetect da public ping, alguйm corrige o cуdigo pra mim?
Код:
[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);
}
}
}
}
}
Esse pingkick e da Ladmin (
https://sampforum.blast.hk/showthread.php?tid=19819)
Re: Crashdetect -
[BOPE]Seu._.Madruga - 08.05.2015
PHP код:
#define MaxPing 1500
new Nome[MAX_PLAYER_NAME];
public OnPlayerUpdate(playerid)
{
if(GetPlayerPing(playerid) > MaxPing)
{
new string[128];
GetPlayerName(playerid, Nome, MAX_PLAYER_NAME);
format(string, sizeof(string), "[ANTI-PING] %s Foi kickado por ultrapassar o limite. (Mбximo: %d ms)", Nome, MaxPing);
SendClientMessageToAll(-1, string);
Kick(playerid);
}
return 1;
}
Re: Crashdetect -
SatanMessenger - 08.05.2015
Assim ta certo?
Код:
#define MaxPing 200
new PlayerPing[MAX_PLAYERS];
public OnPlayerConnect(playerid){
return PlayerPing[playerid] = 0; }
public OnFilterScriptInit(){
return SetTimer("PingKick",5155,1); }
forward PingKick();
public PingKick() {
for (new i = 0; i < MAX_PLAYERS; i++){
if(IsPlayerConnected(i)){
if(GetPlayerPing(i) > MaxPing) {
PlayerPing[i]++;
if(PlayerPing[i] > 10){
new string[128];
format(string, sizeof(string), "%s foi kickado do servidor. (Motivo: Alto Ping (%d) | Maximo Permitido (%d))", pName(i), GetPlayerPing(i), MaxPing);
SendClientMessageToAll(grey,string);
Kick(i);
}
}
}
}
return true;}