Vehicle-Player

This page describes the player-vehicle interaction API

Player put

vehiclePlayerPut(vehicle, player, seat_id)

Puts player into a vehicle at a specified seat.

Details
Example

Remarks

Arguments

Type

Description

vehicle

Vehicle ID

player

Player ID

seat_id

Seat slot

Returns

0 if successful, -1 if occupied already

oak.cmd('putcar', async (pid, model) => {
const veh = await spawncar(pid, model, false)
oak.vehiclePlayerPut(veh, pid, 0)
})

Player remove

vehiclePlayerRemove(vehicle, player)

Removes player from a vehicle.

Details
Example

Remarks

Arguments

Type

Description

vehicle

Vehicle ID

player

Player ID

Returns

0 if successful, -1 if not in a vehicle.

// TODO

Player inside

vehiclePlayerInside(player)

Get the current vehicle player sits in.

Details
Example

Remarks

Arguments

Type

Description

player

Player ID

Returns

Vehicle ID or -1 if not inside a vehicle.

// TODO

Player seat get

vehiclePlayerSeatGet(vehicle, player)

Retrieves the seat slot of a player in specified vehicle

Details
Example

Remarks

Arguments

Type

Description

vehicle

Vehicle ID

player

Player ID

Returns

Seat ID of a player or -1 if not inside specified vehicle.

// TODO

Player at seat

vehiclePlayerAtSeat(vehicle, seat_id)

Retrieves a player ID at a specified seat slot of a specified vehicle.

Details
Example

Remarks

Arguments

Type

Description

vehicle

Vehicle ID

seat_id

Seat slot

Returns

Player ID at a specified seat or -1 if seat is empty.

// TODO