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

This page is incomplete! Help wanted!

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.

Syntax

setVehicleModelDummyPosition ( )

Code Examples

client

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