{"name":"lock","title":"lock","type":"command","url":"https://community.bistudio.com/wiki/lock","revid":353298,"updated":"2024-03-15T17:11:43Z","groups":["Object Manipulation"],"status":"ok","games":{"ofp":"1.00","ofpe":"1.00","arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"ofp 1.00","arma3_since":"0.50","locality":{"argument":"local","effect":"global"},"description":"Lock vehicle (disable mounting / dismounting) for player.\nThis command will remove user get in/get out actions but will not stop player getting into or out of vehicle via script commands (e.g moveInCargo).\n\n> [!NOTE]\n> Alternative syntax is similar to setVehicleLock but with numbers.","syntaxes":[{"syntax":"vehicleName lock locked","params":[{"name":"vehicleName","type":"Object","type_expr":"Object"},{"name":"locked","type":"Boolean","description":"true to lock, false to unlock","type_expr":"Boolean"}],"returns":{"type":"Nothing","type_expr":"Nothing"},"form":"binary","left":{"text":"vehicleName"},"right":{"text":"locked"}},{"syntax":"vehicleName lock lockstate","since":"arma3 0.50","params":[{"name":"vehicleName","type":"Object","type_expr":"Object"},{"name":"lockstate","type":"Number","description":"can be one of the following:\n0 - Unlocked\n1 - Default (player subordinate cannot enter until his leader says so)\n2 - Locked\n3 - Locked for player","type_expr":"Number"}],"returns":{"type":"Nothing","type_expr":"Nothing"},"form":"binary","left":{"text":"vehicleName"},"right":{"text":"lockstate"}}],"examples":[{"code":["_jeepOne lock true;"]},{"code":["heli lock true;\nlocked heli; // 2\n\nheli lock false;\nlocked heli; // 0\n\nheli lock 1;\nlocked heli; // 1"]}],"see_also":["locked","setVehicleLock","lockDriver","lockCargo","lockTurret"],"notes":[{"user":"Tankbuster","date":"2010-01-09T22:48:00Z","text":"Lock prevents AI persons mounting or dismounting vehicles when ordered to do so and players are prevented from doing both too, but AI will still dismount when a vehicle is damaged."},{"user":"cali","date":"2010-09-22T04:56:00Z","text":"If an AI group (e.g Mechanized Infantry) has its vehicle locked with its crew in it, it will mount or dismount it anyway. But a player in this group won't be able to enter the vehicle."}]}