Another errors, please help !
#1

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"
Reply
#2

show me the variable you have defined
Reply
#3

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

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.
Reply
#5

Ok, thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)