You would need to use a variable for each job in my example ill use one (police).
At the top of your code but underneath your includes and defines make the variables.
pawn Код:
new ispolice[MAX_PLAYERS];
Then you need to go where you give the player a job and assign the players slot to 1 like this
Now inside any command you can do the following.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
if(!ispolice[playerid]))return SendClientMessage(playerid, 0xff0000FF, "ERROR: You are not in the police force");//if police[playerid] has no value, send error message
return 1;
}
return 0;
}
The important thing is make sure this is at the top of your command. It will prevent a player using the command by returning an error message.
pawn Код:
if(!ispolice[playerid]))return SendClientMessage(playerid, 0xff0000FF, "ERROR: You are not in the police force");
I hope this is clear enough for you if not at least i tried seems like you need to read some more tutorials as stated above.