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
#2

Replace "dd" to another name.
Reply
#3

Well? I understand...

What has changed?
Reply
#4

You already have a variable with the terms "dd" so change the variable to something else. Like "dd2" for example... and then just change everything in that function from "dd" to "dd2"
Reply
#5

Thanks man !

Still a problem. When ordering use the player receives a temporary ban than kick.To be because of this?

Код:
Kick(playeri);
Reply
#6

HELP !?
Reply
#7

Quote:
Originally Posted by Mititel
Посмотреть сообщение
Thanks man !

Still a problem. When ordering use the player receives a temporary ban than kick.To be because of this?

Код:
Kick(playeri);
Maybe you need to change
Код:
Kick(playeri);
to
Код:
Kick(playerid);
?
Reply
#8

Do not give ban, just kick.

EDIT:
Код:
C:\Documents and Settings\Administrator\Desktop\New Begin\gamemodes\rpg.pwn(27620) : warning 219: local variable "playerid" shadows a variable at a preceding level
Reply
#9

You did this?
pawn Код:
new playerid;
Reply
#10

Quote:
Originally Posted by ViniBorn
Посмотреть сообщение
You did this?
pawn Код:
new playerid;
Yes. Idem...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)