I’m having trouble registering a simple command in lua
I always get this error in console:
SCRIPT ERROR: citizen:/scripting/lua/scheduler.lua:805: bad argument #1 to ‘unpack’ (table expected, got nil)
RegisterCommand("pm", function(source, args, raw)
if source ~= 0 then
if args[1] == nil or args[2] == nil then
TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'inform', text = '/pm [playerID] [message]' })
else
local target = tonumber(args[1])
if target and target > 0 then
local targetname = GetPlayerName(target)
local adminname = GetPlayerName(source)
local txtmsg = table.concat(args, " ",2)
TriggerClientEvent('textmsg', target, source, txtmsg, targetname, adminname)
TriggerClientEvent('textsent', source, target, targetname)
end
end
end
end)
I’m not sure what I’m doing wrong here but this is getting very weird because no matter what I change the same error shows up