Help with an error

Error running system event handling function for resource essentialmode: citizen:/scripting/lua/scheduler.lua:41: Failed to execute thread: citizen:/scripting/lua/scheduler.lua:364: Cannot index a funcref
stack traceback:
        [C]: in function 'error'
        citizen:/scripting/lua/scheduler.lua:364: in metamethod '__index'
        server/main.lua:147: in function 'addCommand'
        server/main.lua:157: in upvalue 'handler'
        citizen:/scripting/lua/scheduler.lua:163: in function <citizen:/scripting/lua/scheduler.lua:162>
stack traceback:
        [C]: in function 'error'
        citizen:/scripting/lua/scheduler.lua:41: in field 'CreateThreadNow'
        citizen:/scripting/lua/scheduler.lua:162: in function <citizen:/scripting/lua/scheduler.lua:131>
Error running system event handling function for resource essentialmode: citizen:/scripting/lua/scheduler.lua:41: Failed to execute thread: citizen:/scripting/lua/scheduler.lua:364: Cannot index a funcref
stack traceback:
        [C]: in function 'error'
        citizen:/scripting/lua/scheduler.lua:364: in metamethod '__index'
        server/main.lua:147: in function 'addCommand'
        server/main.lua:157: in upvalue 'handler'
        citizen:/scripting/lua/scheduler.lua:163: in function <citizen:/scripting/lua/scheduler.lua:162>
stack traceback:
        [C]: in function 'error'
        citizen:/scripting/lua/scheduler.lua:41: in field 'CreateThreadNow'
        citizen:/scripting/lua/scheduler.lua:162: in function <citizen:/scripting/lua/scheduler.lua:131>
Started resource commands
Started resource HospitalHeal
Started resource drunk
Argument count mismatch (passed 2, wanted 1)
cfx> Resolved live-internal.fivem.net:30110 to 151.80.44.223:30110
Sending heartbeat to live-internal.fivem.net:30110
-------------------------------------------------------------
--- No errors detected, essentialmode is setup properly. ---
-------------------------------------------------------------
Started resource fivem-map-hipster
Started map fivem-map-hipster

Current version: 4.6.3
Updater version: 4.6.3

Everything is fine!
1 Like

What is the code on line 147 and 157 in server/main.lua?

Here is line 147 thru 158

if not suggestion.params or not type(suggestion.params) == "table" then suggestion.params = {} end
	if not suggestion.help or not type(suggestion.help) == "string" then suggestion.help = "" end

	commandSuggestions[command] = suggestion
end

debugMsg("Command added: " .. command)

end

AddEventHandler(‘es:addCommand’, function(command, callback, suggestion)
addCommand(command, callback, suggestion)
end)

It looks like a command that is being registered has some invalid arguments… So could be pretty much any command :confused:

That sounds terrible Syntasu. Thank you for taking a peek. What is this schedule.lua file i keep seeing in the errors. I feel like that could be the issue?

Connecting: SLuG
Error running system event handling function for resource vrp: citizen:/scripting/lua/scheduler.lua:41: Failed to execute thread: base.lua:386: attempt to concatenate a nil value (local ‘ep’)
stack traceback:
base.lua:386: in upvalue ‘callback’
lib/utils.lua:43: in upvalue ‘finish’
lib/utils.lua:47: in upvalue ‘task’
base.lua:202: in local ‘cb’
[string “-- begin MySQL module…”]:40: in upvalue ‘handler’
citizen:/scripting/lua/scheduler.lua:163: in function citizen:/scripting/lua/scheduler.lua:162
stack traceback:
[C]: in function ‘error’
citizen:/scripting/lua/scheduler.lua:41: in field ‘CreateThreadNow’
citizen:/scripting/lua/scheduler.lua:162: in function citizen:/scripting/lua/scheduler.lua:131

The scheduler is basically a wrapper for running your code on a “fake” thread. It creates a so called coroutine, which acts like a thread but does not execute in parrallel, it will tell other coroutine to run it’s code when it’s done or gets the yield instruction. Technical story :’)

Also fix this:

base.lua:386: attempt to concatenate a nil value (local ‘ep’)

variable ep is null and you try to append it to an string.

What exactly do I need to fix. Sorry

Share the code please

You just need the code for base.lua ?

No just the code from line 386 in base.lua.

386: local last_login_stamp = ep…" “…os.date(”%H:%M:%S %d/%m/%Y")

ep has no value… I don’t know where this variables gets assigned, but it appears to be empty (nil)

hmm… I dont see this error thrown all the time only sometimes and random players causing them to lose all their money.

Investigate what exactly the ep variable is. Usually ep stands for endpoint and is related to the connection of the player. So some how those players don’t have an endpoint (which is unlikely?).

Sometimes they receive handshake error when loading in but not always. When they receive the handshake error and then load in a second time wallet and bank are gone.

Im assuming this is what the EP is

– GetPlayerEP does not handle NetIDs, only PlayerIDs. Server LUA does not have Citizen.CreateThread nor Wait
– so we use this method to periodically check NetIDs converted to PlayerIDs (NetID & 0xFFFF + 1).
– Usually triggered when the PlayerID is actually added to the server ~600ms after connecting.

hey guys whenever i start es admin2 plugin it say Argument count mismatch (passed 2, wanted 1) and same with es extended and policejob plz help me