SA-MP Forums Archive
Another errors, please help ! - 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: Another errors, please help ! (/showthread.php?tid=463586)



Another errors, please help ! - bustern - 12.09.2013

Script:
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 2)
    {
        new CarCheck = GetPlayerVehicleID(playerid);
        if(CarCheck == Cars[Grove] )
        {
            if(gTeam[playerid] != 100)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "You Don't have the keys for this car!");
                return 1;
            }
        }
        if(CarCheck == Cars[Ballas] )
        {
            if(gTeam[playerid] != 101)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "You Don't have the keys for this car!");
                return 1;
            }
        }
        return 1;
    }
    return 1;
}
Errors are on lines:
if(CarCheck == Cars[Grove] )
if(CarCheck == Cars[Ballas] )
PHP код:
 error 032: array index out of bounds (variable "Cars"



Re: Another errors, please help ! - Omar55555 - 12.09.2013

show me the variable you have defined


Re: Another errors, please help ! - bustern - 13.09.2013

enum TeamCars
{
Grove,
Ballas,
LosAztecas,
LosSantosVagos,
DaNangBoys,
Triads,
Bikers
};
new Cars[TeamCars];
new gTeam[MAX_PLAYERS];


Re: Another errors, please help ! - Konstantinos - 13.09.2013

It's exactly like your previous thread. You've possibly defined all of them or some of them:
pawn Код:
Grove,
Ballas,
LosAztecas,
LosSantosVagos,
DaNangBoys,
Triads,
Bikers
to your script. You cannot use the same name in your enum and to be defined too.


Re: Another errors, please help ! - bustern - 13.09.2013

Ok, thanks