Jump to content

NativeUI Menu should just work at the Spawnarea


theralio

Recommended Posts

Hi,

i created a menu with NativeUI and the menu works Perfect but i want to know how can i fix it that it works like this bcs atm it wont open when iam at the position

mp.keys.bind(0x71, false, () => {
  mp.players.forEachInRange(new mp.Vector3(238.60870361328125, -2576.864990234375, 5.962751388549805), 10, (player) => {
    if (mainMenu.Visible) mainMenu.Close();
    else mainMenu.Open();
  })
});

 

Link to comment
Share on other sites

If I understand you correctly I don't see why you need to loop the player pool to show the menu to yourself. All you need is to get your local player's position and compare the two vectors.

mp.keys.bind(0x71, false, () => {
    let playerPos = mp.players.local.position;
    if(mp.game.system.vdist2(playerPos.x, playerPos.y, playerPos.z, 238.60870361328125, -2576.864990234375, 5.962751388549805) <= 10) {
        if (mainMenu.Visible) mainMenu.Close();
        else mainMenu.Open();
    }
});

 

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...