Help [CRASH ERROR]
#2

Код:
[17:06:05] [debug] Run time error 4: "Array index out of bounds"
[17:06:06] [debug]  Accessing element at index 65535 past array upper bound 499
What this says is that the server is trying to access an element of '65535' where the maximum is only 499.

In this instance, 65535 = INVALID_PLAYER_ID, and 499 = MAX_PLAYERS - 1.
Which means you are trying to access an array of MAX_PLAYERS with an invalid player id.
(Eg. pInfo[player1][Admin] where 'player1' is INVALID_PLAYER_ID)

pawn Код:
CMD:spec(playerid, params[])
{
    if(pInfo[playerid][Admin] < 2 && !IsPlayerAdmin(playerid)) return LevelMSG(playerid, 2);
    new player1;
    if(sscanf(params, "u", player1)) return SendClientMessage(playerid, Red, "[Usage]:- {FFFFFF}/spec [playerid]");
    if(IsPlayerConnected(player1) || player1 == INVALID_PLAYER_ID) return SendClientMessage(playerid, Red, "[ERROR]:- Player Not Connected!");
    if(player1 == playerid) return SendClientMessage(playerid, Red, "ERROR: You cannot spectate Yourself");
    if(pInfo[player1][Admin] == 6 && pInfo[playerid][Admin] != 6) return SendClientMessage(playerid, Red, "ERROR: You cannot spectate the highest level admin");
    if(GetPlayerState(player1) == PLAYER_STATE_SPECTATING && pInfo[player1][Spectating] != INVALID_PLAYER_ID) return SendClientMessage(playerid, Red, "ERROR: Player spectating someone else");
    if(!(0 < GetPlayerState(player1) < 4)) return SendClientMessage(playerid, Red, "ERROR: Player not Spawned");
    SendCommandToAdmins(playerid, "SPEC");
    SendClientMessage(playerid, blue, "Spectating On");
    TextDrawShowForPlayer(playerid, LspecText[playerid]);
    pInfo[playerid][SpecUpdateTimer] = SetTimerEx("UpdateSpecText", 1000, 1, "d", playerid);
    StartSpectate(playerid, player1);
    return 1;
}
Reply


Messages In This Thread
Help [CRASH ERROR] - by SPA - 27.07.2014, 14:50
Re: Help [CRASH ERROR] - by Threshold - 27.07.2014, 15:01
Re: Help [CRASH ERROR] - by SPA - 28.07.2014, 13:00
Re: Help [CRASH ERROR] - by SPA - 28.07.2014, 13:16
Re: Help [CRASH ERROR] - by Threshold - 28.07.2014, 13:40
Re: Help [CRASH ERROR] - by SPA - 28.07.2014, 14:31

Forum Jump:


Users browsing this thread: 1 Guest(s)