#Qbox foreign keys issue with Zyke_garages
1 messages · Page 1 of 1 (latest)
its a paid script so youll need to go to their support team
the issue is caused by qbox and not the script, i have to change something in qbx_core or in the database but i need to know if anyone had the same issue or if there's another way around
if you think you changed something in the qbx_core id say redownload it
it's not this kind of issue
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! ❤️
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 🙏
@rough onyx
I don't really know SQL but Cricket hopefully may have a moment to look at this. I'm not sure ;-;
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
@simple patrol maybe you know?
Do you have the zyke_default_garages.sql or the clean garages sql code?
default
Does the script come with SQL? IF SO please provide.
here's all the sql files
ok what does the line at the unlocked/functions.lua:324 read?
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
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,
})```
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
oh!
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
where is that exactly? i changed it to owner and it worked! do i need to change the sql also?
oh i get it in the player_vehicles sql
Hurray! Don't forget to mark resolved and to tell the scripter.
it may be because player_vehicles are not job vehicles

and they are linked to a player, thus why the foreign key
yeah because the car does not appear in the garage
dont use a shit garage system, problem solved
wtf you mean! he's just not using qbox that doesn't make him shit..
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
I don't see the owner column in the sql, you many have to add it
so the issue is that the newowner will set the job as the owner under citizenid but fails because of qbox foreign key, not sure if i understood everything but that's what i understand
so i can not make the player_vehicles citizenid (owner) something other than a player.
I'm using zyke_garages any news on this?
just delete it in the DB
just delete this
Do the work garages operate normally there?
yup
So just delete the citizenid column?
I read the whole conversation and didn't understand, could you send me your zyke_garages SQL? 😦
As yours already works it would help
delete the foreign key
Oh yes I understand, one question is, is there a problem with it saying license instead of license2? In the Zyke garage it only says license
shouldnt be