SA-MP Forums Archive
Warning when running server - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Warning when running server (/showthread.php?tid=401901)



Warning when running server - irfu - 24.12.2012

[20:18:36] [debug] Run time error 4: "Array index out of bounds"
[20:18:36] [debug] Accessing element at index 4 past array upper bound 3
[20:18:36] [debug] AMX backtrace:
[20:18:36] [debug] #0 0021ad14 in public PingKick () from gm.amx

i get this warning when running the server and the server runs fine in windows but not in vps.

The public pingkick:
pawn Код:
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),"{251BE0}%s has been kicked from the server. {58CC00}(Reason: High Ping (%d) | Average (%d) {FFFFFF}| Max Allowed (%d) )", PlayerName2(i), GetPlayerPing(i), Average, ServerInfo[MaxPing] );
                    SendClientMessageToAll(grey,string);
                    SaveToFile("KickLog",string);
                    Kick(i);
                }
            }
        }
    }

    #if defined ANTI_MINIGUN
    new weap, ammo;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && PlayerInfo[i][Level] == 0)
        {
            GetPlayerWeaponData(i, 7, weap, ammo);
            if(ammo > 1 && weap == 38) {
                new string[128]; format(string,sizeof(string),"INFO: %s has a mingun with %d ammo", PlayerName2(i), ammo);
                MessageToAdmins(COLOR_WHITE,string);
            }
        }
    }
    #endif
}
PLS FIND ME A SOLUTION


Re: Warning when running server - irfu - 25.12.2012

Any help pls!!!??


Re: Warning when running server - Faisal_khan - 25.12.2012

EDIT:
Wrong post!


Re: Warning when running server - Camorra - 25.12.2012

Check that line "*for(new i=0; i<MAX_PLAYERS; i++) "
Make sure all MAX_PLAYERS wrote as needed.


Re: Warning when running server - Faisal_khan - 25.12.2012

Show us your ServerInfo array.


Re: Warning when running server - irfu - 28.12.2012

sorry guys! but i dumped that gm! any admins pls close this topic!Bt tnx for helping out!