22.12.2013, 15:52
Hi there,
I was making a custom vehicle system, but on compiling I get this error and I don't undestand why
Here's my code:
The problem comes when I assign to the varible Car[id][cPrice] a value
Someone can help?
I was making a custom vehicle system, but on compiling I get this error and I don't undestand why
Код:
error 032: array index out of bounds (variable "Car")
pawn Код:
enum vInfo
{
cOwner[30],
cModel,
cPrice,
cCol1 = 0,
cCol2 = 0
};
new Car[MAX_VEHICLES][vInfo];
pawn Код:
forward CreaVeh(playerid, model, price);
public CreaVeh(playerid, model, price)
{
if(GetPlayerMoney(playerid) >= price)
{
new Float:X, Float:Y, Float:Z;GetPlayerPos(playerid, X, Y, Z);
autom[playerid] = CreateVehicle(model, X, Y+2.0, Z, 0.0, 0, 0, 60);
PutPlayerInVehicle(playerid, autom[playerid], 0);
new id = autom[playerid];
format(Car[id][cOwner], 30, PlayerName(playerid));
new msg[256];
format(msg, sizeof(msg), "DEBUG: Owner: %s", Car[id][cOwner]);
SCM(playerid, -1, msg);
Car[id][cPrice] = price; //error
Car[id][cModel] = model; //error
Car[id][cCol1] = 0;
Car[id][cCol2] = 0;
TogglePlayerControllable(playerid, 0);
inColor[playerid] = 1;
}
return 1;
}
Someone can help?