setVehicleModelDummyPosition | Multi Theft Auto: Wiki Skip to content

setVehicleModelDummyPosition

Client-side
Server-side
Shared
Needs checking

This function was partially migrated from the old wiki. Please review manually:

  • Missing section: Allowed dummies

Pair: getVehicleModelDummyPosition

Manual Review Required

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


This function sets the position of the dummies contained in a vehicle model. Use setVehicleComponentPosition to adjust the vehicle component positions.

OOP Syntax Help! I don't understand this!

Syntax

bool setVehicleModelDummyPosition ( int modelID, string dummy, float x, float y, float z )
Required Arguments
  • modelID: The model ID which you want to apply the change to
  • dummy: The dummy whose position you want to change
  • x: MISSING_PARAM_DESC
  • y: MISSING_PARAM_DESC
  • z: MISSING_PARAM_DESC

Returns

  • bool: value

Returns true if everything went fine, false otherwise.

Code Examples

shared

Given example will move all the dummies in vehicle that player is sitting in up and down, after he uses /move command.

local dummies = {
"light_front_main",
"light_rear_main",
"light_front_second",
"light_rear_second",
"seat_front",
"seat_rear",
"exhaust",
"engine",
"gas_cap",
"trailer_attach",
"hand_rest",
"exhaust_second",
"wing_airtrail",
"veh_gun"
}
local cache = {}
function move()
local veh = getPedOccupiedVehicle( localPlayer )
if not veh then return end
local model = getElementModel(veh)
for i,dum in ipairs(dummies) do
setVehicleModelDummyPosition(model, dum, cache[dum][1], cache[dum][2], cache[dum][3] + math.sin(getTickCount()/1500))
end
end
addCommandHandler( "move", function()
local veh = getPedOccupiedVehicle( localPlayer )
if not veh then return end
local model = getElementModel(veh)
for i,dum in ipairs(dummies) do
local v = {getVehicleModelDummyPosition(model, dum)}
cache[dum] = v
end
addEventHandler("onClientRender", root, move)
end)

See Also

Vehicle Functions