Vehicle::locked: Difference between revisions
m (Doubled negation) |
MrPancakers2 (talk | contribs) No edit summary |
||
| Line 1: | Line 1: | ||
{{ServersideJsProperty}} | |||
A vehicle property used for locking or unlocking a vehicle. | |||
< | {{JSContainer| | ||
== Syntax == | |||
</ | <pre> | ||
vehicle.locked; | |||
</pre> | |||
==Getter== | |||
* {{RageType|Boolean}} | |||
==Setter== | |||
* {{RageType|Boolean}} | |||
==Example== | ==Example== | ||
This example will lock your vehicle. | |||
< | {{ServersideCode| | ||
mp.events.addCommand( | <pre> | ||
mp.events.addCommand('lock', (player) => { | |||
let vehicle = player.vehicle; | let vehicle = player.vehicle; | ||
if (vehicle) { | if (vehicle) { | ||
let newState = !vehicle.locked; | let newState = !vehicle.locked; | ||
vehicle.locked = newState; | vehicle.locked = newState; | ||
player.outputChatBox(`Your vehicle doors now | player.outputChatBox(`Your vehicle doors are now ${newState ? `locked` : `unlocked`}.`); | ||
}; | }; | ||
} | } | ||
); | ); | ||
</ | </pre> | ||
}} | |||
}} | |||
==See Also== | |||
{{Vehicle_definition}} | |||
[[Category:Vehicle API]] | |||
[[Category:Serverside API]] | |||
[[Category:Server-side Property]] | |||
Latest revision as of 01:05, 14 September 2020
Server-Side Property
A vehicle property used for locking or unlocking a vehicle.
JavaScript Syntax
Syntax
vehicle.locked;
Getter
- Boolean
Setter
- Boolean
Example
This example will lock your vehicle.
Server-Side
mp.events.addCommand('lock', (player) => {
let vehicle = player.vehicle;
if (vehicle) {
let newState = !vehicle.locked;
vehicle.locked = newState;
player.outputChatBox(`Your vehicle doors are now ${newState ? `locked` : `unlocked`}.`);
};
}
);
See Also
- Functions
- Vehicle::Vehicle
- Vehicle::destroy
- Vehicle::explode
- Vehicle::getColor
- Vehicle::getColorRGB
- Vehicle::getExtra
- Vehicle::getMod
- Vehicle::getNeonColor
- Vehicle::getOccupant
- Vehicle::getOccupants
- Vehicle::getPaint
- Vehicle::isStreamed
- Vehicle::isStreamedFor
- Vehicle::repair
- Vehicle::setColor
- Vehicle::setColorRGB
- Vehicle::setExtra
- Vehicle::setMod
- Vehicle::setNeonColor
- Vehicle::setOccupant
- Vehicle::setPaint
- Vehicle::spawn
- Entity::destroy
- Entity::dist
- Entity::distSquared
- Entity::getVariable
- Entity::setVariable
- Entity::setVariables
- Properties
- Vehicle::bodyHealth
- Vehicle::brake
- Vehicle::dashboardColor
- Vehicle::dead
- Vehicle::engine
- Vehicle::engineHealth
- Vehicle::extras
- Vehicle::highbeams
- Vehicle::horn
- Vehicle::livery
- Vehicle::locked
- Vehicle::movable
- Vehicle::mods
- Vehicle::neonEnabled
- Vehicle::numberPlate
- Vehicle::numberPlateType
- Vehicle::pearlescentColor
- Vehicle::rocketBoost
- Vehicle::rotation
- Vehicle::siren
- Vehicle::steerAngle
- Vehicle::streamedPlayers
- Vehicle::taxiLights
- Vehicle::trailer
- Vehicle::traileredBy
- Vehicle::trimColor
- Vehicle::velocity
- Vehicle::windowTint
- Vehicle::wheelColor
- Vehicle::wheelType
- Entity::alpha
- Entity::data
- Entity::dimension
- Entity::id
- Entity::model
- Entity::position
- Entity::type