Its an amazing resource dude! the only issue im currenty having is with addon_account giving a duplicate error I tried someones datastore fix in the same fashion but it didnt work
Same here
[31m[ERROR] [MySQL] [esx_addonaccount] An error happens on MySQL for query "INSERT INTO addon_account_data (account_name, money, owner) VALUES ('bank_savings', 0, 'steam:')": ER_DUP_ENTRY: Duplicate entry 'bank_savings-steam:' for key 'index_addon_account_data_account_name_owner'[0m
[31m[ERROR] [MySQL] [esx_addonaccount] An error happens on MySQL for query "INSERT INTO addon_account_data (account_name, money, owner) VALUES ('caution', 0, 'steam:')": ER_DUP_ENTRY: Duplicate entry 'caution-steam:' for key 'index_addon_account_data_account_name_owner'[0m
[31m[ERROR] [MySQL] [esx_addonaccount] An error happens on MySQL for query "INSERT INTO addon_account_data (account_name, money, owner) VALUES ('motels_black_money', 0, 'steam:')": ER_DUP_ENTRY: Duplicate entry 'motels_black_money-steam:' for key 'index_addon_account_data_account_name_owner'[0m
[31m[ERROR] [MySQL] [esx_addonaccount] An error happens on MySQL for query "INSERT INTO addon_account_data (account_name, money, owner) VALUES ('motels_bed_black_money', 0, 'steam:')": ER_DUP_ENTRY: Duplicate entry 'motels_bed_black_money-steam:' for key 'index_addon_account_data_account_name_owner'[0m
[31m[ERROR] [MySQL] [esx_addonaccount] An error happens on MySQL for query "INSERT INTO addon_account_data (account_name, money, owner) VALUES ('property_black_money', 0, 'steam:')": ER_DUP_ENTRY: Duplicate entry 'property_black_money-steam:' for key 'index_addon_account_data_account_name_owner'[0m
Can we confirm this works?
I’m having issues where the apartment inventory is still sharing items and dirty money. However weapons are not being shared between characters. I have bread, $1 dirty money, and a knife on a character, on the other character, it shows the $1 dirty money, and the bread, but not the knife… Any ideas on fixing it to where items and dirty money aren’t shared? this is my identifiers I have setup at the moment.
local IdentifierTables = {
{table = "users", column = "identifier"},
{table = "characters", column = "identifier"},
{table = "owned_vehicles", column = "owner"},
{table = "datastore_data", column = "owner"},
{table = "user_accounts", column = "identifier"},
{table = "addon_account_data", column = "owner"},
{table = "billing", column = "identifier"},
{table = "owned_properties", column = "owner"},
{table = "phone_users_contacts", column = "identifier"},
{table = "addon_inventory_items", column = "owner"},
{table = "user_inventory", column = "identifier"},
{table = "playersTattoos", column = "identifier"},
{table = "user_inventory", column = "identifier"},
}
Same problem for a month now… Changing Characters causes the inventory to show from old characters and then going back to the previous character the inventory will not show up until the server is restarted.
This is a known issue with add on account data, and by the looks of it there still isn’t a fix
I searching for a script there do so i can say a specific user can have 2 character’s can i do so only specific user can make 2 characters here?
Hello, I wanted to know, is there a way to “unload” a character to change it via an order? I’ve already made an order to go back to the menu and change it but I keep the same character
all works fine , 0 errors. server/client side really 0 errors…
done it step by step… when someone dies he re-spawn with the starting skater ped standing but death timer and thing is counting normal , after that… if he bleeds out or getting revive he still skater ped…
any one had that issue?
hey can some one help me when the person got killed his character dont respawn it is than this person
To fix the inventory sharing across all created characters in properties do the following.
in your esx_addoninventory go to server/main.lua
Find:
AddEventHandler('esx:playerLoaded', function(playerId, xPlayer)
local addonInventories = {}
for i=1, #InventoriesIndex, 1 do
local name = InventoriesIndex[i]
local inventory = GetInventory(name, xPlayer.identifier)
if inventory == nil then
inventory = CreateAddonInventory(name, xPlayer.identifier, {})
table.insert(Inventories[name], inventory)
end
table.insert(addonInventories, inventory)
end
xPlayer.set('addonInventories', addonInventories)
end)
And replace it with:
AddEventHandler('esx:playerLoaded', function(playerId, xPlayer)
local items = MySQL.Sync.fetchAll('SELECT * FROM items')
for i=1, #items, 1 do
Items[items[i].name] = items[i].label
end
local result = MySQL.Sync.fetchAll('SELECT * FROM addon_inventory')
for i=1, #result, 1 do
local name = result[i].name
local label = result[i].label
local shared = result[i].shared
local result2 = MySQL.Sync.fetchAll('SELECT * FROM addon_inventory_items WHERE inventory_name = @inventory_name', {
['@inventory_name'] = name
})
if shared == 0 then
table.insert(InventoriesIndex, name)
Inventories[name] = {}
local items = {}
for j=1, #result2, 1 do
local itemName = result2[j].name
local itemCount = result2[j].count
local itemOwner = result2[j].owner
if items[itemOwner] == nil then
items[itemOwner] = {}
end
table.insert(items[itemOwner], {
name = itemName,
count = itemCount,
label = Items[itemName]
})
end
for k,v in pairs(items) do
local addonInventory = CreateAddonInventory(name, k, v)
table.insert(Inventories[name], addonInventory)
end
end
end
local addonInventories = {}
for i=1, #InventoriesIndex, 1 do
local name = InventoriesIndex[i]
local inventory = GetInventory(name, xPlayer.identifier)
if inventory == nil then
inventory = CreateAddonInventory(name, xPlayer.identifier, {})
table.insert(Inventories[name], inventory)
end
table.insert(addonInventories, inventory)
end
xPlayer.set('addonInventories', addonInventories)
end)
Sorry for the delay in responding. From what I saw you were able to use the code.
So i have installed this resource but i have an issue with property dirty money which is kind of game breaking since players can duplicate dirty money by switching characters. i fixed the item and clothes in the property by using code fixes that people have put in this thread but i can’t find a fix for dirty money so if anyone can post a fix i would greatly appreciate it.
@Rhodiniium good dude nice one with helping on this but i gave up with this resource as caused nothing but problems lol
the buggs i got is like when i have animation like favorite the it getting like that stuck at the meny but if i go in to sql and remove the animation it can work for some days then i need to remove them again ?
second is why is it swapin all cloth and drop items in mottel or inventory when i swap char ?
if anny have anny clue pls pm me
What kind of problems you facing?
find a fix with the gps?
im having like if i make one a second char it takes cloths frome the first one and the inventory and stuff dissepear frome the wardrobe and stuff like i have try to fix it but when it comes to that i dont know wher to start like for a exampel they have name like char1 and char2 but char one can have clothe frome char 2 and if i log in to char 2 all the cloth is gone
You have a soloution for esx_addonaccount aswell?
addon account Fix for separate black money between characters in storages
Replace original with this
AddEventHandler('esx:playerLoaded', function(source)
local result = MySQL.Sync.fetchAll('SELECT * FROM addon_account')
for i=1, #result, 1 do
local name = result[i].name
local label = result[i].label
local shared = result[i].shared
local result2 = MySQL.Sync.fetchAll('SELECT * FROM addon_account_data WHERE account_name = @account_name', {
['@account_name'] = name
})
if shared == 0 then
table.insert(AccountsIndex, name)
Accounts[name] = {}
for j=1, #result2, 1 do
local addonAccount = CreateAddonAccount(name, result2[j].owner, result2[j].money)
table.insert(Accounts[name], addonAccount)
end
end
end
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local addonAccounts = {}
for i=1, #AccountsIndex, 1 do
local name = AccountsIndex[i]
local account = GetAccount(name, xPlayer.identifier)
if account == nil then
MySQL.Async.execute('INSERT INTO addon_account_data (account_name, money, owner) VALUES (@account_name, @money, @owner)', {
['@account_name'] = name,
['@money'] = 0,
['@owner'] = xPlayer.identifier
})
account = CreateAddonAccount(name, xPlayer.identifier, 0)
table.insert(Accounts[name], account)
end
table.insert(addonAccounts, account)
end
xPlayer.set('addonAccounts', addonAccounts)
end)