- Documentation
- Shared functions
- setVehicleComponentVisible
Function
setVehicleComponentVisible
Shows or hides a named part of a vehicle model. On the server the change applies to every player ; on the client it applies to the local player only and takes priority over the server's setting. It works on the frames of a model from a file (engineReplaceModel): the author's variants (spoiler_1, extra1…), doors, bonnet, bumpers. The client-side getVehicleComponents lists the names for a given vehicle.
Syntax
bool setVehicleComponentVisible(vehicle vehicle, string component, bool visible)Arguments
vehiclevehicle- The vehicle.
componentstring- Part (.dff frame) name, case-insensitive.
visiblebooltrue= visible,false= hidden.
Returns
true on success.
Example
addCommandHandler("bezspojlera", function(player)
local vehicle = getPedOccupiedVehicle(player)
if vehicle then setVehicleComponentVisible(vehicle, "spoiler_1", false) end
end)
See also
getVehicleComponentVisibleChecks whether a named part of a vehicle model is visible. On the client it also takes this player's local settings into account.getVehicleComponentsReturns a vehicle model's parts as a table of name → visible. On the client, for a model from a file (engineReplaceModel) it is the full list of .dff frames (body, doors, bonnet, bumpers,wheel_*_dummywheels, the author's variants); for game cars only parts changed by script. On the server only parts changed by script.resetVehicleComponentVisibleClears the local (this player only) visibility setting of a vehicle part, so the state set by the server comes back. Without a part name it clears the local settings of all parts of the vehicle.