GetAllVehicles

From GT-MP
Jump to: navigation, search
GetAllVehicles
Shared Function
Utilities-terminal.png Server-Side System-users.png Client-Side
Csharp.png C# Javascript.png JavaScript

Gets all of the vehicles currently in the server


Syntax

API.getAllVehicles();


NOTE: This function returns data in List type.

Usage example(s)

Example Description

[Command("motors")]
public void Motors(Client player)
{
    List<NetHandle> cars = API.getAllVehicles();
    // Get all Vehicles in a List
    foreach (NetHandle car in cars)
    {
        API.setVehicleEngineStatus(car, false);
        // Turn every Motor from every Vehicle off.
    }
}
// Credit's to -Andreas @ https://gt-mp.net/user/4192-andreas/


References