jpm1 Posted November 11, 2014 Share Posted November 11, 2014 (edited) i'm trying to do a menu . i found a script that could be easy to tweak to get what i'm looking for . but the problem it's that the menu opens when called by a vector . i would just like a menu that opens using a key . i would need a template plz . here's the script // E:\Jeux\GTA\GTAIV\scripts\CarUpgrade.net// GTAIV.Net_Script1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null// Architecture: x86// Runtime: .NET 4.0using GTA;using GTA.Native;using System;using System.Diagnostics;using System.Drawing;using System.Reflection;using System.Runtime.CompilerServices;using System.Runtime.InteropServices;using System.Runtime.Versioning;using System.Windows.Forms;[assembly: AssemblyVersion("1.0.0.0")][assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)][assembly: AssemblyCompany("")][assembly: AssemblyConfiguration("")][assembly: AssemblyCopyright("Copyright © 2013")][assembly: AssemblyDescription("")][assembly: AssemblyFileVersion("1.0.0.0")][assembly: AssemblyProduct("GTAIV.Net_Script1")][assembly: AssemblyTitle("GTAIV.Net_Script1")][assembly: AssemblyTrademark("")][assembly: CompilationRelaxations(8)][assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)][assembly: ComVisible(false)][assembly: Guid("6ecba6a1-7ce2-4f1d-8196-79de603a4b63")][assembly: TargetFramework(".NETFramework,Version=v4.0", FrameworkDisplayName = ".NET Framework 4")]namespace Reparation{public class CarUpgrade : Script{ private Keys toggleMenuKey; private Keys selectionKey; private Keys menuUpKey; private Keys menuDownKey; private bool isMenuOn; private bool menuReady; private int menuSelection; private float x; private float y; private float spacing; private Vector3[] positions; private bool IsAtPayNSpray() { Vector3[] array = this.positions; for (int i = 0; i < array.Length; i++) { Vector3 position = array[i]; if (base.Player.Character.Position.DistanceTo(position) < 5f) { return true; } } return false; } public CarUpgrade() { this.positions = new Vector3[] { new Vector3(793.78f, 212.8f, 6.06f), new Vector3(703.17f, 1503.79f, 14.84f), new Vector3(-473.33f, 1747f, 8.73f), new Vector3(166.82f, 164.44f, 14.77f), new Vector3(-1099.93f, 672.52f, 8.53f) }; Vector3[] array = this.positions; for (int i = 0; i < array.Length; i++) { Vector3 target = array[i]; Blip blip = Blip.AddBlip(target); blip.Name = "YOU WILL NEVER SEE THIS"; blip.ShowOnlyWhenNear = true; blip.Icon = BlipIcon.Building_Garage; blip.Scale = 0.5f; blip.Display = BlipDisplay.ArrowAndMap; } this.x = (float)Game.Resolution.Width * 0.1f; this.y = (float)Game.Resolution.Height * 0.1f; this.spacing = (float)Game.Resolution.Height / 50f; this.toggleMenuKey = base.Settings.GetValueKey("TOGGLE_MENU_KEY", Keys.G); this.selectionKey = base.Settings.GetValueKey("SELECTION_KEY", Keys.Return); this.menuUpKey = base.Settings.GetValueKey("MENU_UP_KEY", Keys.Prior); this.menuDownKey = base.Settings.GetValueKey("MENU_DOWN_KEY", Keys.Next); base.BindKey(this.toggleMenuKey, false, false, false, new KeyPressDelegate(this.ToggleMenu)); base.Tick += new EventHandler(this.HelpTick); } private void ToggleMenu() { if (!this.menuReady) { return; } this.isMenuOn = !this.isMenuOn; if (this.isMenuOn) { base.Tick -= new EventHandler(this.HelpTick); base.PerFrameDrawing += new GraphicsEventHandler(this.Menu_PerFrameDrawing); base.KeyDown += new GTA.KeyEventHandler(this.Menu_KeyDown); base.Player.CanControlCharacter = false; return; } base.Tick += new EventHandler(this.HelpTick); base.PerFrameDrawing -= new GraphicsEventHandler(this.Menu_PerFrameDrawing); base.KeyDown -= new GTA.KeyEventHandler(this.Menu_KeyDown); base.Player.CanControlCharacter = true; } private void Menu_KeyDown(object sender, GTA.KeyEventArgs e) { if (e.Key == this.menuUpKey) { this.menuSelection--; this.menuSelection = ((this.menuSelection < 0) ? 2 : this.menuSelection); } if (e.Key == this.menuDownKey) { this.menuSelection++; this.menuSelection = ((this.menuSelection > 2) ? 0 : this.menuSelection); } if (e.Key == this.selectionKey) { switch (this.menuSelection) { case 0: this.Fix(); return; //case 1: //this.BPTires(); return; //case 2: //this.CollisionProof(); break; default: return; } } } private void Menu_PerFrameDrawing(object sender, GraphicsEventArgs e) { e.Graphics.DrawText("Réparer (1$)", this.x, this.y, (this.menuSelection == 0) ? Color.Blue : Color.White); //e.Graphics.DrawText("Bulletproof Tires (5000$)", this.x, this.y + this.spacing, (this.menuSelection == 1) ? Color.Red : Color.White); //e.Graphics.DrawText("Make Collision Proof (10000$)", this.x, this.y + this.spacing * 2f, (this.menuSelection == 2) ? Color.Red : Color.White); } private void Fix() { if (!Game.Exists(base.Player.Character.CurrentVehicle)) { Game.DisplayText("You need a vehicle first!"); return; } if (base.Player.Money >= 1) { Game.FadeScreenOut(2000, true); Function.Call("SET_TIME_OF_DAY", new Parameter[] { World.CurrentDayTime.Hours + 4, World.CurrentDayTime.Minutes }); base.Player.Character.CurrentVehicle.Repair(); Game.FadeScreenIn(2000, true); base.Player.Money -= 1; Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", new Parameter[] { "STRING", "Ton véhicule est réparé!", 2000, 1 }); return; } Game.DisplayText("Pas assez d'argent."); } private void BPTires() { if (!Game.Exists(base.Player.Character.CurrentVehicle)) { Game.DisplayText("You need a vehicle first!"); return; } if (base.Player.Money >= 5000) { Game.FadeScreenOut(2000, true); Function.Call("SET_TIME_OF_DAY", new Parameter[] { World.CurrentDayTime.Hours + 4, World.CurrentDayTime.Minutes }); base.Player.Character.CurrentVehicle.CanTiresBurst = false; Game.FadeScreenIn(2000, true); base.Player.Money -= 5000; Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", new Parameter[] { "STRING", "Your tires are now bulletproof!", 2000, 1 }); return; } Game.DisplayText("Not enough money."); } private void CollisionProof() { if (!Game.Exists(base.Player.Character.CurrentVehicle)) { Game.DisplayText("You need a vehicle first!"); return; } if (base.Player.Money >= 10000) { Game.FadeScreenOut(2000, true); Function.Call("SET_TIME_OF_DAY", new Parameter[] { World.CurrentDayTime.Hours + 4, World.CurrentDayTime.Minutes }); base.Player.Character.CurrentVehicle.CanBeVisiblyDamaged = false; Game.FadeScreenIn(2000, true); base.Player.Money -= 10000; Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", new Parameter[] { "STRING", "Your vehicle is now collision proof!", 2000, 1 }); return; } Game.DisplayText("Not enough money."); } private void HelpTick(object sender, EventArgs e) { this.menuReady = this.IsAtPayNSpray(); if (this.menuReady) { Game.DisplayText("Appuie sur G pour le menu", 500); } }}} (original script made by TempleOfLight) how do i turn this into a "press a key to open" menu . i've been searching for an example during one day but couldn't find any , and i'm getting bored right now Edited November 11, 2014 by jpm1 Link to comment Share on other sites More sharing options...
Jitnaught Posted November 11, 2014 Share Posted November 11, 2014 There has to be more code than that. I actually am developing a .NET Scripthook menu base atm (started working on it today, same day as you requested help for a menu. Illuminati confirmed.) So, when I'm finished with the base and I release it (if I do), then you could use that! AgentWD40 1 Link to comment Share on other sites More sharing options...
jpm1 Posted November 11, 2014 Author Share Posted November 11, 2014 thanks ! edited above post with complete code as written by TempleOfLight when he released the script (with slight modifications i made for my own use) . i'll get a look at your script when it'll come out of course . but the script i'm trying to tweak fits perfectly with what i'm trying to do Link to comment Share on other sites More sharing options...
Jitnaught Posted November 12, 2014 Share Posted November 12, 2014 (edited) First, change the key on line 86 this.toggleMenuKey = base.Settings.GetValueKey("TOGGLE_MENU_KEY", Keys.G); to change the key that opens/closes the menu. Then, remove lines 49-61, 95-97, 102, and 108 (code that isn't required anymore). Edited November 12, 2014 by LetsPlayOrDy jpm1 1 Link to comment Share on other sites More sharing options...
jpm1 Posted November 13, 2014 Author Share Posted November 13, 2014 scripting is fun but the learning curve is time consuming . i'll post my help requests here , and maybe someone that has the answer will save me dozens of hours of internet searching . i'd like to know the following : - how do you delay a menu . i have a menu and i want it to spawn after 4 seconds only (believe it or not but searched all night and still stuck) - how do you do a fade out/in with a background music . i'd like to do a fade out that catches electro choc string - how do you make a menu disappear once the selection has been done - how do you create a schedule condition . i'd like a menu to be available during some hours only , and when unavailable to have a text string instead i keep searching , i just post in case someone knows the answers . and btw thanks LPoD Link to comment Share on other sites More sharing options...
Jitnaught Posted November 13, 2014 Share Posted November 13, 2014 (edited) 1. After 4 seconds of what? 2. Fade background music? You want to fade the radio? 3. In this code if (e.Key == this.selectionKey) { switch (this.menuSelection) { case 0: this.Fix(); return; //case 1: //this.BPTires(); return; //case 2: //this.CollisionProof(); break; default: return; } } add ToggleMenu() to it, like this if (e.Key == this.selectionKey) { switch (this.menuSelection) { case 0: this.Fix(); return; //case 1: //this.BPTires(); return; //case 2: //this.CollisionProof(); break; default: return; }ToggleMenu(); } 4. At the end of public CarUpgrade() add Tick += new EventHandler(CarUpgrade_Tick); then add private void CarUpgrade_Tick(object sender, EventArgs e) { if (Game.GameTime < 0 || Game.GameTime > 500 && isMenuOn) ToggleMenu(); } and also add if (Game.GameTime < 0 || Game.GameTime > 500 && !isMenuOn) return; to the start of the ToggleMenu() function Edited November 13, 2014 by LetsPlayOrDy jpm1 1 Link to comment Share on other sites More sharing options...
jpm1 Posted November 13, 2014 Author Share Posted November 13, 2014 i want a delayed menu . when you create a menu it appears , i want it to appear at T + 4s . i want to hear electro choc during my 2 seconds fade out . i know how to do a fade out , i would like to know how to capture electro choc stream during 2 seconds . i'll try your advices soon . i'm making a small pause right now , cause i've been on this for 2 days now Link to comment Share on other sites More sharing options...
jpm1 Posted November 19, 2014 Author Share Posted November 19, 2014 SOMEBODY CAN GIVE ME COORDINATES OF nIKO INSIDE rOMAN'S MODERN APARTMENT NEAR gROTI'S . any place inside apartment will do . thanks Link to comment Share on other sites More sharing options...
Jitnaught Posted November 19, 2014 Share Posted November 19, 2014 SOMEBODY CAN GIVE ME COORDINATES OF nIKO INSIDE rOMAN'S MODERN APARTMENT NEAR gROTI'S . any place inside apartment will do . thanksJust code a script that tells you. If you don't know how to do that, pm me and I'll make a little script for you. jpm1 1 Link to comment Share on other sites More sharing options...
jpm1 Posted November 20, 2014 Author Share Posted November 20, 2014 thanks but i think you didn't understand me . i'm not asking for a show coordinates script , i'm just asking for some coordinates inside apartment near grotti's , i don't do the missions thus i don't have access to that apartment . btw do you know how to make a teleport script that works by entering an area . for example i enter (1000f, 1000f, 10f) area and i get automatically teleported to (1100f, 1100f, 10f) . i'm having hard time learning how vector3 thing works right now Link to comment Share on other sites More sharing options...
Jitnaught Posted November 20, 2014 Share Posted November 20, 2014 Make a timer, check if the player's distance to the position is around 5ft or something, if true, teleport. Link to comment Share on other sites More sharing options...
jpm1 Posted November 20, 2014 Author Share Posted November 20, 2014 i know that lol . what i'm looking for it's an example Link to comment Share on other sites More sharing options...
Jitnaught Posted November 20, 2014 Share Posted November 20, 2014 i know that lol . what i'm looking for it's an example Vector3 PositionToTeleFrom = new Vector3(1000f, 1000f, 10f), PositionToTeleTo = new Vector3(1100f, 1100f, 10f);public ExampleScript(){ Interval = 100; Tick += MyTick;}private void MyTick(object sender, EventArgs e){ if (Player.Character.Position.DistanceTo(PositionToTeleFrom) < 5f) Player.Character.Position = PositionToTeleTo;} jpm1 1 Link to comment Share on other sites More sharing options...
jpm1 Posted November 20, 2014 Author Share Posted November 20, 2014 Thank you so much . it helped me a lot . One last thing do you know the name of the following icons (blips) , i searched during one hour , but couldn't find their names Link to comment Share on other sites More sharing options...
Jitnaught Posted November 20, 2014 Share Posted November 20, 2014 Thank you so much . it helped me a lot . One last thing do you know the name of the following icons (blips) , i searched during one hour , but couldn't find their names The name of them in .NET Scripthook? BlipIcon.Activity_Bar BlipIcon.Person_Brucie (or maybe BlipIcon.Person_Bernie, not too sure) BlipIcon.Building_CarWash BlipIcon.Building_ClothShop Link to comment Share on other sites More sharing options...
jpm1 Posted November 20, 2014 Author Share Posted November 20, 2014 The name of them in .NET Scripthook? BlipIcon.Activity_Bar BlipIcon.Building_ClothShop i'm looking for these 2 . no , i tried it doesn't work Link to comment Share on other sites More sharing options...
Jitnaught Posted November 20, 2014 Share Posted November 20, 2014 I don't understand. Those don't work? I don't know what you want Link to comment Share on other sites More sharing options...
jpm1 Posted November 20, 2014 Author Share Posted November 20, 2014 no they don't work Link to comment Share on other sites More sharing options...
Jitnaught Posted November 20, 2014 Share Posted November 20, 2014 How are you using them? Link to comment Share on other sites More sharing options...
jpm1 Posted November 20, 2014 Author Share Posted November 20, 2014 Exactly as in 1st post Link to comment Share on other sites More sharing options...
Jitnaught Posted November 20, 2014 Share Posted November 20, 2014 (edited) If you're talking about Vector3 target = array[i];Blip blip = Blip.AddBlip(target);blip.Name = "YOU WILL NEVER SEE THIS";blip.ShowOnlyWhenNear = true;blip.Icon = BlipIcon.Building_Garage;blip.Scale = 0.5f;blip.Display = BlipDisplay.ArrowAndMap; then it should work, and I don't know why it wouldn't. Make sure you are near the position, since you won't see it unless you are (because blip.ShowOnlyWhenNear is set to true). Edited November 20, 2014 by LetsPlayOrDy Link to comment Share on other sites More sharing options...
byteMe420 Posted November 26, 2014 Share Posted November 26, 2014 (edited) i made a class library for easy to code gta v menus... pm me if you want to use it just noticed i wrote the code in your opening post but it was to show someone how to make a trainer and it looks like he edited it some Edited November 26, 2014 by byteMe420 Link to comment Share on other sites More sharing options...
TempleOfLight Posted November 26, 2014 Share Posted November 26, 2014 i made a class library for easy to code gta v menus... pm me if you want to use it just noticed i wrote the code in your opening post but it was to show someone how to make a trainer and it looks like he edited it some Exactly, haha. Our man Byte here is the one who got me started in C# back in the day when I was a dude who'd never written a single line of code in his life. If I'm not mistaken, that must have been the very first thing I worked on. Those were the days. Still gotta give props to the man for handling my noobish questions all night long without wanting to bash his head into a wall, though. That menu template was entirely his, straight from his mind onto that script. Only thing I remember writing myself are the methods right below that. I still suck at menus today. Not a chance in hell I even tried to tackle that back then, haha. jpm1 and leftas 2 Link to comment Share on other sites More sharing options...
jpm1 Posted November 27, 2014 Author Share Posted November 27, 2014 (edited) we all do that , taking our inspiration from others work . maybe some may call this stealing , i'd say there are no better way to learn coding . i was taking with LPoD about a NET weather changer . and believe it or not it took several years before such script was released (and i had to ask for it) . i was bored of waiting , i decided to take some action ^^ . the menu above is great so i decided to use it as a base for some of my scripts . now i know where it comes from Edited November 27, 2014 by jpm1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now