GithubHelp home page GithubHelp logo

Comments (4)

KlibrDM avatar KlibrDM commented on August 10, 2024

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?

from esx_treasure.

kevintransp avatar kevintransp commented on August 10, 2024

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)

from esx_treasure.

kevintransp avatar kevintransp commented on August 10, 2024

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.

from esx_treasure.

raminhos avatar raminhos commented on August 10, 2024

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

from esx_treasure.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.