M1XT3NZ Posted July 30, 2017 Share Posted July 30, 2017 Hello guys im new to coding and i wanted to know how to use Game.Player.Money correctly in an NativeUI menu. Hope you can help me guys Link to comment Share on other sites More sharing options...
ins1de Posted August 1, 2017 Share Posted August 1, 2017 What do you exactly want to achieve? Link to comment Share on other sites More sharing options...
M1XT3NZ Posted August 11, 2017 Author Share Posted August 11, 2017 i want to give myselfe in singleplayer a amount of money. so that i will get with game.player.money = 9999; but i dont really know how to do that with nativeui.. Link to comment Share on other sites More sharing options...
M1XT3NZ Posted August 11, 2017 Author Share Posted August 11, 2017 because i try to make my own singleplayer mod menu Link to comment Share on other sites More sharing options...
Saltyq Posted August 22, 2017 Share Posted August 22, 2017 (edited) Here's a quick code to give the player 1000 in a menu. Use it as a reference if you'd like. Just in case you plan on trying to do this online, it will not work as the money online is server-side and not client-side. using System;using System.Drawing;using System.Windows.Forms;using GTA;using GTA.Native;using GTA.Math;using NativeUI;namespace Money{ public class Main : Script { MenuPool pool = new MenuPool(); UIMenu moneyMenu = new UIMenu("Add Money", ""); // create the menu public Main() { Tick += onTick; KeyDown += onKeyDown; Interval = 1; moneyMenu.AddItem(new UIMenuItem("Add $1000")); // create the item moneyMenu.OnItemSelect += moneyMenu_itemSelectHandler; pool.Add(moneyMenu); // add the menu to the menu pool moneyMenu.RefreshIndex(); } private void moneyMenu_itemSelectHandler(UIMenu sender, UIMenuItem selectedItem, int index) { switch(index) { case 0: // index # from moneyMenu.MenuItems list Game.Player.Money += 1000; // give the player 1000 UI.Notify("+ $1000!"); return; } } private void onTick(object sender, EventArgs e) { pool.ProcessMenus(); // process the menu } private void onKeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.M) { moneyMenu.Visible = !moneyMenu.Visible; // opens if not visible, closes if visible } } }} Edited August 22, 2017 by FIFSA 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