#1

The admin function is
Код:
if(!IsPlayerAdmin(playerid))
Max warnings should be 5 but i can edit those by myself. It needs /warn and /unwarn with a reason. So can anyone help me?
Reply
#2

You want me to send you a /warn code as a strpcmd or cmd: ?
Reply
#3

pawn Код:
new warned[MAX_PLAYERS];

//ZCMD and sscanf
CMD:warn(playerid,params[])
{
    new playeridex;
    if(sscanf(params,"%u%s[129]",playeridex,params)) return SendClientMessage(playerid,0xFFFFFF,"Usage: /warn <playerid> <reason>")
    new string[128],string1[MAX_PLAYER_NAME];
    GetPlayerName(playeridex,string,sizeof(string));
    GetPlayerName(playerid,string1,sizeof(string1));
    warned[playeridex]++;
    format(string,sizeof(string),"%s has been warned by %s. Reason: %s",string,string1,params);
    SendClientMessageToAll(0xFFFFFF,string)
    if(warned[playerid] == 5)
    {
        Kick(playeridex);
        format(string,sizeof(string),"%s has been kicked for having too much warn.",string);
        SendClientMessageToAll(0xFFFFFF,string)
    }
    return 1;
}

CMD:unwarn(playerid,params[])
{
    new playeridex;
    if(sscanf(params,"%u%s[129]",playeridex,params)) return SendClientMessage(playerid,0xFFFFFF,"Usage: /unwarn <playerid> <reason>")
    new string[128],string1[MAX_PLAYER_NAME];
    GetPlayerName(playeridex,string,sizeof(string));
    GetPlayerName(playerid,string1,sizeof(string1));
    warned[playeridex]--;
    format(string,sizeof(string),"%s has been unwarned by %s. Reason: %s",string,string1,params);
    SendClientMessageToAll(0xFFFFFF,string)
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)