Problem with tempban
#1

I have a quite weird problem. I have a tempban system, but if the time is 60+ ( minutes ), then it doesn't show 0, but it just counts further. Same problem for hours, it doesn't set a hour forward.. If you can help me, it would be appreaciated
Reply
#2

show the code..
Reply
#3

pawn Код:
if(strcmp(cmd, "/tempban", true) == 0)
    {
        if (IsPlayerAdmin(playerid))
        {
            tmp = strtok(cmdtext,idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_PINK, "USAGE: /tempban [playerid] [minutes] [reason]");
                return 1;
            }
            new giveplayerid = ReturnUser(tmp);
            if(giveplayerid != INVALID_PLAYER_ID)
            {
                tmp = strtok(cmdtext, idx);
                if (!strlen(tmp)) return SendClientMessage(playerid, COLOR_PINK, "USAGE: /tempban [playerid] [minutes] [reason]");
                new minutes = strval(tmp);
                new reason[128];
                reason = bigstrtok(cmdtext, idx);
                if (!strlen(reason)) return SendClientMessage(playerid, COLOR_PINK, "USAGE: /tempban [playerid] [minutes] [reason]");
                new ip[15];
                GetPlayerIp(giveplayerid,ip,15);
                GetPlayerName(playerid, sendername, sizeof(sendername));
                GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
                new File:tempban = fopen("/userfiles/tempban/tempbanlist.ban", io_append);
                if (tempban)
                {
                    new hour, minute, second;
                    gettime(hour, minute, second);
                    format(string, sizeof string, "%d|%d|%s\n", hour, minute, ip);
                    fwrite(tempban, string);
                    fclose(tempban);
                }
                format(string,128,"%s has been temporarily banned by %s for %d minutes for %s.", giveplayername, sendername, minutes, reason);
                SendClientMessageToAll(COLOR_RED,string);
                Kick(giveplayerid);
            }
            else
            {
                SendClientMessage(playerid, COLOR_PINK,"Targetid is not connected");
            }
        }
        else return 0;
        return true;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)