I had originally tried es_admin2 but was getting that error. If you do it the other way i posted above either in es_admin2 or another resource it always threw en error in chat when doing the command id message. But so far from what i was able to get work was
TriggerEvent('es:addGroupCommand', 'reply', 'mod', function(source, args, user)
if args[1] then
if(GetPlayerName(tonumber(args[1])))then
local player = tonumber(args[1])
table.remove(args, 1)
TriggerEvent("es:getPlayerFromId", player, function(target)
TriggerClientEvent('chatMessage', player, "[STAFF PM]", {255, 0, 0}, "^2 From ^5"..GetPlayerName(source).. " [" .. source .. "]: ^7" ..table.concat(args, " "))
TriggerClientEvent('chatMessage', source, "[STAFF PM]", {255, 0, 0}, "^3 Sent to ^5"..GetPlayerName(player).. ": ^7" ..table.concat(args, " "))
end)
else
TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Player not online.")
end
else
TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Incorrect syntax! You must provide a valid player ID")
end
end, function(source, args, user)
TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficienct permissions!")
end, {help = "Staff Private Message", params = {{name = "id", help = "The ID of the player"}, {name = "message", help = "Message."}}})
But i will need to do more testing to make sure it all works like it should. But i have tested the code with just myself and it works & only a mod & up can use it.