Closed titicarabina closed 1 year ago
Hi @titicarabina . Thank you for reporting the issue. Unfortunately, due to proper database constraints, qb-multicharacter needs to be modified. You can replace the qb-multicharacter:server:deleteCharacter
event with this one in server/server.lua and it should fix the issue. I will also add it to the multicharacter docs
RegisterNetEvent('qb-multicharacter:server:deleteCharacter', function(citizenid)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
local outfits = MySQL.query.await("SELECT * FROM player_outfits WHERE citizenid = ?", {citizenid})
for i = 1, #outfits, 1 do
MySQL.query.await("DELETE FROM player_outfit_codes WHERE id = ?", {outfits[i].id})
end
Wait(1000)
QBCore.Player.DeleteCharacter(src, citizenid)
TriggerClientEvent('QBCore:Notify', src, Lang:t("notifications.char_deleted") , "success")
end)
In order to keep compatibility and reduce the amount of modifications, I have removed the foreign key constraint in https://github.com/iLLeniumStudios/illenium-appearance/commit/ac41c1eef0b840a6676945b04c911a22bbdb1ecc
So feel free to delete the table and recreate it again using the new SQL and you should not need the above modifications
[ script:oxmysql] Error: qb-core was unable to execute a transaction! [ script:oxmysql] Cannot delete or update a parent row: a foreign key constraint fails (
rcdesign_vamos
.player_outfit_codes
, CONSTRAINTFK_player_outfit_codes_player_outfits
FOREIGN KEY (outfitid
) REFERENCESplayer_outfits
(id
))I get this error every time i am trying to delete a character that has an outfit code . Can you please check ? Thank you! I am using QBCore