Problem /tban
#1

Код:
warning 219: local variable "dd" shadows a variable at a preceding level
pawn Код:
if(strcmp(cmd,"/tban", true) == 0)
        {
        if(PlayerInfo[playerid][pAdmin] >=5)
        {
            new tmp2[256];
            tmp=strtok(cmdtext,idx);
            tmp2=strtok(cmdtext,idx);
            if((!strlen(tmp)) || (!strlen(tmp2)) || (!IsNumeric(tmp)) || (!IsNumeric(tmp2)))
            {
                SendClientMessage(playerid,COLOR_GREY,"Foloseste: /tban [id] [zile] [Motiv]");
                return 1;
            }
            if(IsPlayerConnected(playerid))
            {
                new playeri,day,y,m,d,yy,mm,dd,nameme[MAX_PLAYER_NAME];
                playeri = strval(tmp);
                day = strval(tmp2);
                if(IsPlayerConnected(playeri))
                {
                    if(PlayerInfo[playerid][pAdmin] < PlayerInfo[playeri][pAdmin])
                    {
                        SendClientMessage(playerid,COLOR_GREY,"Nu poti bana un admin mai mare ca tine!");
                        return 1;
                    }
                    if(day <= 0)
                    {
                        SendClientMessage(playerid,COLOR_GREY,"Ziua trebuie sa fie mai mare de 0!");
                        return 1;
                    }
                    new length = strlen(cmdtext);
                    while ((idx < length) && (cmdtext[idx] <= ' '))
                    {
                        idx++;
                    }
                    new offset = idx;
                    new result[64];
                    while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                    {
                        result[idx - offset] = cmdtext[idx];
                        idx++;
                    }
                    result[idx - offset] = EOS;
                    GetPlayerName(playeri,nameme,sizeof(nameme));
                    GetPlayerName(playerid,playername,sizeof(playername));
                    GetPlayerName(playeri,sendername,sizeof(sendername));
                    if(!strlen(result))
                    {
                        format(string,sizeof(string),"Adminul %s l-a banat pe %s pentru %d zile. Nerespectare reguli",playername,sendername,day);
                        SendClientMessageToAll(COLOR_LIGHTRED,string);
                    }
                    else
                    {
                        format(string,sizeof(string),"Adminul %s l-a banat pe %s pentru %d zile. Motiv: %s",playername,sendername,day,(result));
                        SendClientMessageToAll(COLOR_LIGHTRED,string);
                    }
                    getdate(y,m,d);
                    dd = d;
                    mm = m;
                    yy = y;
                    dd = dd + day;
                    while(dd > GetDayMount(m,y))
                    {
                        mm++;
                        if(mm > 12)
                        {
                            mm=1;
                            yy++;
                        }
                        dd = dd-GetDayMount(mm,yy);
                    }
                    format(string,sizeof(string),"%d,%d,%d",dd,mm,yy);
                    new File = iniOpen("tempbans.ini");
                    iniSet(File,nameme,string);
                    iniClose(File);
                    Kick(playeri);
                }
                else
                {
                    SendClientMessage(playerid,COLOR_GREY,"Nu exista acest player!");
                }
            }
        }
        else
        {
            SendClientMessage(playerid,COLOR_GREY,"Nu ai acces la aceasta comanda!");
        }
        return 1;
    }
Reply


Messages In This Thread
Problem /tban - by Mititel - 06.08.2014, 19:54
Re: Problem /tban - by ViniBorn - 06.08.2014, 20:03
Re: Problem /tban - by Mititel - 06.08.2014, 20:26
Re: Problem /tban - by Blademaster680 - 06.08.2014, 20:39
Re: Problem /tban - by Mititel - 06.08.2014, 21:13
Re: Problem /tban - by Mititel - 07.08.2014, 10:29
Re: Problem /tban - by Tadas - 07.08.2014, 10:30
Re: Problem /tban - by Mititel - 07.08.2014, 11:21
Re: Problem /tban - by ViniBorn - 07.08.2014, 12:30
Re: Problem /tban - by Mititel - 07.08.2014, 13:15

Forum Jump:


Users browsing this thread: 1 Guest(s)