Exemplo n.º 1
0
        private void WeaponInfo(int source, List <object> args, string raw)
        {
            xPlayer xPlayer = ESX.GetPlayerFromId(source);

            if (args.Count > 0)
            {
                Weapon weapon = xPlayer.GetWeapon(args[0].ToString());
                xPlayer.ShowNotification($"Found weapon: {weapon.name} Tint: {weapon.Raw.tintIndex} Loadoutnum: {xPlayer.GetWeaponLoadoutNum(weapon.name)}");

                if (weapon.components.Count > 0)
                {
                    foreach (string i in weapon.components)
                    {
                        xPlayer.ShowNotification(i);
                    }
                }
                else
                {
                    xPlayer.ShowNotification("This weapon have 0 components");
                }
            }
            else
            {
                xPlayer.ShowNotification("Usage: !WeaponInfo weaponName");
            }
        }
Exemplo n.º 2
0
        private void DelWeapon(int source, List <object> args, string raw)
        {
            xPlayer xPlayer = ESX.GetPlayerFromId(source);

            xPlayer.RemoveWeapon(args[0].ToString());
            xPlayer.ShowNotification($"Deleted {args[0]}");
        }
Exemplo n.º 3
0
        private void AddWeapon(int source, List <object> args, string raw)
        {
            xPlayer xPlayer = ESX.GetPlayerFromId(source);

            xPlayer.AddWeapon(args[0].ToString(), Convert.ToInt32(args[1]));
            xPlayer.ShowNotification($"You have got {args[0]}");
        }
Exemplo n.º 4
0
        private void SaveMe(int source, List <object> args, string raw)
        {
            xPlayer xPlayer = ESX.GetPlayerFromId(source);

            ESX.SavePlayer(xPlayer, new Action(() => {
                Debug.WriteLine("ESX.SavePlayer->SavePlayerCallback()");
            }));
        }
Exemplo n.º 5
0
        private void GetAccounts(int source, List <object> args, string raw)
        {
            xPlayer xPlayer = ESX.GetPlayerFromId(source);

            foreach (Account i in xPlayer.GetAccounts(false))
            {
                xPlayer.ShowNotification($"Account: {i.name} Label: {i.label} Money: {i.money}");
            }
        }
Exemplo n.º 6
0
        private void LoadoutInfo(int source, List <object> args, string raw)
        {
            xPlayer       xPlayer = ESX.GetPlayerFromId(source);
            List <Weapon> loadout = xPlayer.GetLoadout(false);

            foreach (Weapon i in loadout)
            {
                xPlayer.ShowNotification($"Weapon: {i.name} Ammo: {i.ammo}");
            }
        }
Exemplo n.º 7
0
        private void JobExist(int source, List <object> args, string raw)
        {
            bool    exist   = ESX.DoesJobExist(args[0].ToString(), Convert.ToInt32(args[1]));
            xPlayer xPlayer = ESX.GetPlayerFromId(source);

            xPlayer.Raw.triggerEvent("chat:addMessage", new
            {
                color = new[] { 255, 0, 0 },
                args  = new[] { "[JobInfo]", $"{args[0]} ({args[1]}) {exist}" }
            });
        }
Exemplo n.º 8
0
        private void JobInfo(int source, List <object> args, string raw)
        {
            xPlayer xPlayer = ESX.GetPlayerFromId(source);
            Job     Job     = xPlayer.GetJob();

            xPlayer.TriggerEvent("chat:addMessage", new
            {
                color = new[] { 255, 0, 0 },
                args  = new[] { "[JobInfo]", $"Your Job is {Job.name}. Your Grade Is {Job.grade_name}. Your Salary is {Job.grade_salary}" }
            });
        }
Exemplo n.º 9
0
        private void OnResourceStart(string resourceName)
        {
            if (GetCurrentResourceName() != resourceName)
            {
                return;
            }
            RegisterCommand("JobInfo", new Action <int, List <object>, string>(JobInfo), false);
            RegisterCommand("JobExist", new Action <int, List <object>, string>(JobExist), false);

            RegisterCommand("SaveMe", new Action <int, List <object>, string>(SaveMe), false);
            RegisterCommand("SaveAll", new Action <int, List <object>, string>(SaveAll), false);

            RegisterCommand("AddWeapon", new Action <int, List <object>, string>(AddWeapon), false);
            RegisterCommand("DelWeapon", new Action <int, List <object>, string>(DelWeapon), false);

            RegisterCommand("GiveWeaponAmmo", new Action <int, List <object>, string>(GiveWeaponAmmo), false);

            RegisterCommand("WeaponInfo", new Action <int, List <object>, string>(WeaponInfo), false);
            RegisterCommand("LoadoutInfo", new Action <int, List <object>, string>(LoadoutInfo), false);
            RegisterCommand("SetWeaponTint", new Action <int, List <object>, string>(SetWeaponTint), false);

            RegisterCommand("GetAccounts", new Action <int, List <object>, string>(GetAccounts), false);

            RegisterCommand("UseItem", new Action <int, List <object>, string>(UseItem), false);

            RegisterCommand("GetPosition", new Action <int, List <object>, string>(GetPosition), false);

            ESX.RegisterUsableItem("testItem", new Action <int>((int source) => {
                Debug.WriteLine(ESX.GetPlayerFromId(source).GetName() + " used 'testItem'");
            }));
            ESX.RegisterUsableItem("testItem2", new Action <int>((source) =>
            {
                Debug.WriteLine(ESX.GetPlayerFromId(source).GetName() + " used 'testItem2'");
            }));

            ESX.RegisterServerCallback("esx_testScript:testCallBack", new Action <int, CallbackDelegate, dynamic>(TestCallback));
        }
Exemplo n.º 10
0
        private void GiveWeaponAmmo(int source, List <object> args, string raw)
        {
            xPlayer xPlayer = ESX.GetPlayerFromId(source);

            xPlayer.AddWeaponAmmo(args[0].ToString(), Convert.ToInt32(args[1]));
        }
Exemplo n.º 11
0
        private void GetPosition(int source, List <object> args, string raw)
        {
            xPlayer xPlayer = ESX.GetPlayerFromId(source);

            Debug.WriteLine(xPlayer.GetCoords(true).ToString());
        }
Exemplo n.º 12
0
        private void SetWeaponTint(int source, List <object> args, string raw)
        {
            xPlayer xPlayer = ESX.GetPlayerFromId(source);

            xPlayer.SetWeaponTint(args[0].ToString(), Convert.ToInt32(args[1]));
        }