Help: /warn cmd don't show a reason
#3

pawn Код:
CMD:warn(playerid, params[])
{
    if(gPlayerInfo[playerid][PLAYER_LEVEL] < 1) return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command!");
    new pID, string[128], pName[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], reason[64];
    if(sscanf(params, "us[64]", pID, reason)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /warn [playerid] [reason]");
    if(!IsPlayerConnected(pID))return SendClientMessage(playerid, COLOR_RED, "ERROR: This player is not connected.");
    {
        playerWarn[pID] ++;
        GetPlayerName(playerid, pName, sizeof pName);
        GetPlayerName(pID, name, sizeof name);
        format(string, sizeof string, "[SYSTEM]: Administrator %s warned you for %s. Total warnings %i/3.", pName, reason, playerWarn[pID]);
        SendClientMessage(pID, COLOR_YELLOW, string);
        format(string, sizeof string, "[SYSTEM]: You warned a player %s for %s. Total warnings %i/3.", name, reason, playerWarn[pID]);
        SendClientMessage(playerid, COLOR_YELLOW, string);
        if(playerWarn[pID] > 2)
        {
            format(string, sizeof string, "[KICK]: %s recived 3 warnings and got kicked from the server. Reason: %s.", name, reason);
            SendClientMessageToAll(COLOR_YELLOW, string);
            SendClientMessage(pID, COLOR_YELLOW, "[KICK]: You were warned three (3) times and got kicked.");
            Kick(pID);
            KickLog(string);
        }
    }
    return 1;
}
EDIT: Too late.
Reply


Messages In This Thread
Help: /warn cmd don't show a reason - by Areax - 11.04.2013, 16:06
Re: Help: /warn cmd don't show a reason - by [D]ry[D]esert - 11.04.2013, 16:08
Re: Help: /warn cmd don't show a reason - by SilverKiller - 11.04.2013, 16:09
Re: Help: /warn cmd don't show a reason - by Areax - 11.04.2013, 16:13

Forum Jump:


Users browsing this thread: 1 Guest(s)