Esempio n. 1
0
 private void GetPeds(int source, List <object> args, string raw)
 {
     foreach (Ped i in ESX.Game.GetPeds())
     {
         ESX.ShowNotification($"{i.Handle} ({i.Gender})");
     }
 }
Esempio n. 2
0
 private void GetVehicles(int source, List <object> args, string raw)
 {
     foreach (Vehicle i in ESX.Game.GetVehicles())
     {
         ESX.ShowNotification($"{i.Handle} ({i.Mods.LicensePlate})");
     }
 }
Esempio n. 3
0
 private void GetPlayers(int source, List <object> args, string raw)
 {
     foreach (Player i in ESX.Game.GetPlayers())
     {
         ESX.ShowNotification($"{i.Name} ({i.ServerId})");
     }
 }
Esempio 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()");
            }));
        }
Esempio n. 5
0
 private async void HudTest(int source, List <object> args, string raw)
 {
     for (int i = 0; i < 224; i++)
     {
         ESX.ShowNotification($"{i}", (HudColor)i);
         await Delay(1000);
     }
 }
Esempio n. 6
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}");
            }
        }
Esempio n. 7
0
 private void TestTrigger(int source, List <object> args, string raw)
 {
     ESX.TriggerServerCallback("esx_testScript:testCallBack", new Action <dynamic>((param) =>//param is parsed from the server
     {
         Debug.WriteLine($"CLIENT.TESTCALLBACK {param.test[0]} {param.test[1]} {param.other} {param.tempData.Count}");
     }), new {
         cucc = new[] { "asd", "sad" }
     });
 }
Esempio n. 8
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}");
            }
        }
Esempio n. 9
0
        private async void AdvancedHudTest(int source, List <object> args, string raw)
        {
            IconType[] icons = { IconType.ChatBox, IconType.AddFriendRequest, IconType.Dollar, IconType.Email, IconType.RightJumpingWindow, IconType.RP };

            for (int i = 0; i < 166; i++)
            {
                NotificationPicture pic = (NotificationPicture)i;
                ESX.ShowAdvancedNotification("Nexd", "~h~F*!K YOU~h~", $"N: ~h~{i}~h~~n~~h~~g~{pic}~h~", pic, icons[GetRandomIntInRange(0, 6)], true, true, (HudColor)i);
                await Delay(2000);
            }
        }
Esempio n. 10
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}" }
            });
        }
Esempio n. 11
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}" }
            });
        }
Esempio n. 12
0
        private void DialogMenuTest(int source, List <object> args, string raw)
        {
            ESX.UI.Menu.CloseAll();

            ESX.UI.Menu.Open("dialog", GetCurrentResourceName(), "dialog_menu", new ESX.UI.MenuData
            {
                title = "Dialog Menu Title"
            }, new Action <dynamic, dynamic>((data, menu) => {  //Submit
                ESX.ShowNotification($"{data.value}");
            }), new Action <dynamic, dynamic>((data, menu) => { //Cancel
                menu.close();
            }));
        }
Esempio n. 13
0
        private void DefaultMenuTest(int source, List <object> args, string raw)
        {
            ESX.UI.Menu.CloseAll();

            List <ESX.UI.MenuElement> menuElements = new List <ESX.UI.MenuElement>();

            menuElements.Add(new ESX.UI.MenuElement
            {
                label  = "First label",
                value  = "First value",
                custom = new //custom data that we want to pass to the callbacks
                {
                    test = new[] { "asd", "sad" },
                    tap  = "tap"
                }
            });
            menuElements.Add(new ESX.UI.MenuElement
            {
                label = "Second label",
                value = "Second value"
            });
            for (int i = 0; i < 10; i++) //random elements
            {
                menuElements.Add(new ESX.UI.MenuElement
                {
                    label = $"{i} item",
                    value = $"{i} value"
                });
            }

            ESX.UI.Menu.Open("default", GetCurrentResourceName(), "default_menu", new ESX.UI.MenuData
            {
                title    = "Default Menu Title",
                align    = "top-right",
                elements = menuElements
            }, new Action <dynamic, dynamic>((data, menu) => { //Submit
                if (data.current.value == "First value")
                {
                    ESX.ShowNotification($"{data.current.custom.test[0]} {data.current.custom.test[1]}"); //output: asd sad
                    ESX.ShowNotification($"{data.current.custom.tap}");                                   //output: tap
                }
            }), new Action <dynamic, dynamic>((data, menu) => {                                           //Cancel
                menu.close();
            }));
        }
