GetVehicleDriver

From GT-MP
Jump to: navigation, search
GetVehicleDriver
Server-Side Function
Utilities-terminal.png Server-Side Csharp.png C#


Returns the driver of the specified vehicle.

Syntax

Client API.getVehicleDriver(NetHandle vehicle);

Required Arguments

  • vehicle: parameter input should be in NetHandle type.


NOTE: This function returns data in Client type.

NOTE²: Returns null if there is no driver.

Usage example(s)

// This command warps all players out of vehicles
[Command("warpPlayers")]
public void warpPlayersCommand(Client player)
{
    List<NetHandle> vehicleList = API.getAllVehicles();
    foreach(NetHandle vehicle in vehicleList)
    {
        Client driver = API.getVehicleDriver(vehicle);
        if (driver != null)
        {
            API.warpPlayerOutOfVehicle(driver);
        }
    }
}

Changelog

Version Description
1.638.634 Release.

References

warpPlayerOutOfVehicle