Problem
#1

I'm trying to make a vehicle system with Y_INI, but i'm getting an error on loading vehicle pos.

Enum:

pawn Код:
enum vInfo
{
    Float:vLoc[4]
}
LoadVehicleData function:

pawn Код:
function LoadVehicleData(vehicleID, name[], value[])
{
    new strLoc[8];
    INI_Int("model", VehicleInfo[vehicleID][vModel]);
    for(new i = 0; i < 4; i++) format(strLoc, sizeof(strLoc), "Loc%d", i), INI_Float(strLoc, VehicleInfo[vehicleID][vLoc][i]);

    INI_Int("color1", VehicleInfo[vehicleID][vColor1]);
    INI_Int("color2", VehicleInfo[vehicleID][vColor2]);
    INI_Int("respawn", VehicleInfo[vehicleID][vRespawn]);
    INI_String("owner", VehicleInfo[vehicleID][vOwner], MAX_PLAYER_NAME);
   
    VehicleInfo[vehicleID][vLocked] = INI_Int("locked") == 1 ? true : false;
    return 1;
}
The problem is in this line.

pawn Код:
for(new i = 0; i < 4; i++) format(strLoc, sizeof(strLoc), "Loc%d", i), INI_Float(strLoc, VehicleInfo[vehicleID][vLoc][i]);
Basically i'm trying to loop the vehicle position (X, Y, Z, A), but getting:

Quote:

error 029: invalid expression, assumed zero
error 001: expected token: ";", but found "return"
error 017: undefined symbol "i"
fatal error 107: too many error messages on one line

Reply
#2

That are two sections. You have to separate it.
PHP код:
for(new i=0;i<4;i++) {
    
format(strLoc,sizeof(strLoc),"Loc%d",i);
    
INI_Float(strLoc,VehicleInfo[vehicleID][vLoc][i]);

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)