[HELP] How can i set a command for a specific job only?

Im using esx_rpchat and have a /pd , /ems, /mech commands how can i set them to their specific jobs…
I read all threads but none of them got any solution

Ill attach an example how i did it

RegisterCommand("NAMEOFCOMMAND", function()
    if ESX.PlayerData.job and ESX.PlayerData.job.name == 'police' then
       
     (Your code here)

    end
end)

So pretty much add the if statement and another end at the bottom of the code

the registercommand of esx_rpchat is on the server.lua and i get an error attempt to index a nil value (field’PlayerData’)

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.