1. Šis tinklalapis naudoja slapukus. Tęsdami būvimą šiame tinklalapyje, jūs patvirtinate, jog sutinkate priimti slapukus. Sužinoti daugiau.

Padekit del warningu ir eroru

Diskusija 'Serverio kūrimas' skyriuje nuo nelixus, Gruodis 23, 2014.

  1. nelixus

    nelixus Narys

    Užsiregistravęs:
    Balandis 18, 2014
    Pranešimai:
    115
    Taškai už trofėjus:
    26
    Lytis:
    Vyras
    Įvertinimai:
    +0 / 0 / -0
    erorai ir warningai:
    Kodas (pawn):
    D:\LERG.LT\gamemodes\LERG.pwn(30) : warning 219: local variable "name" shadows a variable at a preceding level
    D:\LERG.LT\gamemodes\LERG.pwn(189) : warning 219: local variable "name" shadows a variable at a preceding level
    D:\LERG.LT\gamemodes\LERG.pwn(205) : warning 219: local variable "name" shadows a variable at a preceding level
    D:\LERG.LT\gamemodes\LERG.pwn(251) : error 010: invalid function or declaration
    D:\LERG.LT\gamemodes\LERG.pwn(253) : error 010: invalid function or declaration
    D:\LERG.LT\gamemodes\LERG.pwn(258) : error 021: symbol already defined: "GetPlayerName"
    D:\LERG.LT\gamemodes\LERG.pwn(261) : error 010: invalid function or declaration
    D:\LERG.LT\gamemodes\LERG.pwn(263) : error 010: invalid function or declaration
    D:\LERG.LT\gamemodes\LERG.pwn(267) : error 021: symbol already defined: "name"
    D:\LERG.LT\gamemodes\LERG.pwn(267) : error 021: symbol already defined: "string"
    D:\LERG.LT\gamemodes\LERG.pwn(273) : error 010: invalid function or declaration
    D:\LERG.LT\gamemodes\LERG.pwn(278) : warning 219: local variable "name" shadows a variable at a preceding level
    D:\LERG.LT\gamemodes\LERG.pwn(297) : warning 219: local variable "name" shadows a variable at a preceding level
    D:\LERG.LT\gamemodes\LERG.pwn(333) : warning 203: symbol is never used: "name"
    D:\LERG.LT\gamemodes\LERG.pwn(333) : warning 203: symbol is never used: "string"
    gm kodas:
    Kodas (pawn):
    //include's
    #include <a_samp>
    #include "filelist"
     
    //spalvu defina'i
    #define COLOR_ORANGE    0xFF9900AA
    #define COLOR_YELLOW    0xFFFF00AA
    #define GREEN            0x33AA33AA
    #define GREY            0xB4B5B7FF
    #define RED            0xAA3333AA
    #define YELLOW            0xFFFF00AA
    #define ORANGE          0xFF8C00AA
     
    //forwarda'i
    forward TheTime();
     
    //newa'i
    new Text:Laikrodis;
    new Hour,Minute,Second;
     
    main()
    {
        print("\n\n\n");
        print("LERG - Lietuvos Ekonominis Realus Gyvenimas");
    }
     
    public OnPlayerConnect(playerid)
    {
    TextDrawShowForPlayer(playerid, Laikrodis);
    new name[MAX_PLAYER_NAME],file[128];
    GetPlayerName(playerid,name,sizeof(name));
    format(file,sizeof(file),"saves/user/%s.ini",name);
    if(!fexist(file)){ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"{ffffff}[LERG.LT] {FF0000}Registracija.", "{ffffff}Labas!,\n\nApcioje rasykite savo busima slaptazodi ir spauskite ''{FF0000}Registruotis{ffffff}''\n\nSekmes pradedant nauja gyvenima!","Registruotis","Iseiti");}
    if(fexist(file)){ShowPlayerDialog(playerid,2,DIALOG_STYLE_PASSWORD,"{ffffff}[LERG.LT] {FF0000}Prisijungimas.", "{ffffff}Sveikas sugryzes!,\n\nApacioje rasykite savo slaptazodi ir tada ''{FF0000}Prisijungti{ffffff}''\n\nLinkime sekmes serveryje ir gerai praleiskite laika!","Prisijungti","Iseiti");}
     
        //TextDrawShowForPlayer(playerid,lbt);
        //TextDrawShowForPlayer(playerid,lbb);
     
    if(IsPlayerNPC(playerid)) return 1;
     
        playerDB[playerid][vedelogin] = false;
     
    return 1;
    }
    stock GetGender(skin)
    {
        new gender;
        switch(skin)
        {
            case 76: gender=2;
            case 33: gender=2;
            case 190: gender=2;
            case 141: gender=2;
            case 211: gender=2;
            case 219: gender=2;
            case 193: gender=2;
            default: gender=1;
        }
        return gender;
    }
    public OnPlayerRequestSpawn(playerid)
    {
    if(IsPlayerNPC(playerid)) return 1;
     
        if(playerDB[playerid][authstate]==0){SendClientMessage(playerid,GREY,"{9ab7ff}Pirmiausia turite prisijungti. {ffffff}Tai trunka vos kelias sekundes !"); return 0;}
        if(playerDB[playerid][vedelogin] == 0){SendClientMessage(playerid,GREY,"{9ab7ff}Pirmiausia turite prisijungti. {ffffff}Tai trunka vos kelias sekundes !"); Kick(playerid); return 0;}    if(!playerDB[playerid][vedelogin]){SendClientMessage(playerid,GREY,"* Pirmiausia turite prisijungti, tai trunka vos kelias sek.!"); return 0;}
        //Zaidejas katik prisijunge! Ir yra registruotas, reikia loadint info!
        if(playerDB[playerid][authstate]!=2) return 1;
        return 1;
    }
     
    public OnPlayerSpawn(playerid){
        playerDB[playerid][zaidzia] = true;
        StopAudioStreamForPlayer(playerid);
        //TextDrawHideForPlayer(playerid,lbt);
        //TextDrawHideForPlayer(playerid,lbb);
        //TextDrawShowForPlayer(playerid, Pagr);
        //Animaciju uzkrovimas | Visada
        PreloadAnimLib(playerid,"ON_LOOKERS");
        PreloadAnimLib(playerid,"ped");
        PreloadAnimLib(playerid, "BEACH");
        PreloadAnimLib(playerid, "benchpress");
        PreloadAnimLib(playerid, "CAR");
        PreloadAnimLib(playerid, "CARRY");
        PreloadAnimLib(playerid, "CAMERA");
        PreloadAnimLib(playerid, "COP_AMBIENT");
        PreloadAnimLib(playerid, "DODGE");
        PreloadAnimLib(playerid, "POLICE");
        PreloadAnimLib(playerid, "PARK");
        PreloadAnimLib(playerid, "GRAVEYARD");
        PreloadAnimLib(playerid, "KISSING");
        PreloadAnimLib(playerid, "GANGS");
        PreloadAnimLib(playerid, "DAM_JUMP");
        PreloadAnimLib(playerid, "MISC");
        PreloadAnimLib(playerid, "HEIST9");
        PreloadAnimLib(playerid, "PAULNMAC");
        PreloadAnimLib(playerid, "VENDING");
        PreloadAnimLib(playerid,"SMOKING");
     
     
        if(playerDB[playerid][vedelogin] == 0){SendClientMessage(playerid,GREY,"* Pirmiausia turite prisijungti, tai trunka vos kelias sek.!");Kick(playerid); return 0;}
        //Save ikelimas | Jei zaidejas prisijunge
        if(playerDB[playerid][authstate]==2)
        {
            LoadPlayerData(playerid);
            playerDB[playerid][authstate]=4;
            SetPlayerColor(playerid,PLAYCOL_HIDDEN);
          }else{
              if(!playerDB[playerid][uniformd])
              {
                playerDB[playerid][drabuziai] = GetPlayerSkin(playerid);
                  playerDB[playerid][lytis] = GetGender(playerDB[playerid][drabuziai]);
            }
          }
     
    if(playerDB[playerid][vip])
    {
    SetPlayerColor(playerid, 0x40FF40FF);
    }
    if(playerDB[playerid][specialybe]==3)
    {
    SetPlayerColor(playerid, COLOR_YELLOW);
    }
     
        //Zinute ir pradiniai pinigai | Jei zaidejas ka tik uzsiregistravo
        if(playerDB[playerid][naujokas]==1)
        {
            SendClientMessage(playerid,ORANGE,"{ffffff}Sveiki atvykæ á [ {ffd0dd}JûsøPavadinimas ] {ffffff}sa-mp serverá!");
            SendClientMessage(playerid,ORANGE,"{ffffff}Daugiau informacijos suþinosi þaisdamas!");
            SendClientMessage(playerid,ORANGE,"{ffffff}Gal jums reikia taxi ? Ji galite iðsikviesti {e3ffd0}/kviesti taxi");
            SendClientMessage(playerid,ORANGE,"{ffffff}Linkime prasmingai praleisti laikà!");
            GivePlayerMoneyA(playerid,10000);
            SetPlayerScore(playerid,100);
            playerDB[playerid][drabuziai] = GetPlayerSkin(playerid);
            SavePlayerData(playerid);
            playerDB[playerid][naujokas] = false;
        }
     
        //Givybes ir lytis | Jei zaidejas jau buvo prisijunges arba uzsiregistravo
        if(playerDB[playerid][authstate]!=2)
        {
            SetPlayerHealth(playerid,40+random(100));
            PlayerPlaySound(playerid, 1150, 257.6206, -41.5307, 1002.0234);// Garsas
        }
     
        //Spalva ir patvirtinimas | Jei zaidejas ka tik uzsiregistravo ar prisijunge
        if(playerDB[playerid][authstate] <2)
        {
            SetPlayerColor(playerid,PLAYCOL_HIDDEN);
            playerDB[playerid][authstate]=3;
        }
     
        //Jei zaidejas mire kalejime arba paliko zaidima budamas ten, jis grizta
          if (playerDB[playerid][ikalintas])
        {
            SetPlayerPos(playerid,3105.2039,-822.8423,11.0758);
        }
     
        return 1;
    }
    public OnPlayerDisconnect(playerid, reason)
    {
        TextDrawHideForPlayer(playerid, Laikrodis);
        if(playerDB[playerid][authstate] == 3)
        {
              SavePlayerData(playerid);
        }
        return 1;
    }
    public OnPlayerRequestClass(playerid, classid)
    {
    if(IsPlayerNPC(playerid)) return 1;
        SetPlayerFacingAngle(playerid,250.7573);
        SetPlayerPos(playerid,1703.7034,-1752.7939,69.2742);
        SetPlayerCameraPos(playerid,1703.7034,-1752.7939,69.2742);
        SetPlayerCameraLookAt(playerid,1699.5504,-1747.1743,67.9847);
        PlayerPlaySound(playerid, 1138, 257.6206, -41.5307, 1002.0234);// Garsas
        return 1;
    }
     
     
     
    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
        if(dialogid == 1)
        {
              if(response)
              {
            new name[MAX_PLAYER_NAME],file[128];
            GetPlayerName(playerid,name,sizeof(name));
            format(file,sizeof(file),"saves/user/%s.ini",name);
            dini_Create(file);
            dini_IntSet(file,"slaptazodis",tohash(inputtext));
            format(file,sizeof(file)," Jus uzregistruotas, aciu kad pasirinkote musu serveri. (slaptazodis: %s)",inputtext);
            SendClientMessage(playerid,YELLOW,file);
            playerDB[playerid][naujokas]=true;
            ShowPlayerDialog(playerid, 3, DIALOG_STYLE_MSGBOX, "Pasirinkite Lyti", "Pasirinkite Lyti", "Vyras", "Moteris");
              }
              return 1;
        }
        else if(dialogid == 2)
    {
    if(response)
    {
            new name[MAX_PLAYER_NAME],file[128];
            GetPlayerName(playerid,name,sizeof(name));
            format(file,sizeof(file),"saves/user/%s.ini",name);
            if(CheckPass(file,inputtext))
            {
                playerDB[playerid][vedelogin] = true;
                new exp = dini_Int(file,"Xp");
                if(dini_Int(file,"Mg1") == 1) playerDB[playerid][mg1]=true;
                if(dini_Int(file,"Mg2") == 1) playerDB[playerid][mg2]=true;
                if(dini_Int(file,"Mg3") == 1) playerDB[playerid][mg3]=true;
                if(dini_Int(file,"Mg4") == 1) playerDB[playerid][mg4]=true;
                if(dini_Int(file,"Mg5") == 1) playerDB[playerid][mg5]=true;
                if(dini_Int(file,"Mg6") == 1) playerDB[playerid][mg6]=true;
                if(dini_Int(file,"Mg7") == 1) playerDB[playerid][mg7]=true;
                if(dini_Int(file,"Mg8") == 1) playerDB[playerid][mg8]=true;
                if(dini_Int(file,"Mg9") == 1) playerDB[playerid][mg9]=true;
                if(dini_Int(file,"Mg10") == 1) playerDB[playerid][mg10]=true;
                if(dini_Int(file,"Mg11") == 1) playerDB[playerid][mg11]=true;
                if(dini_Int(file,"Mg12") == 1) playerDB[playerid][mg12]=true;
                if(dini_Int(file,"Mg13") == 1) playerDB[playerid][mg13]=true;
                if(dini_Int(file,"Mg14") == 1) playerDB[playerid][mg14]=true;
                if(dini_Int(file,"Mg15") == 1) playerDB[playerid][mg15]=true;
                if(dini_Int(file,"Mg16") == 1) playerDB[playerid][mg16]=true;
                if(dini_Int(file,"Mg17") == 1) playerDB[playerid][mg17]=true;
                if(dini_Int(file,"Mg18") == 1) playerDB[playerid][mg18]=true;
                if(dini_Int(file,"Mg19") == 1) playerDB[playerid][mg19]=true;
                if(dini_Int(file,"Mg20") == 1) playerDB[playerid][mg20]=true;
                if(dini_Int(file,"Mg21") == 1) playerDB[playerid][mg21]=true;
     
                if(!playerDB[playerid][admin]){
                    PlayerPlaySound(playerid, 1150, 257.6206, -41.5307, 1002.0234);// Garsas
                    SendClientMessage(playerid,ORANGE,"* Sveiki! Jus prisijungete, galite testi!");
                    }
                if(exp == -1){playerDB[playerid][authstate]=1;} else{
                playerDB[playerid][authstate]=2;}
                return 1;
            }
            SendClientMessage(playerid,RED,"Slaptaþodis netinka ðiam varotojui!");
            ShowPlayerDialog(playerid,8,DIALOG_STYLE_PASSWORD,"{ffffff}[JûsøPavadinimas] {FF0000}Prisijungimas.","{ffffff}Sveikas sugryþæs!,\n\nApaèioje raðykite savo slaptaþodá ir tada ''{FF0000}Prisijungti{ffffff}''\n\nLinkime sëkmës serveryje ir gerai praleiskitæ laikà!","Prisijungti","Iðeiti");
            playerDB[playerid][vedelogin] = false;
            return 1;
        }
        return 1;
        }
              return 1;
        }
        if(dialogid == 3) //Jei dialogid bus lygus 1
        {
            if(!response) //Jei paspaude mygtuka ne
            {
                SetPlayerSkin(playerid, 91);
                playerDB[playerid][lytis] = 0;
                new name[24],string[128];
                GetPlayerName(playerid,name,sizeof(name));
                format(string,sizeof(string),"Jûs uþregistruotas.\nPrisijunkite ávesdami slaptaþodá:");
                ShowPlayerDialog(playerid,2,DIALOG_STYLE_PASSWORD,"Prisijungimas",string,"Prisijungti","Iðeiti");
                return 1;
            }
            if(response) //Jei paspaude mygtuka taip.
            {
                SetPlayerSkin(playerid, 25);
                playerDB[playerid][lytis] = 1;
                new name[24],string[128];
                GetPlayerName(playerid,name,sizeof(name));
                format(string,sizeof(string),"Jûs uþregistruotas.\nPrisijunkite ávesdami slaptaþodá:");
                ShowPlayerDialog(playerid,2,DIALOG_STYLE_PASSWORD," Prisijungimas",string,"Prisijungti","Iðeiti");
              }
        }
        return 1;
    }
     
    stock LoadPlayerData(playerid)
    {
        new name[21], file[36];
        GetPlayerName(playerid, name, 21);
        format(file, 36, "saves/user/%s.ini", name);
        if(!dini_Exists(file))
        {
              printf("LOAD: Profilis 'saves/user/%s.ini' neegzistuoja.", name);
              return 1;
        }
        GameTextForPlayer(playerid, "~r~] Kraunamas Tavo Zaidimas ]", 1000, 5);
        SetPlayerScore(playerid, dini_Int(file, "Xp"));
        SetPlayerPos(playerid, dini_Float(file, "pos_X"), dini_Float(file, "pos_Y"), dini_Float(file, "pos_Z"));
        SetPlayerInterior(playerid, dini_Int(file, "Interior"));
        SetPlayerWantedLevel(playerid, dini_Int(file, "Wanted"));
        GameTextForPlayer(playerid, "~r~] Tavo Zaidimas Ikeltas ]", 1000, 5);
        return 1;
    }
     
    stock SavePlayerData(playerid)
    {
        new name[21], file[36];
        GetPlayerName(playerid, name, 21);
        format(file, 36, "saves/user/%s.ini", name);
        if(dini_Exists(file))//jeigu failas egzistuoja
        {
            printf("Saugojam zaidejo profilá", name);
            return 1;
        }
        if(!dini_Exists(file))//jeigu neegzistuoja.
        {
              printf("SAVE: Profilis 'saves/user/%s.ini' neegzistuoja.", name);
              return 1;
        }
        //saugojimas
     
        return 1;
    }
    public TheTime()
    {
        new timestr[10];
        gettime(Hour, Minute, Second);
        format(timestr, sizeof(timestr), "%02d:%02d:%02d", Hour, Minute, Second);
        TextDrawSetString(Laikrodis, timestr);
        return 1;
    }
    stock GivePlayerMoneyA(playerid,money)
    {
     
        new rmoney = GetPlayerMoney(playerid);
        if( rmoney < playerDB[playerid][pinigai] && rmoney > -1 ) playerDB[playerid][pinigai]=rmoney;
     
        playerDB[playerid][pinigai]+=money;
        ResetPlayerMoney(playerid);
        GivePlayerMoney(playerid,playerDB[playerid][pinigai]);
    }
     
     
  2. nelixus

    nelixus Narys

    Užsiregistravęs:
    Balandis 18, 2014
    Pranešimai:
    115
    Taškai už trofėjus:
    26
    Lytis:
    Vyras
    Įvertinimai:
    +0 / 0 / -0
    up
     

Dalintis šiuo puslapiu

Kraunama...