vehicle enums trouble.
#1

Hey im fairly new to enum so.. Could someone take at look at these errors ill give you the part of the code with the error and the enum.
Код:
case 1:
		    {
		        if(PlayerInfo[playerid][PlayerVehicleModel1] != 0)
		        {
          			PlayerVehicleID1[playerid] = 0;
		    		PlayerVehicleID1[playerid] = CreateVehicle(PlayerInfo[playerid][PlayerVehicleModel1], PlayerInfo[playerid][PlayerVehiclePosX1], PlayerInfo[playerid][PlayerVehiclePosY1], PlayerInfo[playerid][PlayerVehiclePosZ1], PlayerInfo[playerid][PlayerVehicleFacing1], PlayerInfo[playerid][pPlayerVehicle1Color], PlayerInfo[playerid][pPlayerVehicle1Color2], -1);
           Line 3641 --->          vehInfo[PlayerVehicleID1[playerid]][VehicleDealership] = 1;
					vehInfo[PlayerVehicleID1[playerid]][VehicleLock] = PlayerInfo[playerid][pVehLock1];
            		vehInfo[PlayerVehicleID1[playerid]][VehicleLocked] = PlayerInfo[playerid][pVehLocked1];
            		SetVehicleVirtualWorld(PlayerVehicleID1[playerid], PlayerInfo[playerid][PlayerVehicle1VirWorld]);
					LinkVehicleToInterior(PlayerVehicleID1[playerid], PlayerInfo[playerid][PlayerVehicle1Interior]);
					strmid(vehInfo[PlayerVehicleID1[playerid]][VehicleOwner], PlayerName(playerid), 0, strlen(PlayerName(playerid)), 255);
					if(PlayerInfo[playerid][pVehLock1] == 1)
					{
						if(PlayerInfo[playerid][pVehLocked1] == 1)
						{
							LockCar(PlayerVehicleID1[playerid]);
						}
						else
						{
						    UnLockCar(PlayerVehicleID1[playerid]);
						}
					}
This is the code from the errors.
Код:
enum vehInfo
{
	VehicleOwner[256],
	VehicleLock,
	VehicleLocked,
	VehicleDealership
};
new vehicleInfo[MAX_CARS][vehInfo];
This is the enum.
Код:
LSLRP.pwn(3641) : error 028: invalid subscript (not an array or too many subscripts): "vehInfo"
C:\Users\Jacko\Documents\John\John\gamemodes\LSLRP.pwn(3641) : warning 215: expression has no effect
C:\Users\Jacko\Documents\John\John\gamemodes\LSLRP.pwn(3641) : error 001: expected token: ";", but found "]"
C:\Users\Jacko\Documents\John\John\gamemodes\LSLRP.pwn(3641) : error 029: invalid expression, assumed zero
C:\Users\Jacko\Documents\John\John\gamemodes\LSLRP.pwn(3641) : fatal error 107: too many error messages on one line
And these are the errors.
Reply
#2

Hello!
Could you show us line 3641, which causes problem?
And about enums.. They looks a'right.

Greetz,
LetsOWN
Reply
#3

Ive edited my post to show you which line it is.
Reply
#4

pawn Код:
vehInfo[PlayerVehicleID1[playerid]][VehicleDealership] = 1;
I've honestly never used an enum like this, but the reason it says "too many subscripts" could be because of the extra [playerid] you placed in the first area (MAX_CARS).

Plus, if you don't mind, can I see where you have PlayerVehicleID1? I don't really think it makes a difference whether I see it or not, but I don't see why you have that in the place of MAX_CARS.
Reply
#5

Okay,
Here is the problem.
pawn Код:
vehInfo[   >  PlayerVehicleID1[playerid]] <     [VehicleDealership] = 1;
In enum, instead of
pawn Код:
VehicleOwner[256],
give
pawn Код:
VehicleOwner[MAX_PLAYERS],
.
Should work now.

But I might did it wrong.
You want VehicleOwner to store what? ID of player or boolean if player is owner or not?
Reply
#6

playervehicleid1 is slot 1 of 5 cars
edit I just thought it would help if you knew that its under a createplayervehicle stock
Reply
#7

Ok i think its my vstream.inc has anyone got the latest version?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)