Warning/Kick system problems.
#8

Something like this?
pawn Код:
CMD:warn(playerid, params[])
{
    if(PlayerInfo[playerid][Level] >= 1)
    {
        new
            id,
            reason[32]
        ;
       
        if(sscanf(params, "us[32]", id, reason))
            return SendClientMessage(playerid, red, "USAGE: /warn [playerid/PartOfName] [reason]");
           
        if(PlayerInfo[id][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel])
            return SendClientMessage(playerid, red, "ERROR: You cannot use this command on this admin");
           
        if(IsPlayerConnected(id))
        {
            if(id == playerid)
                return SendClientMessage(playerid, red, "ERROR: You cannot warn yourself");
               
            CMDMessageToAdmins(playerid, "WARN");
            PlayerInfo[id][pWarnings]++;
           
            if(PlayerInfo[id][Warnings] == MAX_WARNINGS)
            {
                format(str, sizeof(str), "***Administrator \"%s\" has kicked \"%s\". (Reason: %s) (Warning: %d/%d)***",
                    pName(playerid), pName(id), reason, PlayerInfo[id][Warnings], MAX_WARNINGS);
                SendClientMessageToAll(grey, str);
                SaveToFile("KickLog", str);
                Kick(id);
                return PlayerInfo[id][Warnings] = 0;
            }
            else
            {
                format(str, sizeof (str), "***Administrator \"%s\" has given \"%s\" a warning.  (Reason: %s) (Warning: %d/%d)***", pName(playerid), pName(id), reason, PlayerInfo[id][Warnings], MAX_WARNINGS);
                return SendClientMessageToAll(yellow, str);
            }
        }
        else SendClientMessage(playerid, red, "ERROR: Player is not connected");
    }
    else SendClientMessage(playerid, red, "ERROR: You are not a high enough level to use this command");
    return 1;
}
Reply


Messages In This Thread
Warning/Kick system problems. - by [FoR]EveR - 30.08.2013, 13:54
Re: Warning/Kick system problems. - by DanishHaq - 30.08.2013, 13:56
Re: Warning/Kick system problems. - by kingofdemons - 30.08.2013, 13:57
Re: Warning/Kick system problems. - by [FoR]EveR - 30.08.2013, 14:26
Re: Warning/Kick system problems. - by kingofdemons - 30.08.2013, 15:02
Re: Warning/Kick system problems. - by [FoR]EveR - 30.08.2013, 15:13
Re: Warning/Kick system problems. - by [FoR]EveR - 31.08.2013, 08:27
Re: Warning/Kick system problems. - by Skribblez - 31.08.2013, 08:41
Re: Warning/Kick system problems. - by [FoR]EveR - 31.08.2013, 09:39
Re: Warning/Kick system problems. - by [FoR]EveR - 31.08.2013, 09:42

Forum Jump:


Users browsing this thread: 1 Guest(s)