Hello everyone, I wanted to rewrite the following lines so that only police officers can use this command:
Then tried it like this:
But that didn’t quite work, does anyone have an idea how I can fix this? Only people with the police job should be able to use the command. Also, it was originally an admin command. I use esx framework and the script is a jail system.
do you want cops that are admins to use it or all cops?
I want that all cops can use this command
Hey 
Apparently you were on the right track the issue here is that the ‘xPlayer’ need to be recovered from the ‘source’ before you try to get one of his attributes. Keep what you did but do the following :
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer.getJob().name == 'police' then
if args[1] and GetPlayerName(args[1]) ~= nil and tonumber(args[2]) then
else
end
end, .......
I just modified the part you need (I’m letting you insert it into the code you already add).
1 Like
Thank you, i will try it tomorrow!