SA-MP Forums Archive
/warn request - 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)
+--- Thread: /warn request (/showthread.php?tid=516204)



/warn request - jamjamnewbie - 30.05.2014

I know of a simple /warn command, but how about this
like....

WarnID(1) belongs to Player_1 because of: Aimbot
WarnID(2) belongs to Player_2 because of: Abuse
WarnID(3) belongs to Player_1 because of: Ram
WarnID(4) belongs to Player_3 because of: RCON attempt login

like...every warnID corresponds to one player...I dont know how
HELP


Re: /warn request - Stinged - 30.05.2014

This should work, tell me if anything went wrong.
pawn Код:
// Add this to the top
new TimesWarned[MAX_PLAYERS];

// Add this under OnPlayerDisconnect
TimesWarned[playerid] = 0;

/* This is the command - zcmd and sscanf
   Add your admin stuff */

CMD:warn(playerid, params[])
{
    new id, reason[64], string[144] p_name[24];
    if(sscanf(params, "us[64]", id, reason))
        return SendClientMessage(playerid, /* color */, /* usage message */);
    if(!IsPlayerConnected(id))
        return SendClientMessage(playerid, /* color */, /* not connected message */);
    GetPlayerName(id, p_name, sizeof(p_name));
    TimesWarned[id]++;
    format(string, sizeof(string), "WarnID(%i) belongs to %s because of: %s", TimesWarned[id], p_name, reason);
    SendClientMessageToAll(/* color */, string);
    return 1;
}