Will work for vehicles loaded in, but when creating, won't.
#1

Alright, when I load in vehicles, I can use this command.

pawn Код:
CMD:setprice(playerid, params[])
{
    new vehicleid = GetPlayerVehicleID(playerid);
    new price;

    PlayerSQLID[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "id", "accounts");
    BizOwned[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "BizOwned", "accounts");
    VehBizID[vehicleid] = MySQL_GetValue(vehicleid, "VehBizID", "vehicles");
   
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOUR_GREY, "You must be in a vehicle to use this.");
    if(BizOwned[playerid] != VehBizID[vehicleid]) return SendClientMessage(playerid, COLOUR_GREY, "Your business does not own this vehicle.");
   
    if(sscanf(params, "d", price))return SendClientMessage(playerid, COLOUR_GREY, "USAGE: /setprice [price] (You must be in a business vehicle)");

    MySQL_SetInteger(vehicleid, "VehPrice", price, "vehicles");
    VehPrice[vehicleid] = price;
   
    new string[128];
    new name = VehModel[vehicleid] - 400;
    format(string, sizeof(string), "%s, $%d, %s", VehicleNames[name], price, VehPlate[vehicleid]);
    UpdateDynamic3DTextLabelText(VehicleLabel[vehicleid], COLOUR_WHITE, string);
   
    SendClientMessage(playerid, COLOUR_WHITE, "Business vehicle price has been updated.");
    return 1;
 }

However, if I create a vehicle using this....I can't.

pawn Код:
stock DealerOrderVehicle(playerid, model, price)
{

    if(GetPlayerMoney(playerid) < price)return SendClientMessage(playerid, COLOUR_GREY, "You do not have enough money to purchase this vehicle.");
            PlayerSQLID[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "id", "accounts");
            BizOwned[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "BizOwned", "accounts");
           

            new string1[64], businessid = GetPlayerBizID(playerid), plate[8], colour1, colour2;
           
            colour1 = random(126);
            colour2 = random(126);
           
            if(businessid == 7)
            {

            new vehicleid = CreateVehicle(model,-199.5428, 1224.1710, 19.5659, 180.0,colour1, colour2, 0);

           
            #define     MAX_PASS        8
            new charset[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
            new newPass[MAX_PASS];
            for(new i = 0; i < MAX_PASS; i++)
            {
              newPass[i] = charset[RandomEx(0, sizeof(charset))]; // 62 = strlen of charset
            }


            format(plate, sizeof(plate), "%s",newPass);
            SetVehicleNumberPlate(vehicleid, plate);
           
            EngineStartStatus[vehicleid] = 0;
           
            VehFuel[vehicleid] = random(100);

            new query[550];
            format(query, sizeof(query), "INSERT INTO `vehicles` (VehModel, VehOwner, VehSpawnX, VehSpawnY, VehSpawnZ,VehSpawnAngle, VehColour1, VehColour2, VehFuel, VehPlate, VehWep1,VehWepA1,VehWep2,VehWepA2, VehCash, VehArmour, VehFaction, VehFRank, VehOwned, VehFactioned, VehBizID, VehPrice,VehForSale) VALUES (%d, %d, -199.5428,1224.1710,19.5659,180.0,%d,%d,%d,'%s',0,0,0,0,0,0,0,0,0,0,%d,0,1)",model, 0,colour1, colour2, VehFuel[vehicleid], plate, BizOwned[playerid]);
            mysql_query(query);
            VehicleSQLID[vehicleid] = mysql_insert_id();

            VehBizID[vehicleid] = BizOwned[playerid];
            VehForSale[vehicleid] = 0;
            VehPrice[vehicleid] = 0;
            VehFactioned[vehicleid] = 0;
            VehOwner[vehicleid] = 0;
            VehOwned[vehicleid] = 0;
            VehPlate[vehicleid] = plate;

            format(string1, sizeof(string1), "Your have ordered a %s (Cost: $%d.) for your business. Use /help business for further assistance", VehicleNames[model - 400], price);
            SendClientMessage(playerid, COLOUR_WHITE, string1);
            PlayerMoney[playerid] = MySQL_GetValue(PlayerMoney[playerid], "Money", "accounts");
            GivePlayerMoney(playerid, PlayerMoney[playerid] - price);
    }
    return 1;
}
Could anyone tell me why and if you can ask me which parts of code you need to see. I've no idea, At all.
Reply
#2

Receiving any error messages either in the client, or perhaps in the server logs?
Reply
#3

Not at all, which is a little odd, right?
Reply
#4

Add some debug print messages. Print just about every variable value and perhaps anything MySQL returns.
Reply
#5

I've done that. Couldn't see anything conclusivee
Reply
#6

Can you show some code for where you're using this function...?

pawn Код:
DealerOrderVehicle(playerid, model, price)
Reply
#7

Yes, Indeed.

pawn Код:
else if (dialogid == DIALOG_CAR_BIKES)
                {
            if(response == 0)
                {
                    if(Donator[playerid] > 0) ShowPlayerDialog(playerid, DIALOG_VEHICLE_PURCHASE, DIALOG_STYLE_LIST, "Vehicle Dealership", "Older Vehicles\nClassic Vehicles\nSedans\nSUVs/Trucks\nMotorcycles\nSports Vehicles\nDonator Vehicles", "Select", "Cancel");
                    else ShowPlayerDialog(playerid, DIALOG_VEHICLE_PURCHASE, DIALOG_STYLE_LIST, "Vehicle Dealership Menu", "Older Vehicles\nClassical Vehicles\nSedans\nSUVs/Trucks\nMotorcycles\nSports Vehicles", "Select", "Cancel");
                }
            else switch (listitem)
            {
            case 0: DealerOrderVehicle(playerid, 586, 15000);
            case 1: DealerOrderVehicle(playerid, 521, 20000);
            case 2: DealerOrderVehicle(playerid, 461, 20000);
            case 3: DealerOrderVehicle(playerid, 463, 21000);
Reply
#8

*cough* use a switch statement to determine dialog ID's *cough*

Um. This is a very odd bug you have here. Mind PMing me the whole system?
Reply
#9

I find it easier to see aha!!

Yeah, sure. No problem. Thank you so much.
Reply
#10

Hm. You said restarting the server resolves the issue?

Could you post the MySQL_GetValue function?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)