Example #1
0
        public void loadPlayerMoney(int id)
        {
            Player player            = new PlayerList()[id];
            var    licenseIdentifier = player.Identifiers["steam"];

            MYSQL.FetchAll($"SELECT * FROM playermoney WHERE steamid = '{licenseIdentifier}'", null, (List <dynamic> list) =>
            {
                Debug.WriteLine("3");
                int money_      = 1000;
                int bank_       = 5000;
                int dirtyMoney_ = 0;
                int count       = (list == null) ? 0 : list.Count;
                if (count == 0)
                {
                    MYSQL.execute($"INSERT INTO playermoney (steamid,money,bank,dirty_money) VALUES ('{licenseIdentifier}','{money_}','{bank_}','{dirtyMoney_}');");
                    Debug.WriteLine($"Vytvarim hrace: {player.Name} [MONEYSYSTEM]");
                }
                else
                {
                    money_      = list[0].money;
                    bank_       = list[0].bank;
                    dirtyMoney_ = list[0].dirty_money;
                    Debug.WriteLine($"Nacitam hrace: {player.Name} [MONEYSYSTEM]");
                }
                PlayerMoney money = new PlayerMoney();

                money.setPlayer(player);

                money.setMoney(money_);
                money.setBankMoney(bank_);
                money.setDirtyMoney(dirtyMoney_);

                PlayerMoneyHolder.saveMoneyPlayerToList(id, money);
            });
        }
Example #2
0
        public static void loadPlayerJob(int source)
        {
            Player player = new PlayerList()[source];
            string job    = "unemployed";
            string grade  = "unemployed";

            var licenseIdentifier = player.Identifiers["steam"];

            MYSQL.FetchAll($"SELECT * FROM playerjob WHERE steamid = '{licenseIdentifier}'", null, (List <dynamic> list) =>
            {
                int count = (list == null) ? 0 : list.Count;
                if (count == 0)
                {
                    MYSQL.execute($"INSERT INTO playerjob (name,grade,steamid) VALUES ('{job}','{grade}','{licenseIdentifier}');");
                    Debug.WriteLine("Zapisuju nového hráče do tabulky 'PlayerJob'");
                }
                else
                {
                    job   = list[0].name;
                    grade = list[0].grade;
                }

                player.TriggerEvent("xCore:client:LoadJob", job, grade);
                PlayerJob pJob = new PlayerJob();
                pJob.setPlayer(player);

                pJob.setPlayerJob(job, grade);
                PlayerJobHolder.savePlayerToList(source, pJob);
            });
        }
Example #3
0
File: main.cs Project: nxxnly/xCore
 public void setJobCommand(int id, string name, int grade, dynamic result)
 {
     MYSQL.FetchAll($"SELECT * FROM jobgrades WHERE name = '{name}' AND grade ='{grade}'", null, (List <dynamic> list) =>
     {
         int count = (list == null) ? 0 : list.Count;
         if (count == 0)
         {
             result(false);
         }
         else
         {
             Debug.WriteLine($"{ list[0].name},{list[0].position}");
             TriggerEvent("xCore:Server:setJob", id, list[0].name, list[0].position);
             result(true);
         }
     });
 }
Example #4
0
        public static void loadPlayerGroup(int source)
        {
            Player player            = new PlayerList()[source];
            var    licenseIdentifier = player.Identifiers["steam"];

            MYSQL.FetchAll($"SELECT * FROM groupusers WHERE steamid = '{licenseIdentifier}'", null, (List <dynamic> list) =>
            {
                PlayerGroup pGroup = new PlayerGroup();
                pGroup.setPlayer(player);
                int count = (list == null) ? 0 : list.Count;
                if (count != 0)
                {
                    for (int i = 0; i < count; i++)
                    {
                        pGroup.add(list[i].group);
                    }
                }
                PlayerGroupHolder.saveGroupToList(player, pGroup);
            });
        }