Hello, I have this code where I am trying to print on chat a list of all online staff members:
RegisterCommand('staff', function(source)
local catistaff = 0
local staff = vRP.getOnlineAdmins{};
for k,v in pairs(staff) do
local player = vRP.getUserSource{v}
local name = GetPlayerName(player) or "Unknown"
if name ~= "Unknown" then
TriggerClientEvent('chatMessage', player, '^5' .. name .. ' ^0(^5' .. v .. '^0) -> ^1' .. vRP.getUserAdminTitle{v})
catistaff = catistaff +1
end
end
TriggerClientEvent('chatMessage', source, 'Staff Online: ^1' .. catistaff)
end)
When I use the command [/staff] in game I get this error:
[ c-scripting-core] InvokeNative: execution failed: Argument at index 1 was null.
[ script:vrp] SCRIPT ERROR: Execution of native 000000002f7a49e6 in script host failed: Argument at index 1 was null.
[ script:vrp] > [global chunk] (TriggerClientEventInternal.lua:3)
[ script:vrp] > sendStaffMessage (@vrp/modules/admin.lua:411)
[ script:vrp] > callback (@vrp/modules/admin.lua:317)
[ script:vrp] > handler (vrp-lib/Tunnel.lua:139)
[ script:vrp] null