Vehicle system error.
#1

pawn Код:
stock VehicleLoad(vehicleID, file[])//loading the vehicle provided by the id when the server starts.
{
    INI_ParseFile(file, "LoadVehicleData", .bExtra = true, .extra = vehicleID);
    VehicleCreate(VehicleInfo[vehicleID][vModel],
    VehicleInfo[vehicleID][vLoc], VehicleInfo[vehicleID][vColor1], VehicleInfo[vehicleID][vColor2], VehicleInfo[vehicleID][vRespawn],
    VehicleInfo[vehicleID][vOwner], VehicleInfo[vehicleID][vLocked]);
}

stock VehicleSave(vehicleID)
{
    new INI:dFile = INI_Open(VehiclePath(vehicleID));
    new strLoc[8];
    INI_WriteInt(dFile, "model", VehicleInfo[vehicleID][vModel]);
    for(new i = 0; i < 4; i++) { format(strLoc, sizeof(strLoc), "Loc%d", i); INI_Float(dFile, strLoc, VehicleInfo[vehicleID][vLoc][i]); }
    INI_WriteInt(dFile, "color1", VehicleInfo[vehicleID][vColor1]);
    INI_WriteInt(dFile, "color2", VehicleInfo[vehicleID][vColor2]);
    INI_WriteInt(dFile, "respawn", VehicleInfo[vehicleID][vRespawn]);
    INI_WriteString(dFile, "owner", VehicleInfo[vehicleID][vOwner]);
    INI_WriteInt(dFile, "locked", VehicleInfo[vehicleID][vLocked] ? 1 : 0);
    INI_Close(dFile);
}
Код:
(228) : error 047: array sizes do not match, or destination array is too small
(238) : error 035: argument type mismatch (argument 1)
(238) : error 017: undefined symbol "value"
The lines:
pawn Код:
VehicleCreate(VehicleInfo[vehicleID][vModel],VehicleInfo[vehicleID][vLoc], VehicleInfo[vehicleID][vColor1], VehicleInfo[vehicleID][vColor2], VehicleInfo[vehicleID][vRespawn],VehicleInfo[vehicleID][vOwner], VehicleInfo[vehicleID][vLocked]);
pawn Код:
for(new i = 0; i < 4; i++) { format(strLoc, sizeof(strLoc), "Loc%d", i); INI_Float(dFile, strLoc, VehicleInfo[vehicleID][vLoc][i]); }
Any ideas?
Reply
#2

For the first one, you have VehicleInfo[vehicleID][vOwner], which is probably an array size of 24 or MAX_PLAYER_NAME. You need to match that array size in your VehicleCreate function, so I'd need to see that before I can correct it.

As for the second one, you have INI_Float, whereas you should have been using INI_WriteFloat.
Reply
#3

Yeah but both are the same values though O.o

pawn Код:
stock VehicleCreate(vehicleModel, Float:vehicleLoc[4], vehicleColor1, vehicleColor2, vehicleRespawn, vehicleOwner[], bool:vehicleLocked)
{
    new vehicleid = VehicleGetFreeSlot();
    VehicleInfo[vehicleid][vModel] = vehicleModel;
    VehicleInfo[vehicleid][vLoc] = vehicleLoc;
    VehicleInfo[vehicleid][vColor1] = vehicleColor1;
    VehicleInfo[vehicleid][vColor2] = vehicleColor2;
    VehicleInfo[vehicleid][vRespawn] = vehicleRespawn;
    format(VehicleInfo[vehicleid][vOwner], MAX_PLAYER_NAME, vehicleOwner);
    VehicleInfo[vehicleid][vLocked] = vehicleLocked;
    VehicleInfo[vehicleid][vID] = CreateVehicle(vehicleModel, vehicleLoc[0], vehicleLoc[1], vehicleLoc[2], vehicleLoc[3], vehicleColor1, vehicleColor2,vehicleRespawn);
    vCreated[vehicleid] = true;
    VehicleLock(vehicleid, VehicleInfo[vehicleid][vLocked]);
   
    return vehicleid;
}
Reply
#4

Change:
pawn Код:
vehicleOwner[]
to:
pawn Код:
vehicleOwner[MAX_PLAYER_NAME]
Reply
#5

Yeah I tried that but it gives me the same error.
Reply
#6

When you call VehicleCreate function you pass single argument for location: VehicleInfo[vehicleID][vLoc]
You need to pass X,Y,Z arguments as floats and separated.
Reply
#7

Alright so I changed into single separated ones and still got the same problem -.-

pawn Код:
VehicleCreate(VehicleInfo[vehicleID][vModel], VehicleInfo[vehicleID][vLocx], VehicleInfo[vehicleID][vLocy], VehicleInfo[vehicleID][vLocz],VehicleInfo[vehicleID][vLocr], VehicleInfo[vehicleID][vColor1], VehicleInfo[vehicleID][vColor2], VehicleInfo[vehicleID][vRespawn],VehicleInfo[vehicleID][vOwner], VehicleInfo[vehicleID][vLocked]);
Reply
#8

Could you show your enum?
Reply
#9

pawn Код:
enum vInfo
{
    vID,
    vModel,
    Float:vLoc[4],
    vColor1,
    vColor2,
    vRespawn,
    vOwner[MAX_PLAYER_NAME],
    bool:vLocked
}
Then I changed the vLoc to separate x,y,z and angle but still didn't work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)