Loorenzos Posted November 23, 2018 Share Posted November 23, 2018 Hey im new with RageMP i was developping on FiveM before and i make an admin menu and so.. i have a question There is a way with NativeUI to do something like if UIMenuItem is Pressed then execute Function if yes how can i do because every ways i saw with nativeui was only in Boolean..... Link to comment Share on other sites More sharing options...
Flow Posted November 23, 2018 Share Posted November 23, 2018 (edited) ui = new Menu("Test", "", new Point(1440, 20)); ui.AddItem(new UIMenuItem("do something", "description text")); ui.ItemSelect.on( (item, index) => { if(item.Text === "do something") mp.events.call("doSomeThing", player, options); }); Edited November 23, 2018 by cmdflow Link to comment Share on other sites More sharing options...
Loorenzos Posted November 23, 2018 Author Share Posted November 23, 2018 (edited) 6 minutes ago, cmdflow said: ui = new Menu("Test", "", new Point(1440, 20)); ui.AddItem(new UIMenuItem("do something", "description text")); ui.ItemSelect.on( (item, index) => { if(item.Text === "do something") mp.events.call("doSomeThing", player, options); } yeah i saw this one but as i say its in boolean like if item == .... then ... but i want something that just detect if i pressed the button to execute my function Edited November 23, 2018 by Loorenzos Link to comment Share on other sites More sharing options...
Flow Posted November 23, 2018 Share Posted November 23, 2018 (edited) I think i don't understand what you want to achieve because if you just want to press a button without having options then you simply do: ui.ItemSelect.on( (item, index) => { yourFancyFunction(); // or yourFanyFunction(item.text); } Edited November 23, 2018 by cmdflow Link to comment Share on other sites More sharing options...
Loorenzos Posted November 23, 2018 Author Share Posted November 23, 2018 5 minutes ago, cmdflow said: I think i don't understand what you want to achieve because if you just want to press a button without having options then you simply do: ui.ItemSelect.on( (item, index) => { yourFancyFunction(); // or yourFanyFunction(item.text); } I will test that thx for ur help and sry ^^ i just started to learn the ragemp api Link to comment Share on other sites More sharing options...
Flow Posted November 23, 2018 Share Posted November 23, 2018 Nothing to be sorry for. Hope i could help you. Have a good one Link to comment Share on other sites More sharing options...
Loorenzos Posted November 24, 2018 Author Share Posted November 24, 2018 (edited) It work well thx ^^ btw if u wanna follow my project : https://trello.com/b/Nwv2uB1e/santosrp-ragemp Edited November 24, 2018 by Loorenzos 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