can i ask
#6

pawn Код:
if(strcmp(cmd, "/tempban", true) == 0)
    {
        new adminname[MAX_PLAYER_NAME];

        if(PlayerInfo[playerid][Level] >= 4)
        {
            tmp = strtok(cmdtext,idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, red, "Usage: /tempban [PlayerID] [Day(s)] [Reason]");
                SendClientMessage(playerid, green, "Function: Temporarily bans a player for specified Days");
                return 1;
            }
            new string[128];
            new playername[24];
            playername = ReturnUser(tmp);
            if(IsPlayerConnected(playername))
            {
                tmp = strtok(cmdtext, idx);
                if (!strlen(tmp))
                {
                SendClientMessage(playerid, red, "Usage: /tempban [PlayerID] [Day(s)] [Reason]");
                SendClientMessage(playerid, green, "Function: Temporarily bans a player for specified Days");
                return 1;
                }
                new days = strval(tmp);
                if(!IsNumeric(tmp))
                return SendClientMessage(playerid, red, "ERROR: Invalid Day! Only Numbers!");

                if(strval(tmp) <= 0 || strval(tmp) > 1000)
                return SendClientMessage(playerid, red, "ERROR: Invalid Day! (1-1000)");

                new reason[128];
                reason = strtok2(cmdtext,idx);
                if (!strlen(reason))
                return SendClientMessage(playerid, red, "ERROR: Reason not Specified!");

                if (strlen(reason) <= 0 || strlen(reason) > 100)
                return SendClientMessage(playerid, red, "ERROR: Invalid Reason length!");

                new ip[15];
                GetPlayerIp(playername,ip,15);
                GetPlayerName(playerid, playername, sizeof playername);
                GetPlayerName(playername, playername, sizeof(playername));
                new File:tempban = fopen("ladmin/Config/TempBans", io_append);
                if (tempban)
                {
                    new year,month,day;
                    getdate(year, month, day);
                    day += days;
                    if (IsMonth31(month))
                    {
                        if (day > 31)
                        {
                            month += 1;
                            if (month > 12)
                            {
                                year += 1;
                                while(day > 31) day -= 31;
                            }
                            else while(day > 31) day -= 31;
                        }
                    }
                    else if (!IsMonth31(month))
                    {
                        if (day > 30)
                        {
                            month += 1;
                            if (month > 12)
                            {
                                year += 1;
                                while(day > 30) day -= 30;
                            }
                            else while(day > 30) day -= 30;
                        }
                    }
                    else if (!IsMonth31(month) && IsMonth29(year) && month == 2)
                    {
                        if (day > 29)
                        {
                            month += 1;
                            if (month > 12)
                            {
                                year += 1;
                                while(day > 29) day -= 29;
                            }
                            else while(day > 29) day -= 29;
                        }
                    }
                    else if (!IsMonth31(month) && !IsMonth29(year) && month == 2)
                    {
                        if (day > 28)
                        {
                            month += 1;
                            if (month > 12)
                            {
                                year += 1;
                                while(day > 28) day -= 28;
                            }
                            else while(day > 28) day -= 28;
                        }
                    }
                    format(string, sizeof string, "%d|%d|%d|%s\n", day, month, year, ip);
                    fwrite(tempban, string);
                    fclose(tempban);
                }
                format(string,128,"Administrator %s Temporarily Banned %s for %d Day(s) | Reason: %s",adminname,playername,days,reason);
                SendClientMessageToAll(red,string);
                Kick(playername);

                format(string, sizeof string, "Admin %s Temporarily Banned %s for %d Day(s) | Reason: %s",adminname,playername,days,reason);
                SaveIn("TempBansLog",string);
            }
            else
            {
                SendClientMessage(adminname, red, "Player is not connected");
            }
        } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
    }
idk that maybe eff it idk about strcmp much im a zcmder
Reply


Messages In This Thread
can i ask - by willsuckformoney - 28.07.2010, 03:15
Re: can i ask - by Kar - 28.07.2010, 03:19
Re: can i ask - by willsuckformoney - 28.07.2010, 03:21
Re: can i ask - by Kar - 28.07.2010, 03:23
Re: can i ask - by willsuckformoney - 28.07.2010, 03:26
Re: can i ask - by Kar - 28.07.2010, 03:31
Re: can i ask - by mastasquizy - 28.07.2010, 03:39
Re: can i ask - by willsuckformoney - 28.07.2010, 03:39
Re: can i ask - by Zamaroht - 28.07.2010, 03:42
Re: can i ask - by mastasquizy - 28.07.2010, 04:14

Forum Jump:


Users browsing this thread: 1 Guest(s)