Can someone help me? I’m trying to write a framework for FiveM, and I have this function, yet when I call it it says "attempt to call a nil value (field “AddCommand”). I have referenced the lua in the shared folder and the shared folder is higher than the rest in the fxmanifest, so what am I doing wrong?
function LBCore.Functions.AddCommand(command, callback, suggestion, args)
RegisterCommand(command, function ()
-- If there are suggestions, then add them
if suggestion then
TriggerEvent('chat:addSuggestion', {
commandName = "/" ..command,
commandDescription = "/" .. command .. ": Hello",
{
name = "paramName1", help = "Param Description 1"
}
})
end
end)
end
LBCore = {}
LBCore.Functions = {}
LBShared = {}
1 Like
Hello, @Timothy_Sharp. To fix this error, please provide more context such as to where you are calling it from, what file name is such as (client.lua or server.lua). Please provide screenshots or some more errors that can be used to help me solve this.
I have made my functions like this, under the client folder in a file called functions.lua. I am calling it from client/main
Try passing thru the required args like so:
print('running')
LBCore.Functions:AddCommand("test", callback, "a command!", args)
Nope, I did and it still says the same thing
If it helps, I can’t call the function on the server side OR the client side. I don’t know what tf is going on
I can test when I wake up, it’s late in my area. I’ll help you tomorrow asap, lmk if you need some devs to help you I’m gladly available
I can’t pay you, don’t worry about it. Just the help on here will be fine
So I am dumb and I did not know that the only way to call functions through server-side from client-side is triggering events. It’s all fixed now!
Okay, you dont need to pay me for anything if you dont want to, im here for support and development!
Ah, okay, all good! I didn’t know you were calling it from client. Have fun developing!
Just for the record, it’s not “don’t want to” it’s “cant” I’m disabled you see and on a fixed income per month
2 Likes
Having the same error but with GetJobName when i try acces ambulance/police job stores any help would be top class