GetVehicleDimension: Difference between revisions

From Onset Developer Wiki
Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|Gets the dimension of this vehicle.}} {{FuncSyntax|GetVehicleDimension(vehicle)}} {{FuncParameters}} {{FuncParam|vehicle|The..."
 
No edit summary
 
Line 11: Line 11:


== Example ==
== Example ==
__EDIT_ME__
<syntaxhighlight lang="Lua>
function getVehiclesInDimension(dimension)
    dimension = tonumber(dimension)
    if not dimension or dimension < 0 or dimension > 4294967295 then
        return false
    end
 
    local vehicles = {}
    for index, vehicle in ipairs(GetAllVehicles()) do
        if GetVehicleDimension(vehicle) == dimension then
            table.insert(vehicles, vehicle)
        end
    end
 
    return vehicles
end
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
{{VehicleFunctions}}

Latest revision as of 16:22, 27 May 2021

GetVehicleDimension

Type: Function
Context: Server
Introduced: v1.0

Description

Gets the dimension of this vehicle.

Syntax

GetVehicleDimension(vehicle)

Parameters

  • vehicle
    The vehicle identifier.

Return Value

  • Returns the dimension.

Example

function getVehiclesInDimension(dimension)
    dimension = tonumber(dimension)
    if not dimension or dimension < 0 or dimension > 4294967295 then
        return false
    end

    local vehicles = {}
    for index, vehicle in ipairs(GetAllVehicles()) do 
        if GetVehicleDimension(vehicle) == dimension then
            table.insert(vehicles, vehicle)
        end
    end

    return vehicles
end

See also