Tried your sql now, hope it works for all.
yes now works
Reinstall the sql
Well thanks haha, got damn, i exported my table as a sql. For some reason it never works haha. Well it works on my server, and my server only.
Yea nah your missing something here man, Its not working either on this end, for some reason… I use the bag and nothing then I check my inventory again and it removed the bag, I drop the bag walk up to it and it picks it up… something is missing here.
If i put in 1 fixkit and after this another fixkit i have two times:
fixkit x 1
fixkit x 1
in the bag. if i take out one of them both are deleted from the DB.
if you want here is the fix:
RegisterServerEvent('esx-kr-bag:PutItem')
AddEventHandler('esx-kr-bag:PutItem', function(id, item, label, count, type)
local src = source
local xPlayer = ESX.GetPlayerFromId(src)
local update
local insert
if type == 'weapon' then
xPlayer.removeWeapon(item, count)
MySQL.Async.execute('INSERT INTO owned_bag_inventory (id, label, item, count) VALUES (@id, @label, @item, @count)', {['@id'] = id,['@item'] = item, ['@label'] = label, ['@count'] = count})
elseif type == 'item' then
xPlayer.removeInventoryItem(item, count)
MySQL.Async.fetchAll('SELECT * FROM owned_bag_inventory WHERE id = @id ',{["@id"] = id}, function(result)
if result[1] ~= nil then
for i=1, #result, 1 do
if result[i].item == item then
count = count + result[i].count
update = 1
elseif result[i].item ~= item then
insert = 1
end
end
if update == 1 then
MySQL.Async.execute('UPDATE owned_bag_inventory SET count = @count WHERE item = @item', {['@item'] = item, ['@count'] = count})
elseif insert == 1 then
MySQL.Async.execute('INSERT INTO owned_bag_inventory (id, label, item, count) VALUES (@id, @label, @item, @count)', {['@id'] = id,['@item'] = item, ['@label'] = label, ['@count'] = count})
end
else
MySQL.Async.execute('INSERT INTO owned_bag_inventory (id, label, item, count) VALUES (@id, @label, @item, @count)', {['@id'] = id,['@item'] = item, ['@label'] = label, ['@count'] = count})
end
end)
end
end)
Sounds weird, well it works for all the others. Are you sure you’ve inserted the new sql? Any errors?
Thanks for making my life easier
is this normal? https://i.imgur.com/PayFX5v.png
do you edited something ?
nothing, just installed this ressource witheout modification x)
Give me your discord please
I have the data in mysql showing but I can not access any menus to do with the bag at all, I use the bag and nothing changes
the fix for it is in line 125:
end
but it should looks like:
end
end)
Heady forgot a end) fixed now anyway
Client or Server In Client This is my line 125-134
RegisterNetEvent('esx-kr-bag:ReSync')
AddEventHandler('esx-kr-bag:ReSync', function(id)
Bags = {}
ESX.TriggerServerCallback('esx-kr-bag:getAllBags', function(bags)
for i=1, #bags, 1 do
table.insert(Bags, {id = {coords = {x = bags[i].x, y = bags[i].y, z = bags[i].z}, id = bags[i].id}})
end
end)
end)
MY SERVER
RegisterServerEvent('esx-kr-bag:DropBag')
AddEventHandler('esx-kr-bag:DropBag', function(id, x, y, z)
local src = source
local identifier = ESX.GetPlayerFromId(src).identifier
Edited Ill Reinstall and see if new version works
But have you used the item?
it already have it, https://i.imgur.com/ApOxajP.png
and i got another error when i’m loggin to my server https://i.imgur.com/rS2XsMW.png
Try reinstall, it should work. Seems like it can’t find my cb which it should.
you should put the code from AddEventHandler(‘playerspawned’)
inside of AddEventHandler(‘esx:playerLoaded’)
Because if you get revived (e.g. with the admin command revive) you can pick up the bag but the model is still there.