Confused.
#1

I am confused here, on this section of the script:

pawn Код:
if(OwnedVeh[playerid][1] != -1)
            {
                OwnedVeh[playerid][1] = vID;
            }
            else if(OwnedVeh[playerid][2] != -1)
            {
                OwnedVeh[playerid][2] = vID;
            }
            else if(OwnedVeh[playerid][3] != -1)
            {
                OwnedVeh[playerid][3] = vID;
            }
It doesn't assign the actual variable to the correct ID.

This is the stock.

pawn Код:
stock LoadPlayerVehicles(playerid)
{
    new Query[128], query[128], vModel2, vC[2], vPrice2, vOwner2[MAX_PLAYER_NAME], Float:Pos[4], vID, vPaint_Job, vLock, vCarID;

    format(query, sizeof(query), "SELECT * FROM `PlayerVehicles` WHERE `OwnedVehicleOwner` = '%s'", pName(playerid));
    mysql_query(query);
    mysql_store_result();

    if(mysql_num_rows() > 0)
    {
        while(mysql_fetch_row(Query))
        {
            sscanf(Query, "p<|>iiiiis[24]ffffii", vID, vModel2, vC[0], vC[1], vPrice2, vOwner2, Pos[0], Pos[1], Pos[2], Pos[3], vPaint_Job, vLock);

            Vehicles[vID][vModel] = vModel2;
            Vehicles[vID][vColor1] = vC[0];
            Vehicles[vID][vColor2] = vC[1];
            Vehicles[vID][vPrice] = vPrice2;
            strmid(Vehicles[vID][VehicleOwner], vOwner2, 0, 24, 24);
            Vehicles[vID][vPosX] = Pos[0];
            Vehicles[vID][vPosY] = Pos[1];
            Vehicles[vID][vPosZ] = Pos[2];
            Vehicles[vID][vPosA] = Pos[3];
            Vehicles[vID][VehiclePaintJob] = vPaint_Job;
            Vehicles[vID][vLocked] = vLock;

            SetVehicleParamsEx(vID, 0, 0, 0, Vehicles[vID][vLocked], 0, 0, 0);

            vCarID = CreateVehicle(Vehicles[vID][vModel], Vehicles[vID][vPosX], Vehicles[vID][vPosY], Vehicles[vID][vPosZ], Vehicles[vID][vPosA], Vehicles[vID][vColor1], Vehicles[vID][vColor2], 500000);

            ChangeVehicleColor(vCarID, Vehicles[vID][vColor1], Vehicles[vID][vColor2]);

            OwnedCar(vCarID) = vID;

            VehicleFuel[OwnedCar(vCarID)] = 100;

            VehicleFuel[vCarID] = 100;

            VehicleFuel[vID] = 100;

            if(OwnedVeh[playerid][1] != -1)
            {
                OwnedVeh[playerid][1] = vID;
            }
            else if(OwnedVeh[playerid][2] != -1)
            {
                OwnedVeh[playerid][2] = vID;
            }
            else if(OwnedVeh[playerid][3] != -1)
            {
                OwnedVeh[playerid][3] = vID;
            }
           
            ++ TotalVehiclesCreated;
           
            SaveOwnedCar(OwnedCar(vCarID));
           
            printf("OC: %s spawned - Owner: %s.", GetVehicleName(vCarID), Vehicles[OwnedCar(vCarID)][VehicleOwner]);
        }
    }
    mysql_free_result();

    return TotalVehiclesCreated;
}
It returns the OC: %s spawned - Owner: %s. printf statement, but it just won't do it..
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)