UC cmd
#4

Do you want create commands with Parameters?
It's simple, if you use sscanf.
pawn Код:
CMD:akill(playerid,params[])
{
    new id; // We create a variable, to save target players ID.
    // Player has used the command /akill, but without params.
    if(sscanf(params, "u", id)) return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /akill (playerid)");
    // We check is the target player connected or not.
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "Player is not connected.");
    SetPlayerHealth(id, 0);
    return 1;
}
Here's an example again, but now with string and without sscanf.
pawn Код:
CMD:announce(playerid, params[])
{
    if(!strlen(params)) return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /announce (text)");
    GameTextForAll(params, 4000, 3);
    return 1;
}
Reply


Messages In This Thread
UC cmd - by Tamer - 23.11.2012, 18:39
Re: UC cmd - by YoYo123 - 23.11.2012, 18:46
Re: UC cmd - by Tamer - 24.11.2012, 19:17
AW: UC cmd - by Skimmer - 24.11.2012, 19:55

Forum Jump:


Users browsing this thread: 1 Guest(s)