Used to get the current vehicle driver.

Returns a Player | null.


vehicle.driver: alt.Player | null


const driver = vehicle.driver;

Real World Example

Determine if the player is currently driving a vehicle.

function isPlayerDriving(player) {
    // Not in a vehicle.
    if (!player.vehicle) {
        return false;

    // Vehicle does not have a driver.
    if (!player.vehicle.driver) {
        return false;

    // Driver ID does not match Player ID.
    if ( !== {
        return false;

    // Match found and is driving.
    return true;

const isDriving = isPlayerDriving(somePlayer);

These examples assume you have vehicle created or available on server-side

results matching ""

    No results matching ""