/warn and /deletewarns Commands +REP
#8

Simple command of warning with kick able.
pawn Код:
new Warnings[MAX_PLAYERS]; //on top of your script

CMD:warn(playerid, params[])
{
    new targetid, reason[128], string[128];
    if(PlayerInfo[playerid][pAdmin] == 0) return 0;
    if(sscanf(params, "us[128]", targetid, reason)) return SendClientMessage(playerid, -1, "/warn [playerid/name] [reason]");
    if(!IsPlayerConnected(targetid))return SendClientMessage(playerid, -1, "This player is not connected.");
    if(targetid == playerid) return SendClientMessage(playerid,-1,"You cannot use this command on yourself.");

    if(Warnings[targetid] < 4)
    {
        Warnings[targetid] ++;
        format(string, sizeof(string), "%s(%d) has been Warned by an Administrator, reason: %s", GetName(targetid), targetid, reason);
        SendClientMessageToAll(-1, string);
    }
    else //if warning = 5 it will kick player id
    {
        format(string, sizeof(string), "%s(%d) Has Been Kicked From The Server,t reason: so much warnings", GetName(targetid), targetid);
        SendClientMessageToAll(-1, string);
        Kick(targetid);
    }
    return 1;
}
Reply


Messages In This Thread
/warn and /deletewarns Commands +REP - by Youssef214 - 24.06.2014, 11:38
Re: /warn and /deletewarns Commands +REP - by Vanter - 24.06.2014, 11:40
Re : /warn and /deletewarns Commands +REP - by Clad - 24.06.2014, 11:41
Re: /warn and /deletewarns Commands +REP - by Youssef214 - 24.06.2014, 11:43
Re : /warn and /deletewarns Commands +REP - by Clad - 24.06.2014, 11:45
Re: /warn and /deletewarns Commands +REP - by Youssef214 - 24.06.2014, 11:50
Re : Re: /warn and /deletewarns Commands +REP - by Clad - 24.06.2014, 11:52
Re: /warn and /deletewarns Commands +REP - by Juvanii - 24.06.2014, 12:04
Re : Re: /warn and /deletewarns Commands +REP - by Clad - 24.06.2014, 12:07
Re: Re : Re: /warn and /deletewarns Commands +REP - by Juvanii - 24.06.2014, 12:18

Forum Jump:


Users browsing this thread: 1 Guest(s)