Gamemode crash
#1

Код:
[09:39:16] [debug] Run time error 4: "Array index out of bounds"
[09:39:16] [debug]   Accessing element at index 999 past array upper bound 500
[09:39:16] [debug] Backtrace (most recent call first):
[09:39:16] [debug] #0  000603e0 in OnPlayerStateChange () from OGHRP.amx
This is what I get before it crashes

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate != 2) NOPTrigger[playerid] = 0;
    if(IsPlayerNPC(playerid))
	{
	    if(newstate == PLAYER_STATE_SPECTATING)
	    {
        	TogglePlayerSpectating(playerid, false);
		}
		return 1;
	}
	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);
	    }
	}
Reply


Messages In This Thread
Gamemode crash - by ChristofferHoffmann - 30.05.2012, 12:44
Re: Gamemode crash - by ViniBorn - 30.05.2012, 14:28
Re: Gamemode crash - by ChristofferHoffmann - 30.05.2012, 16:38
Re: Gamemode crash - by iggy1 - 30.05.2012, 17:01
Re: Gamemode crash - by ChristofferHoffmann - 31.05.2012, 10:08

Forum Jump:


Users browsing this thread: 1 Guest(s)