Problem with warn-command!
#2

Just to start off, why you use sscanf 2 times? And also sendclientmessage's string should be 128, you don't need to define 3 strings. Just use 1 like i did below.
pawn Код:
CMD:warn(playerid,params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 3)
    {

            new Target;
            new Reason[50];
            if(sscanf(params, "us[50]", Target,Reason)) SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /warn [playerid] [reason]");
             if(Target == playerid) return SendClientMessage(playerid, COLOR_RED, "SERVER: Cant perform this command on yourself!" );
                if(Target == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected!");
                if(PlayerInfo[Target][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid,COLOR_RED,"ERROR: You can't perform this command on Admins that are higher than your level!");
                PlayerInfo[Target][Warnings] ++;
                new tname[MAX_PLAYER_NAME];
                GetPlayerName(Target,tname,sizeof(tname));
                new pname[MAX_PLAYER_NAME];
                GetPlayerName(playerid,pname,sizeof(pname));
                new MyString[128];
               WarnLog(Target);
                format(MyString,sizeof MyString, "You have warned %s! (Reason: %s) (Warnings: %d/%d)", tname, Reason, PlayerInfo[Target][Warnings],MAX_WARNINGS);
                SendClientMessageToAll(COLOR_YELLOW,MyString);
                format(MyString,sizeof(MyString), "Administrator %s has given %s a warning! Reason: %s (Warnings: %d/%d)", pname, tname, Reason,PlayerInfo[Target][Warnings],MAX_WARNINGS);
                SendClientMessage(Target, COLOR_RED, MyString);
                if(PlayerInfo[Target][Warnings] == MAX_WARNINGS)
                {
                    new name[MAX_PLAYER_NAME];
                    GetPlayerName(Target,name,sizeof(name));
                    format(MyString,sizeof(MyString),"Player %s (ID:%d) got kicked! (Reason: Maximum warnings)", name, Target);
                    SendClientMessageToAll(COLOR_RED,MyString);
                    WarnKick(Target);
                    Kick(Target);
                }

    }
    else return SendClientMessage(playerid,COLOR_RED,"ERROR: You must be level 3 to perform this command!");
    return 1;
}
This should work
Reply


Messages In This Thread
Problem with warn-command! - by Twisted_Insane - 23.02.2012, 20:34
Re: Problem with warn-command! - by Tanush123 - 23.02.2012, 20:44
Re: Problem with warn-command! - by Twisted_Insane - 24.02.2012, 07:52
Re: Problem with warn-command! - by Tanush123 - 25.02.2012, 20:49
Re: Problem with warn-command! - by Konstantinos - 25.02.2012, 21:53
Re: Problem with warn-command! - by HighPitchedVoice - 25.02.2012, 21:58
Re: Problem with warn-command! - by Tanush123 - 26.02.2012, 00:50

Forum Jump:


Users browsing this thread: 2 Guest(s)