Open jesse-vdn opened 4 years ago
Hey, it's been almost 2 years since I made this and I've been out of FiveM for quite some time now so I can't remember exactly every detail of the script. What I understand is that a person can open the same treasure box multiple times? Can you please explain step by step what is happening? Do you get any errors in the server console or in F8 console?
Good day,
I get this error about field Pos.
MainThrd/ Creating script environments for esx_treasure [ 855328] [ GTAProcess] MainThrd/ ^1SCRIPT ERROR: @esx_treasure/client/main.lua:144: attempt to index a nil value (field 'Pos')^7 [ 856172] [ GTAProcess] MainThrd/ ^1SCRIPT ERROR: @esx_treasure/client/main.lua:51: attempt to index a nil value (field 'Pos')^7 [ 856172] [ GTAProcess] MainThrd/ ^3> ref^7 (^5@esx_treasure/client/main.lua^7:51) [ 856172] [ GTAProcess] MainThrd/ ^3> handler^7 (^5@es_extended/client/functions.lua^7:1314)
That error become tru live restart of the resource i guess. For now, only 1 entry is made in the database but stil can open the same again and again end get money everytime.
No errors vissible.
That error become tru live restart of the resource i guess. For now, only 1 entry is made in the database but stil can open the same again and again end get money everytime.
No errors vissible.
Hi, just place the checkcheck call after the insert so it looks like:
RegisterServerEvent('esx_treasure:found') AddEventHandler('esx_treasure:found', function(name) local _source = source local xPlayer = ESX.GetPlayerFromId(_source) local identifier = xPlayer.getIdentifier() local playerName = xPlayer.getName()
print(name)
--Insert the player and the name of the found crate into the database --To make sure that the player can't open it again MySQL.Async.execute( 'INSERT INTO treasure (identifier, treasurename) VALUES (@identifier, @name)', { ['@identifier'] = identifier, ['@name'] = name, } )
if Config.OnePersonOpen then TriggerClientEvent('esx_treasure:checkcheck', -1) --Check for everybody else TriggerClientEvent('esx_treasure:checkcheck', source) --Check for source end .. .. ..
Added esx_treasure to esx. Has es_extended installed. However when I set the settings so players can only loot once per person it doesn't work. The database keeps writing my identifier in the treasure table, seems like the check doesn't work for me. Is that a problem just with me or a bug in the resource?
If it's only for me, any suggestions why this is happening?