lockState
Used to set
or get
the lock state of a vehicle. Basically if the vehicle can be entered or left.
Lock State
{
None: 0,
Unlocked: 1,
Locked: 2,
LockoutPlayerOnly: 3,
LockPlayerInside: 4,
InitiallyLocked: 5,
ForceDoorsShut: 6,
LockedCanBeDamaged: 7,
}
Most developers will likely only need 1
& 2
for locking / unlocking the vehicle.
Returns a number
.
Declaration
vehicle.lockState: number;
Usage
const lockState = vehicle.lockState;
// OR
vehicle.lockState = 1;
Real World Example
const vehicle = new alt.Vehicle('sanchez', 0, 0, 0, 0, 0, 0);
vehicle.lockState = 1;
if (vehicle.lockState === 1) {
console.log('Unlocked!');
}
if (vehicle.lockState === 2) {
console.log('Locked!');
}
These examples assume you have vehicle created or available on server-side