SetConvertibleRoofLatchState
DocsSetConvertibleRoofLatchState(vehicle, bLatched)Description
Introduced in build 323
This native is used to latch or unlatch the convertible roof of a vehicle. It allows for direct control over the roof's mechanism without actually opening or closing the roof. This can be useful for scenarios where you need to prepare a vehicle's roof to be opened or closed by another action or to ensure it remains fixed in its current state regardless of other interactions.
Parameters
| Name | Type | Description |
|---|---|---|
vehicle | Vehicle | The vehicle whose convertible roof latch state is to be set. |
bLatched | BOOL | A boolean value indicating the desired latch state of the roof. Set to `true` to latch (lock) the roof, preventing it from being opened. Set to `false` to unlatch (unlock) the roof, allowing it to be opened or closed. |
Quick Snippet: Get Vehiclevehicle
vehicleUse this to get the current vehicle handle for this native.
-- Get the vehicle the player is currently in
local ped = PlayerPedId()
local vehicle = GetVehiclePedIsIn(ped, false)
if vehicle ~= 0 then
print("Vehicle handle: " .. vehicle)
print("Model: " .. GetEntityModel(vehicle))
else
print("Player is not in a vehicle")
endVehicle Models

adder
alpha
blade
ardent
asea
cogcabrio
baller
blistaReturns
voidThis native does not return a value.
Examples
Official
-- To latch (lock) the convertible roof, preventing it from being opened
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
if not DoesVehicleHaveRoof(vehicle) then return end
SetConvertibleRoofLatchState(vehicle, true)