if (strcmp("/armour (playerid)", cmdtext, true, 7) == 0) // Change "/armour" to whatever you want to e.g "/a" (a for armour) { if(IsPlayerAdmin(playerid)) // This checks if the player is logged on Rcon. { SetPlayerArmour(playerid, 100); // This sets the armour of the player to 100. SendClientMessage(playerid,COLOUR_RED,"You gave armour to %s!"); // This sends the msg "You gave armour to [name of the player]" change it to what you want it to say. This will only be seen by you SendPlayerMessageToPlayer(playerid, COLOUR_YELLOW,"%s gave you armour!"); // This will send a msg to the player and inform him/her that you gave him/her armour. You can change the text. (only Him/her will see it) return 1; } }
if (strcmp("/armour (playerid)", cmdtext, true, 7) == 0)
{
if(IsPlayerAdmin(playerid))
{
SetPlayerArmour(playerid, 100);
SendClientMessage(playerid,COLOUR_RED,"You gave armour to %s!");
SendPlayerMessageToPlayer(playerid, COLOUR_YELLOW,"%s gave you armour!"); // I dont know what this does, but I think it won't show a name because you didn't get a name, you just put %s
}
return 1;
}
Originally Posted by [GTA
Deadly_Evil ]
Naxix why you put %s when there is no format at all ![]() and what is this command?? /armour (playerid) LOL ![]() |
Originally Posted by LowCo.
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;
}