Exemplo n.º 1
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);
            });
        }
Exemplo n.º 2
0
        public void setJob(int source, string jobName, string grade)
        {
            PlayerJob job = PlayerJobHolder.getPlayerJob(source);

            job.setPlayerJob(jobName, grade);
        }