SetBoatAnchor
DocsSetBoatAnchor(boat, toggle)Description
Introduced in build 323
Sets the anchor state for a boat.
Note: You might want to check if you can use your anchor before with CAN_ANCHOR_BOAT_HERE.
Parameters
| Name | Type | Description |
|---|---|---|
boat | Vehicle | The target boat. |
toggle | BOOL | Set the anchor state `true` deploys the anchor, false `raises` it. |
Quick Snippet: Get Vehicleboat
boatUse 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
local boat = GetVehiclePedIsIn(PlayerPedId(), false)
if not boat or not IsThisModelABoat(GetEntityModel(boat)) then return end
-- Check if we can anchor the boat here
if CanAnchorBoatHere(boat) then
-- Deploy the boat's anchor
SetBoatAnchor(boat, true)
-- Wait for 10 seconds
Wait(10000)
-- Raise the boat's anchor
SetBoatAnchor(boat, false)
else
print("Cannot anchor the boat at this location")
end