Dealership
#1

Hello,
I got this bug when i type /v list it wont show the vehicle status of my car but it says that i have 1 car (that one i just bought) Here is the code:
pawn Код:
if(!strcmp(option, "list", true))
    {
        if(PlayerInfo[playerid][pVehicles] == 0) return SCM(playerid, COLOR_LIGHTRED, "You do not own any vehicles.");
        SCMEx(playerid, COLOR_GREEN, "______________Your Vehicles(%d)______________", PlayerInfo[playerid][pVehicles]);
        for(new i = 1; i <= PlayerInfo[playerid][pVehicles]; i++)
        {
            if(VehicleStatus[playerid][i][carOn] == 1)
            {
                if(FindVehicleByPlate(VehicleStatus[playerid][i][carPlate]))
                {
                    SCMEx(playerid, COLOR_GREEN, "Vehicle %d: %s, Lock[%d], Alarm[%d], Immobiliser[%d], Insurances[%d], Times Destroyed[%d], Next Insurance Price[$%d]", i, VehicleNames[VehicleStatus[playerid][i][carModel]-400],VehicleStatus[playerid][i][carLock],VehicleStatus[playerid][i][carAlarm],VehicleStatus[playerid][i][carImmob],VehicleStatus[playerid][i][carInsurances],VehicleStatus[playerid][i][carDestroyed],GetInsurancePrice2(playerid, i));
                }
                else
                {
                    SCMEx(playerid, COLOR_WHITE, "Vehicle %d: %s, Lock[%d], Alarm[%d], Immobiliser[%d], Insurances[%d], Times Destroyed[%d], Next Insurance Price[$%d]", i, VehicleNames[VehicleStatus[playerid][i][carModel]-400],  VehicleStatus[playerid][i][carLock],VehicleStatus[playerid][i][carAlarm],VehicleStatus[playerid][i][carImmob],VehicleStatus[playerid][i][carInsurances],VehicleStatus[playerid][i][carDestroyed],GetInsurancePrice2(playerid, i));
                }
            }
        }
        return 1;
    }
And when i am typing the command to storage the car it says i dont own any vehicles:
Here is the command too just in case you need it:
pawn Код:
if(!strcmp(option, "get", true))
    {
        new slot;
        if(sscanf(params, "{s[7]}d", slot)) return SyntaxMSG(playerid, "/v get [slot(1-3)]");
        if(slot > 3 || slot < 1) return SCM(playerid, -1, "Invalid slot.");
        if(IsVehicleSpawned(PlayerInfo[playerid][pCarKey])) return ErrorMsg(playerid, "You already have a spawned vehicle.");
        if(VehSpawned != 0) return SCM(playerid, COLOR_LIGHTRED, "Someone has just spawned a vehicle, please wait 3 seconds.");
        LoadVehicleFromSlot(playerid, slot);
        return 1;
    }
Reply
#2

