OnPlayerStateChange - Server logs problem.
#4

Looking at the first part; it's probably this that's the problem:
pawn Код:
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);
        }
    }
Because you check if the "spectator" is connected, if he is not it adjusts the value to "999"
pawn Код:
Accessing element at index 999 past array upper bound 500
but continues which probably goes over the MAX_PLAYERS define (500).

Try:
pawn Код:
if(GettingSpectated[playerid] != 999)
    {
        new spectator = GettingSpectated[playerid];
        if(!IsPlayerConnected(spectator))
        {
            GettingSpectated[playerid] = 999;
            Spectate[spectator] = 999;
        }
        else
        {
            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);
            }
        }
    }
Check other areas for code like that too.
Reply


Messages In This Thread
OnPlayerStateChange - Server logs problem. - by iHaze. - 12.04.2013, 02:48
Re: OnPlayerStateChange - Server logs problem. - by MP2 - 12.04.2013, 04:58
Re: OnPlayerStateChange - Server logs problem. - by iHaze. - 12.04.2013, 05:27
Re: OnPlayerStateChange - Server logs problem. - by ryansheilds - 12.04.2013, 05:51

Forum Jump:


Users browsing this thread: 1 Guest(s)