GMA950 / esx_newaccessories

an edit of esx_accessories for my esx_np_skinshop
GNU General Public License v3.0
17 stars 18 forks source link

Glasses Problems #3

Closed rdephillip closed 4 years ago

rdephillip commented 4 years ago

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.

rdephillip commented 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.

iSentrie commented 4 years ago

image This comes for all accessories for me. When trying to /glasses /mask, etc..

This for /mask image

This for glasses image First error before purchase, second after purchase and both times using /glasses

iSentrie commented 4 years ago

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 image but xPlayer.identifier returns a correct gta license, so probably issue is not here...

....

Just noticed that when u buy glasses it throws error image

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: image Which is obviously this

local hasAccessory = (store.get('has' .. accessory) and store.get('has' .. accessory) or false)

Who the hell is 'store'???

Ok done looks like it's fixed. Was missing DB, oh my....

RIP

rdephillip commented 4 years ago

@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?

iSentrie commented 4 years ago

@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.

rdephillip commented 4 years ago

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