Hello There, Guest! Login or Register


Useful Functions/Snippets/Commands
#7
this section is nice  :)

Errr... i have a problem idk how 2 send a pm to a player from rcon. this is the code for that:
Code:
public OnRconCommand(cmd[])
{
    if (strlen(cmd) > 50){
        print("Invalid command length (exceeding 50 characters)");
            return true;
    }

    if(!strcmp(cmd, "pm", .length = 2)){
        new arg_1 = argpos(cmd),
             arg_2 = argpos(cmd, arg_1),
              targetid = strval(cmd[arg_1]),
               message[128];
            if ( !cmd[arg_1] || cmd[arg_1] < '0' || cmd[arg_1] > '9' || targetid > max_playerid || targetid < 0 || !cmd[arg_2])
                printf("Usage: \"pm <playerid(0-%d)> <message>\"",max_playerid);
               else if ( !IsPlayerConnected(targetid) )
            print("This player is not connected!");
            else{
                format(message, sizeof(message), "[RCON] PM from an admin: %s", cmd[arg_2]);
                SendClientMessage(targetid, 0xFFFFFFFF, message);
            }
        return true;
        }
    return 0;
}

it may be a small error
Reply


Messages In This Thread
Useful Functions/Snippets/Commands - by Jay - 04-21-2008, 03:19 PM
Re: Useful Functions/Snippets/Commands - by Jay - 04-21-2008, 07:42 PM
Re: Useful Functions/Snippets/Commands - by Smoke - 04-23-2008, 06:50 AM
Re: Useful Functions/Snippets/Commands - by Jay - 04-23-2008, 04:54 PM
Re: Useful Functions/Snippets/Commands - by Motorola - 04-24-2008, 12:13 AM
Re: Useful Functions/Snippets/Commands - by Smoke - 04-24-2008, 10:18 AM
Re: Useful Functions/Snippets/Commands - by Jay - 04-29-2008, 01:03 PM
Re: Useful Functions/Snippets/Commands - by Jay - 05-08-2008, 11:54 AM
Re: Useful Functions/Snippets/Commands - by Jay - 02-02-2009, 10:17 PM