public BanMenu(Client client, PlayerMenu parent) : base($"Ban {parent.Player.Name}", parent) { var reason = new MenuItem(client, this, "Ban Reason") { SubLabel = "None Specified" }; reason.Activate += async() => { _reason = await UiHelper.PromptTextInput("", controller : client.Menu); reason.SubLabel = _reason.Length > 16 ? $"{_reason.Substring( 0, 16 )}..." : _reason; }; Add(reason); var length = new MenuItemSpinnerInt(client, this, "Ban Duration", 60, 1, 8192, 1, true); Add(length); var lengthUnit = new MenuItemSpinnerList <string>(client, this, "Ban Duration (Units)", Units.Keys.ToList(), 0, true); Add(lengthUnit); var perma = new MenuItemCheckbox(client, this, "Permanent Ban"); perma.Activate += () => { _perma = !_perma; lengthUnit.IsVisible = length.IsVisible = _perma; return(Task.FromResult(0)); }; Add(perma); var submit = new MenuItem(client, this, "Execute Ban"); submit.Activate += () => { var time = _perma ? int.MinValue : Units.ElementAt((int)lengthUnit.Value).Value *(int)length.Value; client.Menu.CurrentMenu = parent.Parent; parent.Ban(_reason, time); return(Task.FromResult(0)); }; Add(submit); }
public MpMenu(Client client, Menu parent) : base("Multiplayer", parent) { // VOIP var voice = new Menu("Voice Menu", this); var voipRange = new MenuItemSpinnerInt(client, this, "Voice Range (Meters)", -1, -1, 1024, 1); voipRange.ValueUpdate += (val) => { var range = val; if (range == -1) { range = ushort.MaxValue; } Function.Call(Hash.NETWORK_SET_TALKER_PROXIMITY, range * 1f); _voipRange = range; _lastRangeChange = DateTime.UtcNow; return(val); }; voice.Add(voipRange); var voipChannel = new MenuItemSpinnerInt(client, this, "Voice Channel", 0, 0, ushort.MaxValue, 1, true); voipChannel.ValueUpdate += (val) => { if (val == 0) { Function.Call(Hash.NETWORK_CLEAR_VOICE_CHANNEL); } else { Function.Call(Hash.NETWORK_SET_VOICE_CHANNEL, (int)val); } return(val); }; voice.Add(voipChannel); Add(new MenuItemSubMenu(client, this, voice, "Voice Settings")); var plist = new PlayerListMenu(client, this); Add(new MenuItemSubMenu(client, this, plist, "Players")); client.RegisterTickHandler(OnTick); }
public PlayerMenu(Client client, Menu parent) : base("Player Menu", parent) { var heal = new MenuItem(client, this, "Heal Player"); heal.Activate += () => { if (Game.PlayerPed.Health < Game.PlayerPed.MaxHealth) { Game.PlayerPed.Health = Math.Min(100, Game.PlayerPed.MaxHealth); } return(Task.FromResult(0)); }; Add(heal); var armor = new MenuItem(client, this, "Give Armor"); armor.Activate += () => { Game.PlayerPed.Armor = 100; return(Task.FromResult(0)); }; Add(armor); var gaw = new MenuItem(client, this, "Give All Weapons"); gaw.Activate += () => { foreach (WeaponHash weapon in Enum.GetValues(typeof(WeaponHash))) { Game.PlayerPed.Weapons.Give(weapon, 250, false, true); } return(Task.FromResult(0)); }; Add(gaw); var pedModel = new MenuItemSubMenu(client, this, new PlayerPedMenu(client, this), "Change Ped Model"); Add(pedModel); _wantedItem = new MenuItemSpinnerInt(client, this, "Wanted Level", Game.Player.WantedLevel, 0, 5, 1); _wantedItem.ValueUpdate += (val) => { Game.Player.WantedLevel = val; return(val); }; Add(_wantedItem); var neverWanted = new MenuItemCheckbox(client, this, "Never Wanted", NeverWanted) { IsChecked = () => NeverWanted }; neverWanted.Activate += () => { NeverWanted = !NeverWanted; return(Task.FromResult(0)); }; Add(neverWanted); var godMode = new MenuItemCheckbox(client, this, "God Mode") { IsChecked = () => Game.PlayerPed.IsInvincible }; godMode.Activate += () => { Game.PlayerPed.IsInvincible = !Game.PlayerPed.IsInvincible; return(Task.FromResult(0)); }; Add(godMode); var ragdoll = new MenuItemCheckbox(client, this, "Can Ragdoll") { IsChecked = () => Game.PlayerPed.CanRagdoll }; ragdoll.Activate += () => { Game.PlayerPed.CanRagdoll = !Game.PlayerPed.CanRagdoll; return(Task.FromResult(0)); }; Add(ragdoll); var stamina = new MenuItemCheckbox(client, this, "Infinite Stamina"); stamina.Activate += () => { InfiniteStamina = !InfiniteStamina; return(Task.FromResult(0)); }; stamina.IsChecked = () => InfiniteStamina; Add(stamina); var speedMult = new MenuItemSpinnerF(client, this, "Sprint Speed", 1f, 1f, 1.5f, 0.05f); speedMult.ValueUpdate += val => { SpeedMultiplier = val; return(val); }; Add(speedMult); client.RegisterTickHandler(OnTick); }
public VehicleMenu(Client client, Menu parent) : base("Vehicle Menu", parent) { Add(new MenuItemSubMenu(client, this, new VehicleSpawnMenu(client, this), "Spawn Vehicle")); var invincible = new MenuItemCheckbox(client, this, "Invincible", IsInvincible) { IsChecked = () => IsInvincible }; invincible.Activate += () => { IsInvincible = !IsInvincible; return(Task.FromResult(0)); }; Add(invincible); var invisible = new MenuItemCheckbox(client, this, "Invisible", IsInvisible) { IsChecked = () => IsInvisible }; invisible.Activate += () => { IsInvisible = !IsInvisible; return(Task.FromResult(0)); }; Add(invisible); var vehicleColors = new List <VehicleColor>(); foreach (VehicleColor color in Enum.GetValues(typeof(VehicleColor))) { vehicleColors.Add(color); } var primary = new MenuItemSpinnerList <VehicleColor>(client, this, "Primary Color", new List <VehicleColor>(vehicleColors), 0, true); primary.ValueUpdate += (idx) => { var color = primary.Data.ElementAt((int)idx); if (Game.PlayerPed.CurrentVehicle != null) { Game.PlayerPed.CurrentVehicle.Mods.PrimaryColor = color; } return(idx); }; Add(primary); var secondary = new MenuItemSpinnerList <VehicleColor>(client, this, "Secondary Color", new List <VehicleColor>(vehicleColors), 0, true); secondary.ValueUpdate += (idx) => { var color = secondary.Data.ElementAt((int)idx); if (Game.PlayerPed.CurrentVehicle != null) { Game.PlayerPed.CurrentVehicle.Mods.SecondaryColor = color; } return(idx); }; Add(secondary); var pearl = new MenuItemSpinnerList <VehicleColor>(client, this, "Pearlescent Color", new List <VehicleColor>(vehicleColors), 0, true); pearl.ValueUpdate += (idx) => { var color = pearl.Data.ElementAt((int)idx); if (Game.PlayerPed.CurrentVehicle != null) { Game.PlayerPed.CurrentVehicle.Mods.PearlescentColor = color; } return(idx); }; Add(pearl); var license = new MenuItem(client, this, "License Plate"); license.Activate += async() => { var text = await UiHelper.PromptTextInput(Game.PlayerPed.CurrentVehicle?.Mods.LicensePlate, 8, client.Menu); if (Game.PlayerPed.CurrentVehicle != null) { Game.PlayerPed.CurrentVehicle.Mods.LicensePlate = text; } }; Add(license); var styles = new List <LicensePlateStyle>(); foreach (LicensePlateStyle s in Enum.GetValues(typeof(LicensePlateStyle))) { styles.Add(s); } var plateStyle = new MenuItemSpinnerList <LicensePlateStyle>(client, this, "License Plate Style", styles, 0, true); plateStyle.ValueUpdate += (idx) => { var style = plateStyle.Data.ElementAt((int)idx); if (Game.PlayerPed.CurrentVehicle != null) { Game.PlayerPed.CurrentVehicle.Mods.LicensePlateStyle = style; } return(idx); }; Add(plateStyle); var hasNeon = new MenuItemCheckbox(client, this, "Neon Lights", HasNeon); hasNeon.IsChecked = () => HasNeon; hasNeon.Activate += () => { HasNeon = !HasNeon; return(Task.FromResult(0)); }; Add(hasNeon); var neonR = new MenuItemSpinnerInt(client, this, "Neon Color (Red)", NeonColor.R, 0, 255, 1, true); neonR.ValueUpdate += (val) => { NeonColor = Color.FromArgb(val, NeonColor.G, NeonColor.B); return(val); }; Add(neonR); var neonG = new MenuItemSpinnerInt(client, this, "Neon Color (Green)", NeonColor.G, 0, 255, 1, true); neonG.ValueUpdate += (val) => { NeonColor = Color.FromArgb(NeonColor.R, val, NeonColor.B); return(val); }; Add(neonG); var neonB = new MenuItemSpinnerInt(client, this, "Neon Color (Blue)", NeonColor.B, 0, 255, 1, true); neonB.ValueUpdate += (val) => { NeonColor = Color.FromArgb(NeonColor.R, NeonColor.G, val); return(val); }; Add(neonB); Add(new MenuItemVehicleLivery(client, this)); client.RegisterTickHandler(OnTick); }