Help pl0x
#1

Here is a fast command i made...

v
pawn Код:
COMMAND:kick(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) SendClientMessage(playerid, COLOR_ERROR, "You are not autorized to use this command.");
    {
        new targetid, reason[128], string[128];
        if(sscanf(params, "ds[128]", targetid, reason)) return SendClientMessage(playerid, COLOR_ERROR, "USAGE: /kick (id) (option: reason)");
        {
            if(IsPlayerOnline(playerid))
            {
                format(string, sizeof(string), "%s(%d) has been {FF0000}kicked {FFFFFF}by an server admin. | Reason: %s", PlayerName(targetid), targetid, reason);
                SendClientMessageToAll(COLOR_INFO, string);
                Kick(targetid);
            }
        }
        return 1;
    }
}
How to make it like if you dont type any reason.. just "/kick 1" then the %s (reason) should be replaced with "No specific reason"
Reply
#2

Just add it as an optional string in sscanf, for example:

pawn Код:
sscanf(params, "dS(No specific reason)[128]", targetid, reason);
Reply
#3

Thx

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)