06.03.2010, 09:54
your code still wont work
pawn Код:
if (strcmp("/armour [id]", cmdtext, true, 8) == 0) // to compare the first 8 characters
{
if(IsPlayerAdmin(playerid)) //if the player who typed the cmd is an rcon admin
{
new id = strval(cmdtext[8]); //the 'id' which the player typed starts at the 8th index in "cmdtext"
if(IsPlayerConnected(id)) //to check if the player is even connected
{
SetPlayerArmour(id, 100); //give armour
new name[MAX_PLAYER_NAME];
GetPlayerName(id, name, MAX_PLAYER_NAME); //getting the name of the player which got the armour
new str[128]; //the string which will be sent
format(str, 128, "You gave armour to %s !", name); //formating it
SendClientMessage(playerid, COLOUR_RED, str); //sending it
GetPlayerName(playerid, name, MAX_PLAYER_NAME); //reusing the array 'name' to store the players name who typed the cmd
format(str, 128, "%s gave you armour !", name); //formating the msg
SendClientMessage(playerid, COLOUR_RED, str); //sending it
return 1; //ending the code so the code below doesn't get executed
}
SendClientMessage(playerid, COLOUR_RED, "No player found"); //player isn't connected
return 1;
}
SendClientMessage(playerid, COLOUR_RED, "You need to be an rcon admin to use this cmd");
return 1;
}