here is the other code
pawn Код:
if(listid == buyable)
    {
        if(response)
        {
            new Float:ParkX, Float:ParkY, Float:ParkZ;
            if(GetOwnedVehicles(playerid) == MAX_OWNED_VEHICLES) return SCM(playerid, COLOR_GRAY, "You've reached the maximum owned vehicles.");
            if(IsVehicleSpawned(PlayerInfo[playerid][pCarKey])) return SCM(playerid, COLOR_GRAY, "Please despawn your current spawned vehicle.");
            if(PlayerInfo[playerid][pDonateRank] == 0)
            {
                if(IsABronzeCar(modelid) || IsASilverCar(modelid) || IsAGoldCar(modelid)) return SCM(playerid, COLOR_INFO, "Only donators are able to purchase this vehicle.");
            }
            if(PlayerInfo[playerid][pDonateRank] == 1)
            {
                if(IsASilverCar(modelid) || IsAGoldCar(modelid)) return SCM(playerid, COLOR_INFO, "You must be a silver/gold donator to afford one of this vehicles.");
            }
            if(PlayerInfo[playerid][pDonateRank] == 2)
            {
                if(IsAGoldCar(modelid)) return SCM(playerid, COLOR_INFO, "You must be a gold donator to afford one of this vehicles.");
            }
            new price = GetVehiclePrice(modelid);
            if(GetCash(playerid) < price) return NoCashMSG(playerid);
            format(msg, sizeof(msg), "Congratulations, you have bought a %s for $%d.", VehicleNames[modelid-400], price);
            SCM(playerid, COLOR_YELLOWG, msg);
            GiveCash(playerid, -price);
            new slot;
            if(!strcmp(PlayerVehicle[playerid][pVeh1], "None", true))
                slot = 1;
            else if(!strcmp(PlayerVehicle[playerid][pVeh2], "None", true))
                slot = 2;
            else if(!strcmp(PlayerVehicle[playerid][pVeh3], "None", true))
                slot = 3;
            if(IsABoatModel(modelid))
            {
                ParkX = 310.3268;
                ParkY = -1941.7601;
                ParkZ = 1.3952;
            }
            else if(IsAPlaneModel(modelid))
            {
                ParkX = 1943.5498;
                ParkY = -2397.6553;
                ParkZ = 13.5469;
            }
            else
            {
                ParkX = 1703.1804;
                ParkY = -1509.0079;
                ParkZ = 13.3893;
            }
            PlayerInfo[playerid][pCarKey] = CreateVehicle(modelid, ParkX, ParkY, ParkZ, 0.0, 1, 1, -1);
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carModel] = modelid;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carColor1] = 1;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carColor2] = 1;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carParkX] = ParkX;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carParkY] = ParkY;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carParkZ] = ParkZ;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carParkA] = 0.0;
            format(VehicleInfo[PlayerInfo[playerid][pCarKey]][carPlate], 128, "%s%d", FirstNameLetters(GetName(playerid)), randomEx(10000, 99999));
            format(VehicleInfo[PlayerInfo[playerid][pCarKey]][carOwner], 128, "%s", GetName(playerid));
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carOwned] = 1;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carSpawned] = 0;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carOn] = 1;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carAlarm] = 0;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carLock] = 0;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carImmob] = 0;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carInsurances] = 2;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carDestroyed] = 0;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carGps] = 0;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carOwnerSlot] = 0;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carFuel] = 50;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carRegistered] = 1;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carBroken] = 0;
            for(new i = 0; i < MAX_VEHICLE_WEAPONS; i++)
            {
                VehicleInfo[PlayerInfo[playerid][pCarKey]][carTrunkWep][i] = 0;
                VehicleInfo[PlayerInfo[playerid][pCarKey]][carTrunkAmmo][i] = 0;
            }
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carComponent][0] = 0;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carComponent][1] = 0;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carComponent][2] = 0;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carComponent][3] = 0;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carComponent][4] = 0;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carComponent][5] = 0;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carComponent][6] = 0;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carComponent][7] = 0;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carComponent][8] = 0;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carComponent][9] = 0;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carComponent][10] = 0;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carComponent][11] = 0;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carComponent][12] = 0;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carComponent][13] = 0;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carPaintJob] = 3;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carRadio] = 0;
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carDupKey] = randomEx(1234567, 9999999);
            VehicleInfo[PlayerInfo[playerid][pCarKey]][carComps] = 0;
            for(new i = 0; i < MAX_DRUGS; i++)
            {
                VehicleInfo[PlayerInfo[playerid][pCarKey]][carDrug][i] = 0;
                VehicleInfo[PlayerInfo[playerid][pCarKey]][carDrugAmount][i] = 0;
            }
            for(new i = 0; i < MAX_CAR_TICKETS; i++)
            {
                VehicleInfo[PlayerInfo[playerid][pCarKey]][carTicket][i] = 0;
            }
            PlayerInfo[playerid][pVehicles]++;
            OnPlayerBuyCar(playerid, PlayerInfo[playerid][pCarKey], modelid, 1, 1, slot, ParkX, ParkY, ParkZ, 0.0, VehicleInfo[PlayerInfo[playerid][pCarKey]][carPlate], VehicleInfo[PlayerInfo[playerid][pCarKey]][carOwner]);
            DestoryCar(PlayerInfo[playerid][pCarKey]);
            PlayerInfo[playerid][pCarKey] = 0;
            CheckOwnedVehicles(playerid);
        }
        else return SCM(playerid, COLOR_INFO, "Canceled vehicle selection.");
        return 1;
    }
    return 1;
}
Reply
#3

