Jump to content
  • 0

intrebare


SaLiErY

Question

8 answers to this question

Recommended Posts

if(strcmp(cmd, "/tempban", true) == 0)
        {
                if (IsPlayerAdmin(playerid))
                {
                        tmp = strtok(cmdtext,idx);
                        if(!strlen(tmp))
                        {
                                SendClientMessage(playerid, ORANGE, "USAGE: /tempban [playerid] [day] [reason]");
                                SendClientMessage(playerid, ORANGE, "FUNCTION: Temporarily bans a player. You must enter the month, day and hour numbers. You set them, not add.");
                                return 1;
                        }
                        giveplayerid = ReturnUser(tmp);
                        new string[128];
                        if(IsPlayerConnected(giveplayerid))
                        {
                            tmp = strtok(cmdtext, idx);
                            if (!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /tempban [playerid] [day] [reason]");
                                new days = strval(tmp);
                                new reason[128];
                                reason = bigstr(cmdtext, idx);
                                if (!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /tempban [playerid] [day] [REASON]");
                                new ip[15];
                                GetPlayerIp(giveplayerid,ip,15);
                                GetPlayerName(playerid, name, sizeof name);
                                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                                new File:tempban = fopen("TempBans.ban", 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] -|",name,giveplayer,days,reason);
                                SendClientMessageToAll(ADMIN_RED,string);
                                Kick(giveplayerid);
                        }
                        else
                        {
                                format(string, sizeof(string), "%d is not an active player.", giveplayerid);
                                SendClientMessage(playerid, RED, string);
                        }
                }
                else return SendClientMessage(playerid, RED, "You are not an admin.");
                return true;
        }
        return false;
}

Link to comment
Share on other sites

Pai este si pentru adminii de level mai mare ca 1.

Uita-te la semnul asta >= . Ti se pare cunoscut, iti suna cunoscut? E ca la matematica (numai ca acolo se scrie altfel). Semnul asta reprezinta ca "e mai mare sau egal cu ... "

Acuma ai inteles? Daca nu iti caut toate semnele astea.

logo.png

ATENTIE!!! Nu imi trimiteti mesaje private care au legatura cu scriptingul. NU mai scriptez.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.