SetVehicleModelDummyPosition: Difference between revisions
Jump to navigation
Jump to search
(Changed example function to one that was supposed to be here) |
No edit summary |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Client function}} | {{Client function}} | ||
__NOTOC__ | __NOTOC__ | ||
{{New feature/item|3. | {{New feature/item|3.0157|1.5.6|14403| | ||
This function sets the position of the dummies contained in a vehicle model. Use [[setVehicleComponentPosition]] to adjust the vehicle component positions. | This function sets the position of the dummies contained in a vehicle model. Use [[setVehicleComponentPosition]] to adjust the vehicle component positions. | ||
}} | }} | ||
Line 7: | Line 7: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool setVehicleModelDummyPosition ( int modelID, | bool setVehicleModelDummyPosition ( int modelID, string dummy, float x, float y, float z ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[Vehicle]].setVehicleModelDummyPosition||getVehicleModelDummyPosition }} | {{OOP||[[Vehicle]].setVehicleModelDummyPosition||getVehicleModelDummyPosition }} | ||
Line 17: | Line 17: | ||
==Allowed dummies== | ==Allowed dummies== | ||
{{VehicleDummies}} | |||
===Returns=== | ===Returns=== |
Latest revision as of 12:29, 18 January 2021
This function sets the position of the dummies contained in a vehicle model. Use setVehicleComponentPosition to adjust the vehicle component positions.
Syntax
bool setVehicleModelDummyPosition ( int modelID, string dummy, float x, float y, float z )
OOP Syntax Help! I don't understand this!
- Method: Vehicle.setVehicleModelDummyPosition(...)
- Counterpart: getVehicleModelDummyPosition
Required Arguments
- modelID: The model ID which you want to apply the change to
- dummy: The dummy whose position you want to change
- posX, posY, posZ: The desired position
Allowed dummies
- light_front_main: Primary front lights position.
- light_rear_main: Primary rear lights position.
- light_front_second: Secondary front lights position.
- light_rear_second: Secondary rear lights position.
- seat_front: Front seat position.
- seat_rear: Rear seat position.
- exhaust: Exhaust fumes start position.
- engine: Engine smoke start position.
- gas_cap: Vehicle gas cap position (shooting it will explode vehicle).
- trailer_attach: Point at which trailers will be attached to vehicle.
- hand_rest: Point at which the steer of a bike is held.
- exhaust_second: Secondary exhaust position (for example in NRG-500)
- wing_airtrail: Point from which air trail will show in airplanes, visible while in sharp turns.
- veh_gun: Vehicle gun position (ex. Rustler).
Returns
Returns true if everything went fine, false otherwise.
Example
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
- areVehicleLightsOn
- getHeliBladeCollisionsEnabled
- getHelicopterRotorSpeed
- getVehicleAdjustableProperty
- getVehicleComponentPosition
- getVehicleComponentRotation
- getVehicleComponents
- getVehicleComponentScale
- getVehicleComponentVisible
- getVehicleCurrentGear
- getVehicleDummyPosition
- getVehicleGravity
- getVehicleLandingGearDown
- getVehicleModelDummyDefaultPosition
- getVehicleModelDummyPosition
- getVehicleModelExhaustFumesPosition
- getVehicleModelWheelSize
- getVehicleNitroCount
- getVehicleNitroLevel
- getVehicleWheelFrictionState
- getVehicleWheelScale
- isTrainChainEngine
- isVehicleNitroActivated
- isVehicleNitroRecharging
- isVehicleOnGround
- isVehicleWheelOnGround
- isVehicleWindowOpen
- resetVehicleComponentPosition
- resetVehicleComponentRotation
- resetVehicleComponentScale
- resetVehicleDummyPositions
- setHeliBladeCollisionsEnabled
- setHelicopterRotorSpeed
- setVehicleAdjustableProperty
- setVehicleComponentPosition
- setVehicleComponentRotation
- setVehicleComponentScale
- setVehicleComponentVisible
- setVehicleDummyPosition
- setVehicleGravity
- setVehicleLandingGearDown
- setVehicleModelDummyPosition
- setVehicleModelExhaustFumesPosition
- setVehicleModelWheelSize
- setVehicleNitroActivated
- setVehicleNitroCount
- setVehicleNitroLevel
- setVehicleWheelScale
- setVehicleWheelStates
- setVehicleWindowOpen
- Shared
- addVehicleUpgrade
- attachTrailerToVehicle
- blowVehicle
- createVehicle
- detachTrailerFromVehicle
- fixVehicle
- getOriginalHandling
- getTrainDirection
- getTrainPosition
- getTrainSpeed
- getTrainTrack
- getVehicleColor
- getVehicleCompatibleUpgrades
- getVehicleController
- getVehicleDoorOpenRatio
- getVehicleDoorState
- getVehicleEngineState
- getVehicleHandling
- getVehicleHeadLightColor
- getVehicleLandingGearDown
- getVehicleLightState
- getVehicleMaxPassengers
- getVehicleModelFromName
- getVehicleName
- getVehicleNameFromModel
- getVehicleOccupant
- getVehicleOccupants
- getVehicleOverrideLights
- getVehiclePaintjob
- getVehiclePanelState
- getVehiclePlateText
- getVehicleSirenParams
- getVehicleSirens
- getVehicleSirensOn
- getVehicleTowedByVehicle
- getVehicleTowingVehicle
- getVehicleTurretPosition
- getVehicleType
- getVehicleUpgradeOnSlot
- getVehicleUpgradeSlotName
- getVehicleUpgrades
- getVehicleVariant
- getVehicleWheelStates
- isTrainDerailable
- isTrainDerailed
- isVehicleBlown
- isVehicleDamageProof
- isVehicleFuelTankExplodable
- isVehicleLocked
- isVehicleOnGround
- isVehicleTaxiLightOn
- removeVehicleUpgrade
- setTrainDerailable
- setTrainDerailed
- setTrainDirection
- setTrainPosition
- setTrainSpeed
- setTrainTrack
- setVehicleColor
- setVehicleDamageProof
- setVehicleDoorOpenRatio
- setVehicleDoorState
- setVehicleDoorsUndamageable
- setVehicleEngineState
- setVehicleFuelTankExplodable
- setVehicleHandling
- setVehicleHeadLightColor
- setVehicleLandingGearDown
- setVehicleLightState
- setVehicleLocked
- setVehicleOverrideLights
- setVehiclePaintjob
- setVehiclePanelState
- setVehiclePlateText
- setVehicleSirens
- setVehicleSirensOn
- setVehicleTaxiLightOn
- setVehicleTurretPosition
- setVehicleVariant
- setVehicleWheelStates