also this
pawn Код:
stock OnPlayerBuyCar(playerid, vehid, model, color1, color2, slot, Float:ParkX, Float:ParkY, Float:ParkZ, Float:ParkA, plate[], owner[])
{
    //======================================================================================
    format(query, sizeof(query), "INSERT INTO `ownedvehicles` (model, color1, color2, parkx, parky, parkz, parka, plate, owner, owned, slot) VALUES (%d, %d, %d, %f, %f, %f, %f, '%s', '%s', %d, %d)",
    model, color1, color2, ParkX, ParkY, ParkZ, ParkA, plate, owner, 1, slot);
    mysql_function_query(dbHandle, query, true, "OnOwnedVehicleInsert", "%d", vehid);
    //======================================================================================
    format(query, sizeof(query), "UPDATE `ownedvehicles` SET `alarm` = %d, `lock` = %d, `immob` = %d, `insurances` = %d, `destroys` = %d, `gps` = %d, `fuel` = %d, `registered` = %d, `broken` = %d WHERE `owner` = '%s' AND `slot` = %d",
    0, 0, 0, 2, 0, 0, 50, 1, 0, GetName(playerid), slot);
    mysql_function_query(dbHandle, query, false, "", "");
    //======================================================================================
    format(query, sizeof(query), "UPDATE `ownedvehicles` SET `weapons` = '%s' WHERE `owner` = '%s' AND `slot` = %d", "0=0|0=0|0=0|0=0|0=0|0=0|0=0|0=0|0=0|0=0", GetName(playerid),slot);
    mysql_function_query(dbHandle, query, false, "", "");
    //======================================================================================
    format(query, sizeof(query), "UPDATE `ownedvehicles` SET `comp0` = %d, `comp1` = %d, `comp2` = %d, `comp3` = %d, `comp4` = %d, `comp5` = %d, `comp6` = %d WHERE `owner` = '%s' AND `slot` = %d",
    0, 0, 0, 0, 0, 0, 0, GetName(playerid), slot);
    mysql_function_query(dbHandle, query, false, "", "");
    //=====================================================================================
    format(query, sizeof(query), "UPDATE `ownedvehicles` SET `comp7` = %d, `comp8` = %d, `comp9` = %d, `comp10` = %d, `comp11` = %d, `comp12` = %d, `comp13` = %d, `paintjob` = %d WHERE `owner` = '%s' AND `slot` = %d",
    0, 0, 0, 0, 0, 0, 0, 3, GetName(playerid), slot);
    mysql_function_query(dbHandle, query, false, "", "");
    //=====================================================================================
    format(query, sizeof(query), "UPDATE `ownedvehicles` SET `radio` = %d, `tickets` = '%s', `dupkey` = %d, `comps` = %d WHERE `owner` = '%s' AND `slot` = %d", 0, "0|0|0|0|0|0|0|0|0|0", VehicleInfo[vehid][carDupKey], 0, GetName(playerid), slot);
    mysql_function_query(dbHandle, query, false, "", "");
    //=====================================================================================
    format(query, sizeof(query), "UPDATE `ownedvehicles` SET `drugs` = '%s' WHERE `owner` = '%s' AND `slot` = %d", "0=0|0=0|0=0|0=0|0=0|0=0|0=0|0=0|0=0|0=0|0=0|0=0|0=0|0=0|0=0|0=0|0=0|0=0|0=0|0=0", GetName(playerid), slot);
    mysql_function_query(dbHandle, query, false, "", "");
    //=====================================================================================
    format(query, sizeof(query), "UPDATE `users` SET `vehicles` = %d WHERE `name` = '%s'", PlayerInfo[playerid][pVehicles], GetName(playerid));
    mysql_function_query(dbHandle, query, false, "", "");
    //======================================================================================
    if(slot == 1)
    {
        format(query, sizeof(query), "UPDATE `users` SET `veh1` = '%s' WHERE `name` = '%s'", VehicleNames[model-400], GetName(playerid));
        format(PlayerVehicle[playerid][pVeh1], 128, "%s", VehicleNames[model-400]);
        mysql_function_query(dbHandle, query, false, "", "");
    }
    else if(slot == 2)
    {
        format(query, sizeof(query), "UPDATE `users` SET `veh2` = '%s' WHERE `name` = '%s'", VehicleNames[model-400], GetName(playerid));
        format(PlayerVehicle[playerid][pVeh2], 128, "%s", VehicleNames[model-400]);
        mysql_function_query(dbHandle, query, false, "", "");
    }
    else if(slot == 3)
    {
        format(query, sizeof(query), "UPDATE `users` SET `veh3` = '%s' WHERE `name` = '%s'", VehicleNames[model-400], GetName(playerid));
        format(PlayerVehicle[playerid][pVeh3], 128, "%s", VehicleNames[model-400]);
        mysql_function_query(dbHandle, query, false, "", "");
    }
    //======================================================================================
    return 1;
}
Reply
#4

Does it change if i make it to true?
Reply
#5

Nah i tried it, Anyways when i buy a car it dosen't save inside mysql. Well i see no car in the table.
Reply
#6

Bump....
Reply
#7

Bump!
Anyone
Reply
#8

Bump
Reply
#9

You should debug your MySQL code to see which line fails exactly.

Your PAWN seems okay, try what I said.

Good luck.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)