ban with amount of days
#1

i have a ban system but it bans perm for every thing should i replace it with day one that has perm and days or what?
here is the cmd i am using now
pawn Код:
if(strcmp(cmd, "/ban", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_SECURITY, "Syntax: /ban (id/name) (reason)");
                return 1;
            }
            new giveplayerid;
            giveplayerid = ReturnUser(tmp);
            if(IsPlayerNPC(giveplayerid)) return 1;
            if(PInfo[playerid][AdminLevel] >= 1)
            {
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        new length = strlen(cmdtext);
                        while ((idx < length) && (cmdtext[idx] <= ' '))
                        {
                            idx++;
                        }
                        new offset = idx;
                        new result[156];
                        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                        {
                            result[idx - offset] = cmdtext[idx];
                            idx++;
                        }
                        result[idx - offset] = EOS;
                        if(!strlen(result))
                        {
                            SendClientMessage(playerid, COLOR_SECURITY, "Syntax: /ban (id/name) (reason)");
                            return 1;
                        }
                        PlaySound(0);
                        PlayerPlaySound(giveplayerid, 1190, 0, 0, 0); //Send a slap sound to the victim for lulz.
                        new date,month,year;
                        getdate(date,month,year);
                        new hour,minute,second;
                        gettime(hour,minute,second);
                        format(string, sizeof(string), "{FFFFFF}Administrator {FF9900}%s(%d){FFFFFF}Permanently Banned banned {FF9900}%s(%d){FFFFFF} • {FF9900}[Reason: %s]", PlayerName(playerid), playerid, PlayerName(giveplayerid), giveplayerid, (result));
                        SendClientMessageToAll(COLOR_WHITE, string);
                        PInfo[giveplayerid][Banned] = 1;
                        GettingBanned[giveplayerid] = 1;
                        new Name[MAX_PLAYER_NAME];
                        new plrIP[25];
                        new query[256];
                        //new date2[128];
                        //format(date2, sizeof(date2), "%d/%d/%d", year,month,date);
                        GetPlayerName(giveplayerid,Name,sizeof(Name));
                        GetPlayerName(playerid,sendername,sizeof(sendername));
                        GetPlayerIp(giveplayerid, plrIP, sizeof(plrIP));
                        mysql_real_escape_string(Name,Name);
                        mysql_real_escape_string((result),(result));
                        mysql_real_escape_string(sendername,sendername);
                        mysql_real_escape_string(plrIP,plrIP);
                        format(query,sizeof(query),"INSERT INTO `bans` (Username, Reason, Administrator, IP, Date, Time) VALUES ('%s','%s','%s','%s','%d/%d/%d','%d:%d:%d')",Name,(result),sendername,plrIP,year,month,date,hour,minute,second);
                        mysql_reconnect();
                        mysql_query(query);
                        AdminLog(playerid, "/ban", (result), Name);
                        Kick(giveplayerid);
                        return 1;
                    }
                }
                else
                {
                    format(string, sizeof(string), "Could not find player (%d)", giveplayerid);
                    SendClientMessage(playerid, COLOR_ERROR, string);
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_ERROR, "Unknown command, please type /help for a list of available commands to use.");
            }
        }
        return 1;
    }
    return SendClientMessage(playerid, COLOR_ERROR, "Unknown command, please type /help for a list of available commands to use.");
}
thanks
Reply


Messages In This Thread
ban with amount of days - by Geeboi_Mehdi - 10.06.2013, 22:23
Re: ban with amount of days - by Aly - 11.06.2013, 04:30
Re: ban with amount of days - by Geeboi_Mehdi - 11.06.2013, 20:36
Re: ban with amount of days - by Aly - 11.06.2013, 20:49
Re: ban with amount of days - by Geeboi_Mehdi - 11.06.2013, 21:22
Re: ban with amount of days - by MP2 - 11.06.2013, 21:33
Re: ban with amount of days - by zT KiNgKoNg - 11.06.2013, 21:47

Forum Jump:


Users browsing this thread: 1 Guest(s)