Posts: 173
Threads: 71
Joined: Oct 2013
Reputation:
0
[22:09:41] [debug] Run time error 4: "Array index out of bounds"
[22:09:41] [debug] Accessing element at index 4 past array upper bound 3
[22:09:41] [debug] AMX backtrace:
[22:09:41] [debug] #0 00101174 in public PingKick () from COD.amx
Posts: 1,861
Threads: 103
Joined: Sep 2011
Reputation:
0
Can you post the public function 'PingKick'? My guess, from that log, is that the problem is in that function.
Posts: 1,241
Threads: 304
Joined: May 2012
Reputation:
0
Can you please show public PingKick()?
Posts: 173
Threads: 71
Joined: Oct 2013
Reputation:
0
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, x, string[128];
while (x < PING_MAX_EXCEEDS) {
Sum += PlayerInfo[i][pPing][x];
x++;
}
if(PlayerInfo[i][Level] == 0)
{
format(string,sizeof(string),"%s has been kicked from the server. [ Reason: (High Ping %d) | (Max Allowed %d) ]", PlayerName2(i), GetPlayerPing(i), ServerInfo[MaxPing] );
SendClientMessageToAll(red,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;
}
}
}
#if defined ANTI_SPEED
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
if(GetPlayerSpeedSpeedo(i, true) > 400)
{
new speedo[128];
format(speedo, sizeof(speedo), "*SPEED HACKS DETECTED* %i, *CHECK BEFORE BANNING*", i);
MessageToAdmins(red, speedo);
}
}
}
#endif
#if defined ANTI_JETPACK
for(new i = 0; i < MAX_PLAYERS; i++)
{
new jp = GetPlayerSpecialAction(i);
if (jp == SPECIAL_ACTION_USEJETPACK && PlayerInfo[i][OnDuty] == 0 && gClass[i] != JET)
{
new string[128]; format(string,sizeof(string),"%s has been kicked by the server. [Jetpack Hack]", GetName(i));
SendClientMessageToAll(red,string);
Kick(i);
}
}
#endif
#if defined ANTI_MINIGUN
new weap, ammo;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && PlayerInfo[i][OnDuty] == 0)
{
GetPlayerWeaponData(i, 7, weap, ammo);
if(ammo > 1 && weap == 38 || ammo > 1 && weap == 36) {
new string[128]; format(string,sizeof(string),"%s has been banned by the server. [Weapon Hacks]", GetName(i));
SendClientMessageToAll(red,string);
LBAN(-1,i,"Weapon Hacks");
}
}
}
#endif
}
stock GetPlayerSpeedSpeedo(playerid, bool:kmh)
{
new Float:Vx,Float:Vy,Float:Vz,Float:rtn;
if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),Vx ,Vy,Vz); else GetPlayerVelocity(playerid,Vx,Vy,Vz);
rtn = floatsqroot(floatabs(floatpower(Vx + Vy + Vz,2)));
return kmh?floatround(rtn * 100 * 1.61):floatround(rtn * 100);
}
forward Zonesreward();