[HELP] Ban +rep
#1

Hello

i have problem , when i want ban players [ for days]

i write ,EX; /banex [ID :27] [ days : 3 ] [reason : test ] , is sendToclientmessageToall , another reason
Screen : 1. http://imgur.com/ngxAqZi | 2. http://imgur.com/jaScgCo

when i ban Permanent not for days normal work [ cmd :/ban ]
pwn
pawn Код:
CMD:banex(playerid,params[])
{
    new name[MAX_PLAYER_NAME],id,reason,days,giveplayer[MAX_PLAYER_NAME],string[256];
    if(playerVariables[playerid][pAdminLevel] >= 1)
    {
        if (sscanf(params, "uis[30]",id,days,reason))
        {
            SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/banex [playerid] [days(max 14)] [reason]");
            return 1;
        }
        GetPlayerName(playerid, name, sizeof name);
        GetPlayerName(id, giveplayer, sizeof(giveplayer));
        if(playerVariables[id][pAdminLevel] >= 1) return SendClientMessage(playerid, COLOR_ASKQ, "* Nu poti da ban la un admin!");
        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, giveplayer);
                fwrite(tempban, string);
                fclose(tempban);
        }
        format(string, sizeof(string), "AdmCmd: %s was banned by Admin %s, for %d day(s), reason: %s",giveplayer, name, days, reason);
        SendClientMessageToAll(COLOR_LIGHTRED, string);
        SetTimerEx("KickPublic", 1000, 0, "d", id);
    }
    else return SendClientMessage(playerid,COLOR_WHITE,"You are not authorized to use that command");
    return true;
}
stock IsMonth31(month)
{
    switch (month)
    {
        case 1: return 1;
        case 3: return 1;
        case 5: return 1;
        case 7: return 1;
        case 8: return 1;
        case 10: return 1;
        case 12: return 1;
        default: return 0;
    }
    return 0;
}

stock IsMonth29(year)
{
    new y = 2000;
    for(new i = 4; i < 3000; i += 4) if ((y+i) == year) return 1;
    return 0;
}
This KickPublic
pawn Код:
forward KickPublic(playerid);
public KickPublic(playerid) { Kick(playerid); }

new Text3D:vehicle3Dtext;
new
    databaseConnection,
    pingTick,
    adTick,
    vehCount,
    weatherVariables[2],
    gTime[3],
    iGMXTimer,
    iTarget,
    iGMXTick,
    szMediumString[64],
    systemVariables[systemE],
    houseVariables[MAX_HOUSES][houseE],
    Text:textdrawVariables[MAX_TEXTDRAWS],
    jobVariables[MAX_JOBS][jobsE],
    AdminSpawnedVehicles[MAX_VEHICLES],
    assetVariables[MAX_ASSETS][assetsE],
    szQueryOutput[256],
    szMessage[256],
    szSmallString[32],
    atmVariables[MAX_ATMS][atmE],
    result[256],
    szServerWebsite[32],
    szLargeString[1024],
    szPlayerName[MAX_PLAYER_NAME],
    businessVariables[MAX_BUSINESSES][businessE],
    vehicleVariables[MAX_VEHICLES][vehicleE],
    groupVariables[MAX_GROUPS][groupE],
    businessItems[MAX_BUSINESS_ITEMS][businessItemsE],
    playerVariables[MAX_PLAYERS][playervEnum],
    spikeVariables[MAX_SPIKES][spikeE],
    scriptTimers[MAX_TIMERS];
Reply
#2

Bump!
Reply
#3

Please, explain what your problem is.
Reply
#4

Use unix time and your code will become significantly shorter and could perhaps even solve your problem.

pawn Код:
unban time = gettime() + days*86400;
Reply
#5

Quote:
Originally Posted by DiGiTaL_AnGeL
Посмотреть сообщение
Please, explain what your problem is.
Thanks for answer.
i have problem when i ban players , is gived to Player other reason , not reason me i gived , in screen i writen /banex 7 Test , and see what reason he gived : http://imgur.com/jaScgCo

Quote:
Originally Posted by SKAzini
Посмотреть сообщение
Use unix time and your code will become significantly shorter and could perhaps even solve your problem.

pawn Код:
unban time = gettime() + days*86400;
Thanks for answer , and ur help

again bro (
Reply
#6

BuMp!
Reply
#7

noob answer but might help search for the word that appears in your whole GM and see where it is or show us where it is if u didnt find it then ur GM has a ghost xD lol
Reply
#8

Quote:
Originally Posted by youssefehab500
Посмотреть сообщение
noob answer but might help search for the word that appears in your whole GM and see where it is or show us where it is if u didnt find it then ur GM has a ghost xD lol
Just what in the hell have you been smoking?
Reply
#9

Quote:
Originally Posted by Dubya
Посмотреть сообщение
Just what in the hell have you been smoking?
lol.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)