Scripting/Server/NPCs/npc.EnterVehicle

(v0.3.3-r4+) The NPC walks to the vehicle, opens a door and gets in as a passenger (EnterVehicle), or steps out of the vehicle it is in (LeaveVehicle), with the normal GTA animations - unlike npc.Vehicle = v, which teleports it into the driver seat. The call returns true when the order was given. Poll npc.Vehicle (null while outside) to know when it is in or out; the order is repeated until the NPC is seated.

Syntax

npc.EnterVehicle(vehicle)
npc.LeaveVehicle()

Arguments

Example

function onPlayerCommand( player, cmd, params )
{
	if ( cmd == "entervehicle" )
	{
		// npc is a npc handle (see NPC members)
		npc.EnterVehicle( veh );
	}
}

This sample was generated from the signature – adapt the values to your gamemode.

Section: NPC members

Categories: Server functions | NPC members