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"); } }
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]}"); }
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]}"); }
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()"); })); }
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}"); } }
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}"); } }
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}" } }); }
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}" } }); }
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)); }
private void GiveWeaponAmmo(int source, List <object> args, string raw) { xPlayer xPlayer = ESX.GetPlayerFromId(source); xPlayer.AddWeaponAmmo(args[0].ToString(), Convert.ToInt32(args[1])); }
private void GetPosition(int source, List <object> args, string raw) { xPlayer xPlayer = ESX.GetPlayerFromId(source); Debug.WriteLine(xPlayer.GetCoords(true).ToString()); }
private void SetWeaponTint(int source, List <object> args, string raw) { xPlayer xPlayer = ESX.GetPlayerFromId(source); xPlayer.SetWeaponTint(args[0].ToString(), Convert.ToInt32(args[1])); }