[20:48:58] [debug] Run time error 4: "Array index out of bounds" [20:48:58] [debug] Accessing element at index 999 past array upper bound 500 [20:48:58] [debug] AMX backtrace: [20:48:58] [debug] #0 0007cdac in public OnPlayerStateChange (0x00000000, 0x00000001, 0x00000008) from UGRP.amx [20:49:06] [debug] Server crashed while executing UGRP.amx
if(GettingSpectated[playerid] != 999) { new spectator = GettingSpectated[playerid]; if(!IsPlayerConnected(spectator)) { GettingSpectated[playerid] = 999; Spectate[spectator] = 999; } if(newstate == PLAYER_STATE_DRIVER && PlayerInfo[spectator][pAdmin] >= 2 || newstate == PLAYER_STATE_PASSENGER && PlayerInfo[spectator][pAdmin] >= 2) { TogglePlayerSpectating(spectator, true); new carid = GetPlayerVehicleID( playerid ); PlayerSpectateVehicle( spectator, carid ); SetPVarInt(spectator, "SpecState", newstate); } else if(newstate == PLAYER_STATE_ONFOOT && PlayerInfo[spectator][pAdmin] >= 2) { TogglePlayerSpectating(spectator, true); PlayerSpectatePlayer( spectator, playerid ); SetPlayerInterior( spectator, GetPlayerInterior( playerid ) ); SetPVarInt(spectator, "SpecState", newstate); } }
new spectator = GettingSpectated[playerid]; if(PlayerInfo[spectator][pAdmin] >= 2) { // Preventing possible buffer overflows with the arrays TogglePlayerSpectating(spectator, true); PlayerSpectatePlayer( spectator, playerid ); SetPlayerInterior( spectator, GetPlayerInterior( playerid ) ); SetPVarInt(spectator, "SpecState", newstate); SetPlayerInterior( spectator, GetPlayerInterior( playerid ) ); SetPlayerVirtualWorld( spectator, GetPlayerVirtualWorld( playerid ) ); }
if(GettingSpectated[playerid] != 999)
{
// second code here
}
Not INVALID_PLAYER_ID but 999 instead.
pawn Код:
|
[22:21:55] [debug] Server crashed while executing UGRP.amx [22:21:55] [debug] AMX backtrace: [22:21:55] [debug] #0 ffffffff in public OnPlayerClickMap () from UGRP.amx