Esempio n. 14
0
        private void SpawnVehicle(int source, List <object> args, string raw)
        {
            string model = "zentorno";

            if (args.Count > 0)
            {
                model = args[0].ToString();
            }

            int hash = GetHashKey(model);

            Ped PlayerPed = new Ped(GetPlayerPed(source));

            ESX.Game.SpawnVehicle(hash, PlayerPed.Position, PlayerPed.Heading, new Action <int>((vehicleHandle) => {
                Vehicle vehicle = new Vehicle(vehicleHandle);
                VehicleProperties vehicleProperties = ESX.Game.GetVehicleProperties(vehicleHandle);//or vehicle.Handle

                vehicleProperties.color1 = VehicleColor.Blue;
                ESX.Game.SetVehicleProperties(vehicle, vehicleProperties);
                ESX.ShowNotification($"{vehicle.Handle} {vehicle.Mods.LicensePlate} {vehicleProperties.color1}");
            }));
        }
Esempio n. 15
0
        private void ListMenuTest(int source, List <object> args, string raw)
        {
            ESX.UI.Menu.CloseAll();

            ESX.UI.Menu.Open("list", GetCurrentResourceName(), "list_menu", new ESX.UI.MenuData(new
            {
                title = "List Menu Title",
                head  = new[] { "First", "Second", "Third" },
                rows  = new
                {
                    data = "Random",
                    cols = new[]
                    {
                        "WILL", "BE", "{{FINISHED|OnFinished()}} {{SOON|OnSoon()}}"
                    }
                }
            }), new Action <dynamic, dynamic>((data, menu) => { //Submit
                ESX.ShowNotification($"{data.value}");
            }), new Action <dynamic, dynamic>((data, menu) => { //Cancel
                menu.close();
            }));
        }
Esempio n. 16
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));
        }
Esempio n. 17
0
        private void GetPlayerData(int source, List <object> args, string raw)
        {
            PlayerData data = ESX.GetPlayerData();

            foreach (Account i in data.accounts)
            {
                ESX.ShowNotification($"{i.name}: {i.money}");
            }

            if (data.loadout.Count > 0)
            {
                foreach (Nexd.ESX.Shared.Weapon i in data.loadout)
                {
                    ESX.ShowNotification($"{i.name} {i.ammo}");
                }
            }
            else
            {
                ESX.ShowNotification("Your loadout is empty");
            }

            if (data.inventory.Count > 0)
            {
                foreach (InventoryItem i in data.inventory)
                {
                    ESX.ShowNotification($"{i.name} {i.count}");
                }
            }
            else
            {
                ESX.ShowNotification("Your inventory is empty");
            }

            ESX.ShowNotification($"{data.coords.X} {data.coords.Y} {data.coords.Z} {data.heading}");
            ESX.ShowNotification($"{data.job.name} Salary: {data.job.grade_salary}");
        }
Esempio n. 18
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]));
        }
Esempio n. 19
0
        private void GetPosition(int source, List <object> args, string raw)
        {
            xPlayer xPlayer = ESX.GetPlayerFromId(source);

            Debug.WriteLine(xPlayer.GetCoords(true).ToString());
        }
Esempio n. 20
0
 private void UseItem(int source, List <object> args, string raw)
 {
     ESX.UseItem(source, args[0].ToString());
 }
Esempio n. 21
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]));
        }
Esempio n. 22
0
 private void SaveAll(int source, List <object> args, string raw)
 {
     ESX.SavePlayers(new Action(() => {
         Debug.WriteLine("ESX.SavePlayers->SavePlayerCallback()");
     }));
 }
Esempio n. 23
0
        private void VehicleInfo(int source, List <object> args, string raw)
        {
            Vehicle vehicle = new Vehicle(GetVehiclePedIsIn(GetPlayerPed(source), false));

            ESX.ShowNotification($"{ESX.Game.GetVehicleProperties(vehicle).plate}");
        }