Rcon commands crash
#9

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;
}
Reply


Messages In This Thread
Rcon commands crash - by Naxix - 06.03.2010, 09:01
Re: Rcon commands crash - by dice7 - 06.03.2010, 09:23
Re: Rcon commands crash - by Naxix - 06.03.2010, 09:35
Re: Rcon commands crash - by Rzzr - 06.03.2010, 09:38
Re: Rcon commands crash - by [WSM]Deadly_Evil - 06.03.2010, 09:40
Re: Rcon commands crash - by Naxix - 06.03.2010, 09:45
Re: Rcon commands crash - by Naxix - 06.03.2010, 09:47
Re: Rcon commands crash - by Rzzr - 06.03.2010, 09:50
Re: Rcon commands crash - by dice7 - 06.03.2010, 09:54
Re: Rcon commands crash - by Naxix - 06.03.2010, 09:59

Forum Jump:


Users browsing this thread: 1 Guest(s)