GetVehiclesOfType: Difference between revisions
Lars-marcel (talk | contribs) No edit summary |
|||
Line 28: | Line 28: | ||
==See Also== | ==See Also== | ||
{{Vehicle functions}} | {{Vehicle functions}} | ||
{{Server function}} | |||
__NOTOC__ | |||
This function scans through all the current vehicles and returns the ones matching the given model. | |||
==Syntax== | |||
<syntaxhighlight lang="lua">table getVehiclesOfType ( int model )</syntaxhighlight> | |||
===Required Arguments=== | |||
*'''model''': The model of vehicles you want. | |||
===Returns=== | |||
Returns a table of existing vehicles matching the specified model. | |||
==Example== | |||
This example finds all landstalkers on the map and moves them 5 units to the left. | |||
<syntaxhighlight lang="lua"> | |||
-- Find all the vehicles with the model 400 (landstalker) | |||
vehicles = getVehiclesOfType ( 400 ) | |||
-- Loop through the vehicle list | |||
for vehicleKey, vehicleValue in ipairs ( vehicles ) do | |||
-- Get the vehicle's position | |||
x, y, z = getElementPosition ( vehicleValue ) | |||
-- Move the vehicle to the left | |||
setElementPosition ( vehicleValue, x - 5, y, z ) | |||
end | |||
</syntaxhighlight> | |||
==See Also== | |||
{{Vehicle functions}} | |||
{{Server function}} | |||
__NOTOC__ | |||
This function scans through all the current vehicles and returns the ones matching the given model. | |||
==Syntax== | |||
<syntaxhighlight lang="lua">table getVehiclesOfType ( int model )</syntaxhighlight> | |||
===Required Arguments=== | |||
*'''model''': The model of vehicles you want. | |||
===Returns=== | |||
Returns a table of existing vehicles matching the specified model. | |||
==Example== | |||
This example finds all landstalkers on the map and moves them 5 units to the left. | |||
<syntaxhighlight lang="lua"> | |||
-- Find all the vehicles with the model 400 (landstalker) | |||
vehicles = getVehiclesOfType ( 400 ) | |||
-- Loop through the vehicle list | |||
for vehicleKey, vehicleValue in ipairs ( vehicles ) do | |||
-- Get the vehicle's position | |||
x, y, z = getElementPosition ( vehicleValue ) | |||
-- Move the vehicle to the left | |||
setElementPosition ( vehicleValue, x - 5, y, z ) | |||
end | |||
</syntaxhighlight> | |||
==See Also== | |||
{{Vehicle functions}} | |||
[[de:GetVehiclesOfType]] |
Revision as of 11:53, 24 August 2012
This function scans through all the current vehicles and returns the ones matching the given model.
Syntax
table getVehiclesOfType ( int model )
Required Arguments
- model: The model of vehicles you want.
Returns
Returns a table of existing vehicles matching the specified model.
Example
This example finds all landstalkers on the map and moves them 5 units to the left.
-- Find all the vehicles with the model 400 (landstalker) vehicles = getVehiclesOfType ( 400 ) -- Loop through the vehicle list for vehicleKey, vehicleValue in ipairs ( vehicles ) do -- Get the vehicle's position x, y, z = getElementPosition ( vehicleValue ) -- Move the vehicle to the left setElementPosition ( vehicleValue, x - 5, y, z ) end
See Also
- 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
This function scans through all the current vehicles and returns the ones matching the given model.
Syntax
table getVehiclesOfType ( int model )
Required Arguments
- model: The model of vehicles you want.
Returns
Returns a table of existing vehicles matching the specified model.
Example
This example finds all landstalkers on the map and moves them 5 units to the left.
-- Find all the vehicles with the model 400 (landstalker) vehicles = getVehiclesOfType ( 400 ) -- Loop through the vehicle list for vehicleKey, vehicleValue in ipairs ( vehicles ) do -- Get the vehicle's position x, y, z = getElementPosition ( vehicleValue ) -- Move the vehicle to the left setElementPosition ( vehicleValue, x - 5, y, z ) end
See Also
- 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
This function scans through all the current vehicles and returns the ones matching the given model.
Syntax
table getVehiclesOfType ( int model )
Required Arguments
- model: The model of vehicles you want.
Returns
Returns a table of existing vehicles matching the specified model.
Example
This example finds all landstalkers on the map and moves them 5 units to the left.
-- Find all the vehicles with the model 400 (landstalker) vehicles = getVehiclesOfType ( 400 ) -- Loop through the vehicle list for vehicleKey, vehicleValue in ipairs ( vehicles ) do -- Get the vehicle's position x, y, z = getElementPosition ( vehicleValue ) -- Move the vehicle to the left setElementPosition ( vehicleValue, x - 5, y, z ) end
See Also
- 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