Closed rdephillip closed 4 years ago
So far I have written in code to remove the glasses and add them back that is aligned with the shoes code. It isn't necessarily using the accessories script but this script on purchase or item toggle is feeding esx_datastore a nil value. I will continue to debug and work to identify and resolve the issue I'm seeing.
This comes for all accessories for me. When trying to /glasses /mask, etc..
This for /mask
This for glasses First error before purchase, second after purchase and both times using /glasses
So esx_newaccessories throws error here:
ESX.RegisterServerCallback('esx_newaccessories:get', function(source, cb, accessory)
local xPlayer = ESX.GetPlayerFromId(source)
TriggerEvent('esx_datastore:getDataStore', 'user_' .. string.lower(accessory), xPlayer.identifier, function(store)
local hasAccessory = (store.get('has' .. accessory) and store.get('has' .. accessory) or false)
local skin = (store.get('skin') and store.get('skin') or {})
cb(hasAccessory, skin)
end)
end)
Says this line
TriggerEvent('esx_datastore:getDataStore', 'user_' .. string.lower(accessory), xPlayer.identifier, function(store)
and xPlayer returns but xPlayer.identifier returns a correct gta license, so probably issue is not here...
....
Just noticed that when u buy glasses it throws error
Which also returns correct identifier.. Then what's wrong...?
TriggerEvent('esx_datastore:getDataStore', 'user_' .. string.lower(accessory), xPlayer.identifier, function(store)
Ok so this ^ have these returns
print(xPlayer.identifier) = correct print(userglasses) = nil print(user) = nil print(accessory) = Glasses
Someone teach me how to troubleshoot, lol. So since there was 2 nil, i went checking my database, i found that there is nothing in 'datastore' declared, i added user_glasses, how the hell i could miss this, lol, now this: Which is obviously this
local hasAccessory = (store.get('has' .. accessory) and store.get('has' .. accessory) or false)
Who the hell is 'store'???
RIP
@XvenDeR I apologize for not interacting while you troubleshot this. I was assigned to move on to more important scripts on the server and then eventually tasked to developing a custom server management discord bot.
What was missing here? The store table? or is it misnamed?.... is store supposed to be datastore?
@XvenDeR I apologize for not interacting while you troubleshot this. I was assigned to move on to more important scripts on the server and then eventually tasked to developing a custom server management discord bot.
What was missing here? The store table? or is it misnamed?.... is store supposed to be datastore?
probably just forgot to import database, since im working on few servers and most of them already had imported basic sqls, so probably just sql import was missing at my case at that time.
I suspect this servers original dev effed up the code. I actually deleted the mod and freshly downloaded and setup the mod and it works out of the box fine now.
I just wanted to make certain there wasn't something else. Thank you @XvenDeR
Purchasing glasses returns a nil error in the console.
The K Menu and /glasses also returns a nil value.
It seems like the script is not passing the data to the datastore properly hence causing issues.
I am working on a copy to fix this for our server, and reported this on FiveM forums. Any news on how to fix this will be helpful.