Jump to content
RAGE Multiplayer Community

Nativeui ussage


simas
 Share

Recommended Posts

Hello 

i understand slider, checkbox but don't understand how to set data on  list items 

i new to rage scripting and i wish to understand better how things work :) 

ui.AddItem(new UIMenuListItem(
  "menu item text",
	"menu item description goes here",
  new ItemsCollection(["erty", "abc"]),
// i understand how to add items but how set data for them because 
ui.ItemSelect.on(item => {
	if (item instanceof UIMenuListItem) {
    console.log(item.SelectedItem.DisplayText, item.SelectedItem.Data);
    mp.game.graphics.notify(`"${item.Text}". ${item.SelectedItem.Data}`);
*****************
// i get data as nill or null 
***********************

	} else if (item instanceof UIMenuSliderItem) {
    console.log(item.Text, item.Index, item.IndexToItem(item.Index));
    mp.game.graphics.notify(`text "${item.Text}". index  ${item.Index} indextoitem ${item.IndexToItem(item.Index)}`);
	} else {
    console.log(item.Text);
    mp.game.graphics.notify(`"${item.Text}".`);
	}
});

 

Link to comment
Share on other sites

  • 1 month later...
mp.events.add("loop",(=> {
 let amount = 1;
  let data= [{name: "w", price: 200}, {name: "w", price: 200}];
 let array [0, 1, 2, 3, 4, 5, 6, 7, 8];
  const native new Menu("HELLO WORLD"" ", resolution);
    let list = new UIMenuListItem("list""something.."new ItemsCollection(array));
    native.AddItem(list);
  data.forEach(item => {
    let _item = new UIMenuItem("name: " + item.name, "price: " + item.price);
    native.AddItem(_item);
  })
 
    native.ListChange.on((itemindex=> {
        amount = index 1;
    });
})
 
 
Edited by offsetx
  • Mask 1
Link to comment
Share on other sites

  • 1 month later...
On 1/9/2021 at 2:31 AM, offsetx said:
mp.events.add("loop",(=> {
 let amount = 1;
  let data= [{name: "w", price: 200}, {name: "w", price: 200}];
 let array [0, 1, 2, 3, 4, 5, 6, 7, 8];
  const native new Menu("HELLO WORLD"" ", resolution);
    let list = new UIMenuListItem("list""something.."new ItemsCollection(array));
    native.AddItem(list);
  data.forEach(item => {
    let _item = new UIMenuItem("name: " + item.name, "price: " + item.price);
    native.AddItem(_item);
  })
 
    native.ListChange.on((itemindex=> {
        amount = index 1;
    });
})
 
 

Hello sir, i hope i will complete it my self but when i use 
 

 native.ItemSelect.on(item => {
        mp.game.graphics.notify("itemass "+item.price);
i get undefined 

or 
native.ListChange.on((itemindex=> {
           amount = index + 1;
           mp.game.graphics.notify("zzz "+item.price);
       }); 
i get nothing at all can you correct me ? 
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...