ARRAY INDEX
#2

Here you're getting the spectated which I believe can return as 999, and later you're accessing PlayerInfo[spectator][pAdmin] without checking if it equals 999, there's probably more of this happening too but that's one instance of it and I'm not going to go over all your script.

A quick note for future proofing, I would set the invalid to -1 because in case your server slots increase to 1000 and the server fills up then you'll be running into problems, however player slots won't ever start from -1 so you wouldn't run into any problems in the future.
Also you could use a define instead of hardcoding and that way you wouldn't have to change all your 999's
pawn Код:
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)
        {
This solution was posted by cessil in one of my old threads which I had the same problem as you.
Reply


Messages In This Thread
ARRAY INDEX - by DJ_Shocker - 07.08.2013, 02:29
Re: ARRAY INDEX - by Red_Dragon. - 07.08.2013, 02:43

Forum Jump:


Users browsing this thread: 1 Guest(s)