Problem with /ban
#2

You shouldn't be using strtok in zcmd.

pawn Код:
CMD:ban(playerid, params[]) {
    new
        giveplayerid,
        szReason[32];
       
    if(sscanf(params, "us[32]", giveplayerid, szReason))
        return SendClientMessage(playerid, -1, "Syntax: /ban [playerid] [reason]");

    if(IsPlayerNPC(giveplayerid))
        return 1;

    if(PlayerInfo[playerid][pAdmin] >= 2) {
        if(giveplayerid != INVALID_PLAYER_ID) {
            new
                sendername[MAX_PLAYER_NAME],
                string[128],
                giveplayer[MAX_PLAYER_NAME];
               
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
           
            format(string, 128, "[LOST:RP] [ADMIN]: %s has banned %s! Reason: %s", sendername, giveplayer, szReason);
            SendClientMessageToAll(RED, string);
            Ban(giveplayerid);
           
            new Hour, Minute, Second;
            gettime(Hour, Minute, Second);
            format(string,sizeof(string),"[%02d:%02d:%02d]%s has banned %s! Reason:%s",Hour,Minute,Second,sendername,giveplayer, szReason);
            SaveIn("BanLog.txt",string);
        }
    }
    return 1;
}
Untested.
Reply


Messages In This Thread
Problem with /ban - by BizzyD - 06.05.2011, 21:14
Re: Problem with /ban - by Calgon - 06.05.2011, 21:20
Re: Problem with /ban - by Vince - 06.05.2011, 21:24
Re: Problem with /ban - by BizzyD - 06.05.2011, 21:24

Forum Jump:


Users browsing this thread: 1 Guest(s)