[Help]: warn command!
#1

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
Reply
#2

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.
Reply
#3

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+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)