Jump to content
RAGE Multiplayer Community

PlayerStartEnterVehicle not working.


Recommended Posts

9 hours ago, Kopra said:

Try like this

mp.events.add("playerStartEnterVehicle", (player, vehicle, seat) => {
    mp.gui.chat.push(`${player.name} started to get into the car ID: ${vehicle.id}. Seat: ${seat}`);
});

PlayerStartEnterVehicle - RAGE Multiplayer Wiki

Without changess.

It remains:

mp.events.add('render', () =>
{
	const controls = mp.game.controls;
    let localPlayer = mp.players.local;
	
	controls.disableControlAction(0, 23, true);
	
	if(controls.isDisabledControlJustPressed(0, 23))
	{
		if (!localPlayer.vehicle) {
            let position = mp.players.local.position;		
            let vehHandle = mp.game.vehicle.getClosestVehicle(position.x, position.y, position.z, 5, 0, 70);
            
            let vehicle = mp.vehicles.atHandle(vehHandle);
            let vehOwner = vehicle.getVariable("veh:owner");
            let uid = mp.players.local.getVariable("plr:uid");

            if(vehicle && vehicle.isAnySeatEmpty() && vehicle.getSpeed() < 5 &&  vehOwner == null || vehOwner == uid)
            {
                mp.players.local.taskEnterVehicle(vehicle.handle, 5000, -1, 0, 1, 0);
                return;
            }

            if (vehOwner != uid) {
                mp.gui.chat.push("Nie posiadasz kluczyków do tego pojazdu.");
            }
        }
	}
});

 

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...