SA-MP Forums Archive
Run time error 4: "Array index out of bounds" - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Run time error 4: "Array index out of bounds" (/showthread.php?tid=347574)



Run time error 4: "Array index out of bounds" - nGen.SoNNy - 02.06.2012

HI GUYS Can somebody help me with this ?


PHP код:
[13:39:03] [debug#0  000636d0 in public CheckPlayerState () from GM.amx 
pawn Код:
fc CheckPlayerState()
{
    new i,cs;
    for(i=0;i<=MAX_PLAYERS;i++){
        cs=GetPlayerState(i);
        if(DriftMode[i] && cs==PLAYER_STATE_DRIVER && DriftPointsNow[i]>70){
            new Float:h;
            GetVehicleHealth(GetPlayerVehicleID(i),h);
            if(h<HealthInit[i]){
                KillTimer(DriftTimer[i]);
                DriftExit(i);
                GameTextForPlayer(i,"~n~~n~~n~~n~~n~~n~~r~~h~B~b~~h~O~r~~h~O~b~~h~M",800,5);
                DriftMode[i]=false;
            }
        }
        if(cs==PLAYER_STATE_DRIVER && DriftMode[i]==false){
            if(GetVType(GetPlayerVehicleID(i))){
                DriftMode[i]=true;
                GetVehicleHealth(GetPlayerVehicleID(i),HealthInit[i]);
                DriftTimer[i]=SetTimerEx("Drift", 200, true, "i", i);
            }
        }
        else if(cs!=PLAYER_STATE_DRIVER && DriftMode[i]==true){
            KillTimer(DriftTimer[i]);
            DriftMode[i]=false;
        }
        else{}
    }
    return ( 1 );
}



Re: Run time error 4: "Array index out of bounds" - MadeMan - 02.06.2012

pawn Код:
for(i=0;i<MAX_PLAYERS;i++){



Re: Run time error 4: "Array index out of bounds" - nGen.SoNNy - 02.06.2012

thx