SHARE
TWEET

Untitled

a guest Jul 27th, 2015 255 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Drawing;
  4. using System.Windows.Forms;
  5. using GTA;
  6. using GTA.Native;
  7. using NativeUI;
  8.  
  9. public class MenuExample : Script
  10. {
  11.     private UIMenu mainMenu;
  12.     private UIMenu newMenu;
  13. //  private UIMenuCheckboxItem ketchupCheckbox;
  14. //  private UIMenuListItem dishesListItem;
  15.     private UIMenuItem vehGodmodeOn;
  16.     private UIMenuItem vehGodmodeOff;
  17.     private UIMenuItem vehInvisible;
  18.     private UIMenuItem vehVisible;
  19.     private UIMenuItem destroyEngine;
  20.     private UIMenuItem turnEngineOff;
  21.     private UIMenuItem turnEngineOn;
  22.  
  23.     private MenuPool _menuPool;
  24.  
  25.     public MenuExample()
  26.     {
  27.         Tick += OnTick;
  28.         KeyDown += OnKeyDown;
  29.         _menuPool = new MenuPool();
  30.         mainMenu.OnItemSelect += OnItemSelect;
  31.  
  32.         mainMenu = new UIMenu("Mod Menu V1", "~b~VEHICLE OPTIONS");
  33.         _menuPool.Add(mainMenu);
  34.  
  35.         mainMenu.AddItem(vehGodmodeOn = new UIMenuItem("Godmode ~g~On~w~", "Turn Vehicle Godmode On."));
  36.         mainMenu.AddItem(vehGodmodeOff = new UIMenuItem("Godmode ~r~Off~w~", "Turn Vehicle Godmode Off."));
  37.         mainMenu.AddItem(vehInvisible = new UIMenuItem("Invisible ~g~On~w~", "Turn Your Vehicle Invisible."));
  38.         mainMenu.AddItem(vehVisible = new UIMenuItem("Invisible ~g~Off~w~", "Turn Your Vehicle Visible."));
  39.         mainMenu.AddItem(destroyEngine = new UIMenuItem("Destroy Engine", "Destory Current Vehicles Engine."));
  40.         mainMenu.AddItem(turnEngineOff = new UIMenuItem("Turn Engine ~r~Off~w~", "Turn Current Vehicles Engine Off."));
  41.         mainMenu.AddItem(turnEngineOn = new UIMenuItem("Turn Engine ~g~On~w~", "Turn Current Vehicles Engine On."));
  42.  
  43.         var menuItem = new UIMenuItem("~b~OBJECT ~b~SPAWNER");
  44.         mainMenu.AddItem(menuItem);
  45.         mainMenu.RefreshIndex();
  46.  
  47.         mainMenu.OnItemSelect += OnItemSelect;
  48.  
  49.         newMenu = new UIMenu("Object Spawner", "~b~OBJECT ~b~SPAWNER");
  50.         _menuPool.Add(newMenu);
  51.  
  52.         newMenu.AddItem(new UIMenuItem("---", "---"));
  53.        
  54.         newMenu.RefreshIndex();
  55.         mainMenu.BindMenuToItem(newMenu, menuItem);
  56.  
  57.     }
  58.  
  59.     public void OnItemSelect(UIMenu sender, UIMenuItem selectedItem, int index)
  60.     {
  61.         if (sender != mainMenu || selectedItem != vehGodmodeOn) return;
  62.         {
  63.             Game.Player.Character.CurrentVehicle.IsInvincible = true;
  64.         }
  65.  
  66.         if (sender != mainMenu || selectedItem != vehGodmodeOff) return;
  67.         {
  68.             Game.Player.Character.CurrentVehicle.IsInvincible = false;
  69.         }
  70.  
  71.         if (sender != mainMenu || selectedItem != vehInvisible) return;
  72.         {
  73.             Game.Player.Character.CurrentVehicle.IsVisible = false;
  74.         }
  75.  
  76.         if (sender != mainMenu || selectedItem != vehVisible) return;
  77.         {
  78.             Game.Player.Character.CurrentVehicle.IsVisible = true;
  79.         }
  80.  
  81.         if (sender != mainMenu || selectedItem != destroyEngine) return;
  82.         {
  83.             Game.Player.Character.CurrentVehicle.EngineHealth = 0.0f;
  84.             Game.Player.Character.CurrentVehicle.EngineRunning = false;
  85.         }
  86.  
  87.         if (sender != mainMenu || selectedItem != turnEngineOff) return;
  88.         {
  89.             Game.Player.Character.CurrentVehicle.EngineRunning = false;
  90.         }
  91.  
  92.         if (sender != mainMenu || selectedItem != turnEngineOn) return;
  93.         {
  94.             Game.Player.Character.CurrentVehicle.EngineRunning = true;
  95.         }
  96.     }
  97.  
  98.     public void OnTick(object o, EventArgs e)
  99.     {
  100.         _menuPool.ProcessMenus();
  101.     }
  102.  
  103.     public void OnKeyDown(object o, KeyEventArgs e)
  104.     {
  105.         if (e.KeyCode == Keys.F5) // Our menu on/off switch
  106.         {
  107.             mainMenu.Visible = !mainMenu.Visible;
  108.         }
  109.     }
  110. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top