SA-MP Forums Archive
[Help]: warn command! - 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: [Help]: warn command! (/showthread.php?tid=439449)



[Help]: warn command! - Areax - 25.05.2013

Hello!

I have another problem...I made my warn command, but when I type it ingame, then I get kicked...but I want that this command will give a player an warning (%i/3) and when he earn 3 warnings, then he gets kicked.

Code:

pawn Код:
CMD:warn(playerid, params[])
{
    new targetid;
    new string[200];
    new reason[60];
    if(gPlayerInfo[playerid][pAdminLevel] < gCommands[WARN])return SCM(playerid, COLOR_RED, "[ERROR]: You can't use this command!");
    if(sscanf(params, "us[60]", targetid, reason))return SCM(playerid, COLOR_GREY, "[USAGE]: /warn [playerid] [reason]");
    if(!IsPlayerConnected(targetid))return SCM(playerid, COLOR_RED, "[ERROR]: This player is not connected!");
    warned[targetid] ++;
    format(string, sizeof(string), "{80FF00}[Admin]: {DFF709}%s has Warned %s!{FF0000}||{DFF709}Reason: %s (%i/3)", GetName(playerid), GetName(targetid), reason, warned[targetid]);
    SCMToAll(COLOR_YELLOW, string);
    if(warned[targetid] == 3)
    format(string, sizeof string, "{80FF00}[Admin]: {DFF709}%s has been Warned three times and got Kicked from the Server!{FF0000}||{DFF709}Reason: %s (3/3)", GetName(targetid), reason);
    SCMToAll(COLOR_YELLOW, string);
    Kick(targetid);
    return 1;
}
Thanks


Re: [Help]: warn command! - Kevin FOx - 25.05.2013

pawn Код:
CMD:warn(playerid, params[])
{
    new targetid;
    new string[200];
    new reason[60];
    if(gPlayerInfo[playerid][pAdminLevel] < gCommands[WARN])return SCM(playerid, COLOR_RED, "[ERROR]: You can't use this command!");
    if(sscanf(params, "us[60]", targetid, reason))return SCM(playerid, COLOR_GREY, "[USAGE]: /warn [playerid] [reason]");
    if(!IsPlayerConnected(targetid))return SCM(playerid, COLOR_RED, "[ERROR]: This player is not connected!");
    warned[targetid] ++;
    format(string, sizeof(string), "{80FF00}[Admin]: {DFF709}%s has Warned %s!{FF0000}||{DFF709}Reason: %s (%i/3)", GetName(playerid), GetName(targetid), reason, warned[targetid]);
    SCMToAll(COLOR_YELLOW, string);
    if(warned[targetid] == 3)
    {
      format(string, sizeof string, "{80FF00}[Admin]: {DFF709}%s has been Warned three times and got Kicked from the Server!{FF0000}||{DFF709}Reason: %s (3/3)", GetName(targetid), reason);
      SCMToAll(COLOR_YELLOW, string);
      Kick(targetid);
   }
    return 1;
}
Try this.


Re: [Help]: warn command! - Areax - 25.05.2013

Quote:
Originally Posted by Kevin FOx
Посмотреть сообщение
pawn Код:
CMD:warn(playerid, params[])
{
    new targetid;
    new string[200];
    new reason[60];
    if(gPlayerInfo[playerid][pAdminLevel] < gCommands[WARN])return SCM(playerid, COLOR_RED, "[ERROR]: You can't use this command!");
    if(sscanf(params, "us[60]", targetid, reason))return SCM(playerid, COLOR_GREY, "[USAGE]: /warn [playerid] [reason]");
    if(!IsPlayerConnected(targetid))return SCM(playerid, COLOR_RED, "[ERROR]: This player is not connected!");
    warned[targetid] ++;
    format(string, sizeof(string), "{80FF00}[Admin]: {DFF709}%s has Warned %s!{FF0000}||{DFF709}Reason: %s (%i/3)", GetName(playerid), GetName(targetid), reason, warned[targetid]);
    SCMToAll(COLOR_YELLOW, string);
    if(warned[targetid] == 3)
    {
      format(string, sizeof string, "{80FF00}[Admin]: {DFF709}%s has been Warned three times and got Kicked from the Server!{FF0000}||{DFF709}Reason: %s (3/3)", GetName(targetid), reason);
      SCMToAll(COLOR_YELLOW, string);
      Kick(targetid);
   }
    return 1;
}
Try this.
Thanks REP+