ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. setVehicleLocked

Function

setVehicleLocked

Server and clientVehiclesIdentical to MTA:SA

Locks or unlocks a vehicle's doors for every player. Players cannot get into a locked vehicle (the game will not start entering). People already inside can still get out normally.

Syntax

bool setVehicleLocked(vehicle vehicle, bool locked)

Arguments

vehiclevehicle
The vehicle.
lockedbool
true = locked, false = unlocked.

Returns

true on success.

Example

addCommandHandler("zamek", function(player)
    local vehicle = getPedOccupiedVehicle(player)
    if not vehicle then return end
    local locked = not isVehicleLocked(vehicle)
    setVehicleLocked(vehicle, locked)
    outputChatBox(locked and "Zamknieto." or "Otwarto.", player)
end)

See also