Command help
#3

Just one single variable is enough and makes easier. Also the variable must be global variable inorder to apply it for players. Here's a small example:
pawn Код:
new pRank[MAX_PLAYERS]; //Create a global variable to apply the ranks for players.

CMD:setrank(playerid, params[])
{
 if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You must login as RCON to use this command.");
 new p2;
 new rank;
 if(sscanf(params, "ui", p2, rank)) return SendClientMessage(playerid, 0xFF0000, "Usage: /setrank [playerid] [rank]");
 if(p2 == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000FF, "This player ID is invalid.");
 if(rank > 1 || rank > 4) return SendClientMessage(playerid, 0xFF0000FF, "Invalid rank. Avalaible 0-4.");
 pRank[p2] = rank; //Sets the rank!
 return 1;
}

CMD:examplecmd(playerid, params[])
{
 if(pRank[playerid] == 1) //If player is rank 1.
 {
   //
 }
 return 1;
}
Edit:late.
Reply


Messages In This Thread
Command help - by Lz - 09.12.2012, 09:57
Re: Command help - by Konstantinos - 09.12.2012, 10:10
Re: Command help - by Lordzy - 09.12.2012, 10:13
Re: Command help - by Lz - 09.12.2012, 10:42
Re: Command help - by Konstantinos - 09.12.2012, 10:45
Re: Command help - by Lz - 09.12.2012, 10:48
Re: Command help - by Konstantinos - 09.12.2012, 10:56

Forum Jump:


Users browsing this thread: 1 Guest(s)