Please help with making jobs
#7

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
pawn Код:
ispolice[playerid] = 1;
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.
Reply


Messages In This Thread
Please help with making jobs - by Gavin - 24.11.2010, 08:27
Re: Please help with making jobs - by Leeroy. - 24.11.2010, 08:30
Re: Please help with making jobs - by Gavin - 24.11.2010, 09:18
Re: Please help with making jobs - by Gavin - 24.11.2010, 09:42
Re: Please help with making jobs - by <Weponz> - 24.11.2010, 09:47
Re: Please help with making jobs - by Gavin - 24.11.2010, 09:56
Re: Please help with making jobs - by iggy1 - 24.11.2010, 10:12
Re: Please help with making jobs - by Gavin - 24.11.2010, 10:17
Re: Please help with making jobs - by iggy1 - 24.11.2010, 10:20
Re: Please help with making jobs - by Gavin - 24.11.2010, 10:59

Forum Jump:


Users browsing this thread: 1 Guest(s)