gta.createVehicle: Difference between revisions
No edit summary |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
|parametersCS = int model, [ Vec3 position ] | |parametersCS = int model, [ Vec3 position ] | ||
|parameter1 = int model The vehicle model ID. | |parameter1 = int model The vehicle model ID. | ||
|parameter2 = Vec3 position optional Vec3(0.0,0.0,0.0) The position for the vehicle. | |parameter2 = Vec3 position optional Vec3(0.0, 0.0, 0.0) The position for the vehicle. | ||
|return1 = Vehicle The vehicle handle. | |return1 = Vehicle The vehicle handle. | ||
|returnFail1 = null n/a | |returnFail1 = null n/a | ||
|usage = add a vehicle | |usage = add a vehicle | ||
|returnInfo = a handle to the vehicle | |returnInfo = a handle to the vehicle | ||
|bcMaxVersion = 1.0.71 | |bcMaxVersion = 1.0.71 | ||
|bcName = game.createVehicle | |bcName = game.createVehicle | ||
|notes = [[ | |notes = Use the [[addToWorld|addToWorld]] function afterwards to add the vehicle to the players games. | ||
|exampleJSSS = addCommandHandler("vehicle", function(command, parameters, client) { | |||
var model = parseInt(parameters); | |||
var vehicle = gta.createVehicle(model, client.player.position); | |||
addToWorld(vehicle); | |||
}); | |||
|exampleJSCS = addCommandHandler("vehicle", function(command, parameters) { | |||
var model = parseInt(parameters); | |||
var vehicle = gta.createVehicle(model, localPlayer.position); | |||
addToWorld(vehicle); | |||
}); | |||
}} | }} |
Latest revision as of 17:35, 1 February 2021
Function
Server and Client
Online and Offline
Server: | Vehicle gta.createVehicle(int model, Vec3 position) |
Client: | Vehicle gta.createVehicle(int model, [ Vec3 position ]) |
Parameters
1) | int | model | The vehicle model ID. |
2) | Vec3 | position | Optional, defaults to Vec3(0.0,. 0.0, 0.0) The position for the vehicle. |
Return
Vehicle | The vehicle handle. |
Notes
- Use the addToWorld function afterwards to add the vehicle to the players games.
Examples
Example 1 - JavaScript - Server-Side:
addCommandHandler("vehicle", function(command, parameters, client) {
var model = parseInt(parameters); var vehicle = gta.createVehicle(model, client.player.position); addToWorld(vehicle);
});
Example 2 - JavaScript - Client-Side:
addCommandHandler("vehicle", function(command, parameters) {
var model = parseInt(parameters); var vehicle = gta.createVehicle(model, localPlayer.position); addToWorld(vehicle);
});
Compatibility
- This function was previously named
game.createVehicle
in version 1.0.71.
Related
Server Related
getVehicleCount
getVehicles
gta.createVehicle
vehicle.children
vehicle.clearExistsFor
vehicle.colour1
vehicle.colour2
vehicle.colour3
vehicle.colour4
vehicle.dimension
vehicle.engine
vehicle.existsFor
vehicle.fix
vehicle.getData
vehicle.getOccupant
vehicle.getOccupants
vehicle.getRotation
vehicle.heading
vehicle.id
vehicle.interior
vehicle.isCreatedFor
vehicle.isLocal
vehicle.isOwner
vehicle.isSyncer
vehicle.isType
vehicle.locked
vehicle.lockedStatus
vehicle.matrix
vehicle.modelIndex
vehicle.name
vehicle.netFlags
vehicle.parent
vehicle.position
vehicle.randomiseColours
vehicle.removeAllData
vehicle.removeData
vehicle.resource
vehicle.rotation
vehicle.setColours
vehicle.setData
vehicle.setExistsFor
vehicle.setRGBColours
vehicle.setRotation
vehicle.setSyncer
vehicle.streamInDistance
vehicle.streamOutDistance
vehicle.strongGrip
vehicle.syncer
vehicle.syncerId
vehicle.turnVelocity
vehicle.type
vehicle.velocity
Client Related
createVehicle
getVehicleCount
getVehicles
gta.createVehicle
vehicle.addOnXRotation
vehicle.addOnZRotation
vehicle.addUpgrade
vehicle.affectedByGravity
vehicle.alarm
vehicle.alpha
vehicle.appearance
vehicle.beingCarriedByCrane
vehicle.blow
vehicle.boundingCentre
vehicle.boundingMax
vehicle.boundingMin
vehicle.boundingRadius
vehicle.centerOfMass
vehicle.children
vehicle.clearExistsFor
vehicle.collisionBoxCount
vehicle.collisionBoxes
vehicle.collisionLineCount
vehicle.collisionLines
vehicle.collisionPower
vehicle.collisionsEnabled
vehicle.collisionSphereCount
vehicle.collisionSpheres
vehicle.collisionVertexCount
vehicle.collisionVertices
vehicle.colour1
vehicle.colour2
vehicle.colour3
vehicle.colour4
vehicle.dimension
vehicle.dirtLevel
vehicle.distanceFromCentreOfMassToBaseOfModel
vehicle.driveTo
vehicle.drowned
vehicle.enableGPS
vehicle.engine
vehicle.engineHealth
vehicle.existsFor
vehicle.fix
vehicle.flipped
vehicle.flyTo
vehicle.gear
vehicle.getComponentWorldPosition
vehicle.getData
vehicle.getDoorStatus
vehicle.getLightStatus
vehicle.getOccupant
vehicle.getOccupants
vehicle.getPanelStatus
vehicle.getRotation
vehicle.getSuspensionHeight
vehicle.getWheelStatus
vehicle.handlingIndex
vehicle.hasRoof
vehicle.heading
vehicle.health
vehicle.health
vehicle.heightAboveRoad
vehicle.horn
vehicle.id
vehicle.interior
vehicle.inWater
vehicle.isCreatedFor
vehicle.island
vehicle.isLocal
vehicle.isOnScreen
vehicle.isOwner
vehicle.isSyncer
vehicle.isType
vehicle.lights
vehicle.lightsStatus
vehicle.livery
vehicle.locked
vehicle.lockedStatus
vehicle.markAsNoLongerNeeded
vehicle.mass
vehicle.matrix
vehicle.model
vehicle.modelIndex
vehicle.name
vehicle.netFlags
vehicle.onScreen
vehicle.onSide
vehicle.openTop
vehicle.openTrunk
vehicle.parent
vehicle.petrolTankHealth
vehicle.position
vehicle.radioStation
vehicle.removeAllData
vehicle.removeData
vehicle.removeUpgrade
vehicle.resource
vehicle.rotation
vehicle.setCarCruiseSpeed
vehicle.setCarMission
vehicle.setColours
vehicle.setData
vehicle.setDoorStatus
vehicle.setDrivingStyle
vehicle.setExistsFor
vehicle.setHazardLights
vehicle.setLightStatus
vehicle.setPaintJob
vehicle.setPanelStatus
vehicle.setProofs
vehicle.setProofs
vehicle.setRGBColours
vehicle.setRotation
vehicle.setSuspensionHeight
vehicle.setSyncer
vehicle.setWheelStatus
vehicle.siren
vehicle.status
vehicle.streamInDistance
vehicle.streamOutDistance
vehicle.subType
vehicle.syncer
vehicle.syncerId
vehicle.taxiLight
vehicle.turnVelocity
vehicle.type
vehicle.upsideDown
vehicle.velocity
vehicle.visible
vehicle.wanderRandomly