SA-MP Forums Archive
/warn help - 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 help (/showthread.php?tid=327859)



/warn help - paulll0len - 22.03.2012

Please help me with the /warn [ID] [Reason] , I dont know how to do that ..


Re: /warn help - Skribblez - 22.03.2012

here you go:

pawn Код:
command(warn, playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        new id, reason[128], string[128], playername[24];
        if(sscanf(params, "us[128]", id, reason)) return SendClientMessage(playerid, 0xFFFFFFFF, "Syntax: /warn [playerid] [reason]");
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You're not an admin!");
       
        if(IsPlayerConnected(id))
        {
            GetPlayerName(id, playername, sizeof(playername));
            warn[playerid] += 1;
            format(string, sizeof(string), "%s has been warned, reason: %s", playername, reason);
            SendClientMessageToAll(0xFF0000FF, string);
        }
        else SendClientMessage(playerid, 0xAAAAAAFF, "Player is offline!");
    }
    return 1;
}
just change "warn" to the variable that you're using for player's warns.