Vehicle::locked: Difference between revisions

From RAGE Multiplayer Wiki
(Created page with "This property used for lock/unlock vehicle. Players can't seat to locked vehicles, bikes too. <syntaxhighlight lang="javascript"> boolean vehicle.lock; </syntaxhighlight> =...")
 
No edit summary
Line 2: Line 2:


<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
boolean vehicle.lock;
Boolean vehicle.lock;
</syntaxhighlight>  
</syntaxhighlight>  



Revision as of 14:55, 26 September 2017

This property used for lock/unlock vehicle. Players can't seat to locked vehicles, bikes too.

Boolean vehicle.lock;

Example

That's example will lock your vehicle, when you use command.

mp.events.addCommand(`doors`, 
	(player) => {
		let vehicle = player.vehicle;
		if (!!vehicle) {
			let newState = !vehicle.locked;
			vehicle.locked = newState;
			player.outputChatBox(`Your vehicle doors now <b>${newState ? `closed` : `opened`}</b>`);
		};
	}
);

See Also

Template:Vehicle block