REP+ warn cmd not working
#1

hey everyone,

im trying to make a warn cmd for my IRC for my server, but it doesnt continues with counting the warnings, cuz i want after 3 warnings the player gets kicked, but he only counts the warning 1 time, after that he says: warning 1/3 and doesnt keeps continueing to 2/3 and 3/3

this is the cmd i have this far:
pawn Код:
IRCCMD:warn(botid, channel[], user[], host[], params[])
{
    // Check if the user is at least a halfop in the channel
    if (IRC_IsHalfop(botid, channel, user))
    {
        new playerid, reason[64];
        // Check if the user at least entered a player ID
        if (sscanf(params, "dS(No reason)[64]", playerid, reason))
        {
            return 1;
        }
        // Check if the player is connected
        if (IsPlayerConnected(playerid))
        {
            // warns the player
            // Echo the formatted message
           
            new msg[128], name[MAX_PLAYER_NAME], Warns[MAX_PLAYERS];
            Warns[playerid]++;
            GetPlayerName(playerid, name, sizeof(name));
            format(msg, sizeof(msg), "02*** %s has been warned by %s on IRC.(warning: %d/3)  (Reason: %s)", name, user, Warns[playerid],reason);
            IRC_GroupSay(groupID, channel, msg);
            format(msg, sizeof(msg), "*** %s has been warned by %s on IRC.(warning: %d/3)  (Reason: %s)", name, user, Warns[playerid],reason);
            SendClientMessageToAll(0x0000FFFF, msg);
           
                if(Warns[playerid] == MAX_WARNINGS)
            {
                GetPlayerName(playerid, name, sizeof(name));
                format(msg, sizeof(msg), "02*** %s has been kicked by %s on IRC. reason: warning 3/3", name, user);
                IRC_GroupSay(groupID, channel, msg);
                format(msg, sizeof(msg), "*** %s has been warned by %s on IRC. reason: warning 3/3", name, user);
                SendClientMessageToAll(0x0000FFFF, msg);
                Warns[playerid] = 0;
                Kick(playerid);
            }
        }
    }
    return 1;
}
can anyone tell me wuts wrong with this? and tell me how to fix it?

REP+ for the one who helps me

greets niels
Reply
#2

PHP код:
if(Warns[playerid] == MAX_WARNINGS)
            {
                
GetPlayerName(playeridnamesizeof(name));
                
format(msgsizeof(msg), "02*** %s has been kicked by %s on IRC. reason: warning 3/3"nameuser);
                
IRC_GroupSay(groupIDchannelmsg);
                
format(msgsizeof(msg), "*** %s has been warned by %s on IRC. reason: warning 3/3"nameuser);
                
SendClientMessageToAll(0x0000FFFFmsg);
                
Warns[playerid] = 0;
                
Kick(playerid); 
Why not remove this
PHP код:
Warns[playerid] = 0
And add it under OnPlayerDisconnect(Use the IRC callback for player/bot disconnect I don't really know its name).
Reply
#3

agh, shit never watched that line again xD, lets try it

EDIT: it works, thnx REP+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)