Convert strtok and strcmp to sscanf and zcmd
#6

pawn Код:
command(kick, playerid, params[])
{
    new ID, string[128], reason[66];
    if(PlayerInfo[playerid][pAdminLevel] >= 1) return SendClientMessage(playerid, 0xFFFF00AA,"You don't have authorization.");
    if(sscanf(params, "uS(No Reason Given)[65]", ID, reason)) SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /kick [id] [optional: reason]");
    else if(ID == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_LIGHTBLUE, "AdmCmd This player is not online!");
    else
    {
        format(string,sizeof(string), "You have been kicked by Administrator %s Reason: %s", adminid,reason);
        SendClientMessage(ID , COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "You have kicked %s %s", victimid, reason);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "Administrator/VIP %s has kicked %s %s",adminid,victimid,reason);
        SendClientMessageToAll( COLOR_LIGHTBLUE, string );
        TogglePlayerControllable(ID, false);
        Kick(ID);
    }
    return 1;
}
Use sscanf n zcmd

@[FeK]DraKiNs and PeteShag
It's 'S' not 's' for optional strings.
Reply


Messages In This Thread
Convert strtok and strcmp to sscanf and zcmd - by admantis - 21.01.2011, 02:12
Re: Convert strtok and strcmp to sscanf and zcmd - by PeteShag - 21.01.2011, 03:15
Respuesta: Convert strtok and strcmp to sscanf and zcmd - by ipsBruno - 21.01.2011, 03:19
Re: Convert strtok and strcmp to sscanf and zcmd - by PeteShag - 21.01.2011, 03:23
Re: Convert strtok and strcmp to sscanf and zcmd - by Marty_Alex - 21.01.2011, 04:39
Re: Convert strtok and strcmp to sscanf and zcmd - by HyperZ - 21.01.2011, 04:39

Forum Jump:


Users browsing this thread: 2 Guest(s)