SpawnVehicle
From Multi Theft Auto: Wiki
Spawns a vehicle at any given position and rotation
Syntax
Required Arguments
- theVehicle: The vehicle you wish to spawn
- x: The x position you wish to spawn the vehicle at
- y: The x position you wish to spawn the vehicle at
- z: The x position you wish to spawn the vehicle at
Optional Arguments
NOTE: When using optional arguments, you must supply all arguments before the one you wish to use. For more information on optional arguments, see Optional Arguments.
- rx: The x rotation you wish to spawn the vehicle at
- ry: The y rotation you wish to spawn the vehicle at
- rz: The z rotation you wish to spawn the vehicle at
Returns
Returns true if the vehicle spawned successfully, false if the passed argument does not exist or is not a vehicle.
Example
Click to collapse [-]
ServerWith this feature, we spawn vehicle
function myCommandHandler(thePlayer, command) local x, y, z = getElementPosition(thePlayer) local RaceVehicle = createVehicle ( 411, 0, 0, 0 ) local spawnVeh = spawnVehicle ( RaceVehicle, x+3, y+3, z ) end if spawnVeh then outputChatBox("Vehicle was spawned", thePlayer) else outputChatBox("Error",thePlayer) end end addCommandHandler("spawnvehicle", myCommandHandler)
Related scripting functions
- addVehicleUpgrade
- attachTrailerToVehicle
- blowVehicle
- createVehicle
- detachTrailerFromVehicle
- fixVehicle
- getVehicleColor
- getVehicleCompatibleUpgrades
- getVehicleController
- getVehicleDoorState
- getVehicleEngineState
- getVehicleLandingGearDown
- getVehicleLightState
- getVehicleMaxPassengers
- getVehicleName
- getVehicleOccupant
- getVehicleOccupants
- getVehicleOverrideLights
- getVehiclePaintjob
- getVehiclePanelState
- getVehicleSirensOn
- getVehiclesOfType
- getVehicleTowedByVehicle
- getVehicleTowingVehicle
- getVehicleTurnVelocity
- getVehicleTurretPosition
- getVehicleType
- getVehicleUpgradeOnSlot
- getVehicleUpgrades
- getVehicleUpgradeSlotName
- getVehicleWheelStates
- getVehicleDoorOpenRatio
- getVehicleHandling
- getModelHandling
- getOriginalHandling
- isVehicleDamageProof
- isVehicleFuelTankExplodable
- isVehicleLocked
- isVehicleOnGround
- removeVehicleUpgrade
- resetVehicleExplosionTime
- resetVehicleIdleTime
- respawnVehicle
- setVehicleColor
- setVehicleDamageProof
- setVehicleDoorState
- setVehicleDoorsUndamageable
- setVehicleEngineState
- setVehicleFuelTankExplodable
- setVehicleIdleRespawnDelay
- setVehicleLandingGearDown
- setVehicleLightState
- setVehicleLocked
- setVehicleOverrideLights
- setVehiclePaintjob
- setVehiclePanelState
- setVehicleRespawnDelay
- setVehicleRespawnPosition
- setVehicleSirensOn
- setVehicleTurretPosition
- setVehicleDoorOpenRatio
- setVehicleHandling
- setModelHandling
- setVehicleTurnVelocity
- setVehicleWheelStates
- spawnVehicle
- toggleVehicleRespawn
- getTrainDirection
- getTrainSpeed
- getVehicleHeadLightColor
- getVehicleModelFromName
- getVehicleNameFromModel
- isTrainDerailable
- isTrainDerailed
- isVehicleBlown
- isVehicleTaxiLightOn
- setTrainDerailable
- setTrainDerailed
- setTrainDirection
- setTrainSpeed
- setVehicleHeadLightColor
- setVehicleTaxiLightOn
- getVehicleVariant
- setVehicleVariant
FROM VERSION 1.3.3 r5394 ONWARDS