setVehicleComponentScale | Multi Theft Auto: Wiki Skip to content

setVehicleComponentScale

Client-side
Server-side
Shared

Pair: getVehicleComponentScale

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function sets the component scale of a vehicle.

OOP Syntax Help! I don't understand this!

  • Method:vehicle:setComponentScale(...)

Syntax

bool setVehicleComponentScale ( vehicle theVehicle, string theComponent, float scaleX, float scaleY, float scaleZ, [ string base = "parent" ] )
Required Arguments
  • theVehicle: The vehicle you wish to set component scale.
  • theComponent: A vehicle component (this is the frame name from the model file of the component you wish to modify)
  • scaleX: The new x scale of this component.
  • scaleY: The new y scale of this component.
  • scaleZ: The new z scale of this component.
Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.

  • base (default: "parent"): A string representing what the supplied scale ( scaleX , scaleY , scaleZ ) is relative to. It can be one of the following values: parent : The scale is relative to the parent component. root : The scale is relative to the root component. world : The scale is a world scale, relative to the world's center of coordinates.

Returns

  • bool: value

Returns true if component scale was set successfully, false otherwise.

Code Examples

shared

Example 1:This example would set the scale of the component.

addCommandHandler("scs", -- short for 'set component scale'
function()
local theVeh = getPedOccupiedVehicle(localPlayer)
local getComponent = getVehicleComponents(theVeh) -- returns table with all the components of the vehicle
if (theVeh) then
for k in pairs (getComponent) do
local x, y, z = getVehicleComponentScale(theVeh, k) --get the scale of the component
setVehicleComponentScale(theVeh, k, x*2, y*2, z*2) -- double the sizes
end
end
end
)

See Also

Vehicle Functions