SA-MP Forums Archive
Warn Command Bug - 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 Command Bug (/showthread.php?tid=595511)



Warn Command Bug - dh240473 - 04.12.2015

Hi guys i need your help i'm trying to making warn command but the command is bugging please help me fix the code
pawn Код:
CMD:warn(playerid,params[])
{
    if(PInfo[playerid][Admin] >= 4)
    {
        new warned,reason[50];
        new str[128];
        if(sscanf(params, "us[50]", warned,reason)) return SendClientMessage(playerid, -1, "Usage: /warn [PlayerID] [Reason]");
        if(PInfo[warned][Admin] == 6 && PInfo[playerid][Admin] != 6) return SendClientMessage(playerid,-1,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(warned) && warned != INVALID_PLAYER_ID)
        {
             if(warned != playerid)
             {
                PInfo[warned][Warn]++;
                if(PInfo[warned][Warn] == MaxWarn)
                {
                format(str, sizeof (str), "Admin %s[%d] Has Kicked %s[%d] Reason: %s [Warn: %d/%d]", IsPlayerName(playerid),playerid, IsPlayerName(warned), warned, reason, PInfo[warned][Warn], MaxWarn);
                SendClientMessageToAll(-1, str);
                Kick(warned);
                return PInfo[warned][Warn] = 0;
                }
                else
                {
                format(str, sizeof (str), "Admin %s[%d] Has Given %s A Warning Reason: %s [Warn: %d/%d]", IsPlayerName(playerid),playerid, IsPlayerName(warned),warned, reason, PInfo[warned][Warn], MaxWarn);
                return SendClientMessageToAll(-1, str);
                }
             }
             else return SendClientMessage(playerid, -1, "ERROR: You cannot warn yourself");
        }
        else return EMsg(playerid, 2);
    }
    else return EMsg(playerid, 8);
}



Re: Warn Command Bug - Trevor19012 - 04.12.2015

Hi there, if I may ask, what part of the command is actually bugging?


Re: Warn Command Bug - dh240473 - 04.12.2015

Quote:
Originally Posted by OsamaBigLag
Посмотреть сообщение
Hi there, if I may ask, what part of the command is actually bugging?
When Im Using The Command To A Player Its Will Be More Than MaxWarning Like 100/3245


Re: Warn Command Bug - jlalt - 04.12.2015

PHP код:
}
                else
                {
                
format(strsizeof (str), "Admin %s[%d] Has Given %s A Warning Reason: %s [Warn: %d/%d]"IsPlayerName(playerid),playeridIsPlayerName(warned),warnedreasonPInfo[warned][Warn], MaxWarn);
                } 
you've used to show playerid [ warned player id ] but did not use [%d] after he's name it should be:
PHP код:
}
                else
                {
                
format(strsizeof (str), "Admin %s[%d] Has Given %s[%d] A Warning Reason: %s [Warn: %d/%d]"IsPlayerName(playerid),playeridIsPlayerName(warned),warnedreasonPInfo[warned][Warn], MaxWarn);
                return 
SendClientMessageToAll(-1str);
                } 
Best Regards,


Re: Warn Command Bug - dh240473 - 04.12.2015

Quote:
Originally Posted by jlalt
Посмотреть сообщение
PHP код:
}
                else
                {
                
format(strsizeof (str), "Admin %s[%d] Has Given %s A Warning Reason: %s [Warn: %d/%d]"IsPlayerName(playerid),playeridIsPlayerName(warned),warnedreasonPInfo[warned][Warn], MaxWarn);
                } 
you've used to show playerid [ warned player id ] but did not use [%d] after he's name it should be:
PHP код:
}
                else
                {
                
format(strsizeof (str), "Admin %s[%d] Has Given %s[%d] A Warning Reason: %s [Warn: %d/%d]"IsPlayerName(playerid),playeridIsPlayerName(warned),warnedreasonPInfo[warned][Warn], MaxWarn);
                return 
SendClientMessageToAll(-1str);
                } 
Best Regards,
Thx Bruh !! REP+