SA-MP Forums Archive
/warn - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /warn (/showthread.php?tid=276965)



/warn - vent - 15.08.2011

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?


Re: /warn - ElieJabbour - 16.08.2011

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


Re: /warn - =WoR=Varth - 16.08.2011

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;
}