#Qbox foreign keys issue with Zyke_garages

1 messages · Page 1 of 1 (latest)

inland sphinx
#

when claiming a vehicle for a job aparently i can't just change it from a player to a job in the database because of qbox foreign keys

thanks in advance

strange coyote
inland sphinx
strange coyote
#

if you think you changed something in the qbx_core id say redownload it

inland sphinx
gentle adder
#

It doesn't look like this scripter has really been mentioned at all in this Discord, but I think they're in here. Hm.

Is it an SQL thing? We will need much more information in order to even begin assisting though I would heavily suggest opening a ticket with the developer as well, in order to work with both so that maybe we can help them fix their script to make it compatible. But yeah. We need much more info! ❤️

inland sphinx
#

what im trying to do is give a vehicle ownership to a job since zyke_garages have a job assigned garage that the owner can manage and and when i try to assign a vehicle i get this error about foreign keys, i don't understand how qbox is compared to qb so i need a bit of help on this one 🙏

gentle adder
#

@rough onyx

#

I don't really know SQL but Cricket hopefully may have a moment to look at this. I'm not sure ;-;

inland sphinx
#

what zyke told me, That is because of the foreign keys Qbox have implemented, so you can't just change it from a player to a job in the database

gentle adder
#

@simple patrol maybe you know?

rough onyx
gentle adder
inland sphinx
rough onyx
rough onyx
#

I can't read the whole thing, but it doesn't look like your player_vehicles has a column called newOwner. Can you send me a snip of the table tab in Heidi?

#

@inland sphinx

#

He is trying to change the name of the column, but it's not compatible

#

Where it says [@owner] = newOwner. That code changes the sql column it reads to writes to

inland sphinx
#
            local res = MySQL.insert.await(("INSERT INTO `%s` (`%s`, `%s`, `%s`, `%s`, `%s`, `%s`, `%s`, `%s`, `%s`, `%s`, `%s`, `%s`, `%s`, `%s`, `%s`, `%s`, `%s`) VALUES (@license, @owner, @vin, @vehicle, @type, @mods, @plate, @garage, @parked, @fuel, @engine, @body, @paymentamount, @paymentsleft, @financetime, @balance, @modelLabel)"):format(
                DB.player_vehicles,
                DB.license,
                DB.owner,
                DB.vin,
                DB.vehicle,
                DB.type,
                DB.mods,
                DB.plate,
                DB.garage,
                DB.parked,
                DB.fuel,
                DB.engine,
                DB.body,
                DB.paymentamount,
                DB.paymentsleft,
                DB.financetime,
                DB.balance,
                DB.modelLabel
            ), {
                ["license"] = license,
                ["@owner"] = newOwner,
                ["@vin"] = vin,
                ["@vehicle"] = mods.model or "CARNOTFOUND",
                ["@type"] = vehicleType,
                ["@mods"] = json.encode(mods or {}),
                ["@plate"] = vehicleData.plate,
                ---@diagnostic disable-next-line: param-type-mismatch
                ["@garage"] = garageId or GetDefaultGarage(newOwner, vehicleType),
                ["@parked"] = 0,
                ["@fuel"] = vehicleData?.fuel or mods?.fuelLevel or 100, -- Pass in your own value if you wish, but the mods should grab it automatically depending on your server
                ["@engine"] = vehicleData?.engine or mods?.engineHealth or 1000, -- Pass in your own value if you wish, but the mods should grab it automatically depending on your server
                ["@body"] = vehicleData?.body or mods?.bodyHealth or 1000, -- Pass in your own value if you wish, but the mods should grab it automatically depending on your server
                ["@paymentamount"] = 0,
                ["@paymentsleft"] = 0,
                ["@financetime"] = 0,
                ["@balance"] = 0,
                ["@modelLabel"] = vehicleData.modelLabel or extraData.modelLabel,
            })```
rough onyx
#

I wouldn't be surprised if you changed [@owner] = newOwner to [@owner] = owner and it would work

#

That is not the code I was talking about hon

inland sphinx
#

oh!

rough onyx
#

This one

#

Sorry I meant to highlight the tab above it

#

according to the first error though you don't have a newOnwer or a owner column. You will have to manually create

#

@inland sphinx He forgot to put owner in there

inland sphinx
inland sphinx
inland sphinx
gentle adder
#

Hurray! Don't forget to mark resolved and to tell the scripter.

mental lark
#

it may be because player_vehicles are not job vehicles

#

and they are linked to a player, thus why the foreign key

inland sphinx
#

yeah because the car does not appear in the garage

mental lark
#

dont use a shit garage system, problem solved

inland sphinx
#

wtf you mean! he's just not using qbox that doesn't make him shit..

mental lark
#

if ur garage

#

is trying to add job garages to

#

player_vehicles

#

your issue is right there bro

#

even jg makes its own table instead of tryna edit player_vehicles

#

because its literally named player_vehicles not job not anything else

rough onyx
# inland sphinx

I don't see the owner column in the sql, you many have to add it

inland sphinx
#

so i can not make the player_vehicles citizenid (owner) something other than a player.

inland sphinx
kindred creek
#

I'm using zyke_garages any news on this?

inland sphinx
inland sphinx
kindred creek
inland sphinx
#

yup

kindred creek
#

I read the whole conversation and didn't understand, could you send me your zyke_garages SQL? 😦

#

As yours already works it would help

mental lark
#

delete the foreign key

kindred creek
mental lark
#

shouldnt be