Jump to content
RAGE Multiplayer Community

the browser script is executed early


Recommended Posts

If you always wanna show the browser try 

player.isInVehicle(vehicle, atGetIn);

if the condition is true, run the script or set a flag -> browser.execute(js)

 

if you just show wanna show the browser, if player is in a car, open and destory your cef (browser) in vehicle events

 

mp.events.add("playerEnterVehicle", playerEnterVehicleHandler);
mp.events.add("playerLeaveVehicle", (vehicle, seat)...

 

Link to post
Share on other sites
1 минуту назад, Division сказал:

If you always wanna show the browser try 

player.isInVehicle(vehicle, atGetIn);

if the condition is true, run the script or set a flag -> browser.execute(js)

 

if you just show wanna show the browser, if player is in a car, open and destory your cef (browser) in vehicle events

 

mp.events.add("playerEnterVehicle", playerEnterVehicleHandler);
mp.events.add("playerLeaveVehicle", (vehicle, seat)...

 

I have a key binder,

mp.keys.bind(CarTuning.keyCode, false, () => { // f6
if (player.vehicle) {
        if (CarTuning.windowOpen) {
            CarTuning.browser.active = false;
            mp.gui.cursor.show(false, false);
            CarTuning.windowOpen = !CarTuning.windowOpen;
        }

        else {
            mp.events.call("startTun") && mp.events.call("List");
            CarTuning.browser.active = true;
            mp.gui.cursor.show(true, true);
            CarTuning.windowOpen = !CarTuning.windowOpen;
        }
    }

    else {
        mp.gui.chat.push("NEED A CAR!");
    }
})

 

Link to post
Share on other sites
Posted (edited)

i have a key binder

mp.keys.bind(CarTuning.keyCode, false, () => {
    if (player.vehicle) {
        if (CarTuning.windowOpen) {
            CarTuning.browser.active = false;
            mp.gui.cursor.show(false, false);
            CarTuning.windowOpen = !CarTuning.windowOpen;
        }

        else {
            mp.events.call("List");
            CarTuning.browser.active = true;
            mp.gui.cursor.show(true, true);
            CarTuning.windowOpen = !CarTuning.windowOpen;
        }
    }

    else {
        mp.gui.chat.push("CAR ONLY!");
    }
});

 

Edited by alienwave
Link to post
Share on other sites

if you're setting CarTuning.windowOpen in both conditions, please just use true/false, it's much better reading :D

So your problem is, that when leaving the car, the window stays open?

Than destroy the window, when event is triggered:

playerLeaveVehicle
Link to post
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...