mysql load only car id 1 [+Rep]
#1

hello

i have a problem of loading owned vehicles for players server load only car id 1 and don't load the other ids plz help

pawn Код:
stock LoadOwnedVehicles()
{
    new
        Query[1024],
        vModel2,
        vC[2],
        vPrice2,
        vOwner2[MAX_PLAYER_NAME],
        Float:Pos[4],
        vID,
        PlateNum[32],
        vPaint_Job,
        vLock,
        vMoney,
        vMats,
        vCocaine,
        vMoonshine,
        vWeed,
        CarFuel;
    mysql_format(mysql, Query, sizeof(Query), "SELECT * FROM `OwnedVehicles` WHERE `OwnedVehicleID` < "#MAX_BUYABLE_VEH" ORDER BY OwnedVehicleID");
    mysql_query(mysql, Query, "", "");
    mysql_store_result();

    if(mysql_num_rows() > 0)
    {
        while(mysql_fetch_row(Query))
        {
            sscanf(Query, "p<|>iiiiis[24]ffffs[32]iiiiiiii",
            vID, vModel2, vC[0], vC[1], vPrice2, vOwner2, Pos[0], Pos[1], Pos[2], Pos[3], PlateNum, vPaint_Job,
             vLock, vMoney, vMats, vCocaine, vMoonshine, vWeed, CarFuel);

            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];
            strmid(Vehicles[vID][VehiclePlate], PlateNum, 0, 32, 32);
            Vehicles[vID][VehiclePaintJob] = vPaint_Job;
            Vehicles[vID][vLocked] = vLock;
            Vehicles[vID][vTrunkMoney] = vMoney;
            Vehicles[vID][vTrunkMats] = vMats;
            Vehicles[vID][vTrunkCocaine] = vCocaine;
            Vehicles[vID][vTrunkWeed] = vWeed;
            Vehicles[vID][vTrunkMoonshine] = vMoonshine;
            Vehicles[vID][vFuel] = CarFuel;

            if(Vehicles[vID][vLocked] == 1)
            {
                SetVehicleParamsEx(vID, 0, 0, 0, 1, 0, 0, 0);
            }

            new
                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;
            format(Vehicles[OwnedCar(vCarID)][VehiclePlate], 10, "%s", Vehicles[OwnedCar(vCarID)][VehiclePlate]);
            SetVehicleNumberPlate(vCarID, Vehicles[OwnedCar(vCarID)][VehiclePlate]);
            SetVehicleToRespawn(OwnedCar(vCarID));
            ++ TotalVehiclesCreated;
            SaveOwnedCar(OwnedCar(vCarID));
            printf("OC: %s spawned - Plate: %s.", GetVehicleName(vCarID), Vehicles[OwnedCar(vCarID)][VehiclePlate]);
        }
    }
    mysql_free_result();
    printf("%d owned vehicles loaded from the MySQL Database.", TotalVehiclesCreated);

    return TotalVehiclesCreated;
}

sorry for my bad english
Reply
#2

any one??
Reply
#3

help plz!
Reply
#4

++ TotalVehiclesCreated;

Should be:

TotalVehiclesCreated++;
Reply
#5

Quote:
Originally Posted by Sledgehammer
Посмотреть сообщение
++ TotalVehiclesCreated;

Should be:

TotalVehiclesCreated++;
Has nothing to do with it, as in this context both versions have exactly the same effect. But try:
Код:
new a = 5;
new b = 5;

printf("%d", a++); // prints 5, because a gets incremented after the print
printf("%d", ++b); // prints 6, because b gets incremented before the print
Reply
#6

Quote:
Originally Posted by Vince
Посмотреть сообщение
Has nothing to do with it, as in this context both versions have exactly the same effect. But try:
Код:
new a = 5;
new b = 5;

printf("%d", a++); // prints 5, because a gets incremented after the print
printf("%d", ++b); // prints 6, because b gets incremented before the print
That is interesting. Thank you for correcting me.
Reply
#7

so someone can help? xD
Reply
#8

helpppp plz
Reply
#9

Upgrade to a newer mysql, r5 and r6 OR strickenkids if that's what you're using are old, and incredibly slow in comparison to the newer ones.
Reply
#10

Quote:
Originally Posted by Dubya
Посмотреть сообщение
Upgrade to a newer mysql, r5 and r6 OR strickenkids if that's what you're using are old, and incredibly slow in comparison to the newer ones.
i'm using mysql r34 dude plz help
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)