|
Returns
|
Vehicle
|
|
Prototype
|
Vehicle.Create(number, Vector3, Angle)
|
|
Description
|
No description
|
Description
Spawns a vehicle with a
model id at a position and angle.
Example
function PlayerChat(args)
if args.text == "/spawn" then
Vehicle.Create(2, args.player:GetPosition(), Angle(0, 0, 0))
return false
end
return true
end
Events:Subscribe("PlayerChat", PlayerChat)
|
Returns
|
Vehicle
|
|
Prototype
|
Vehicle.Create(table)
|
|
Description
|
No description
|
Description
Spawns a vehicle using an argument table.
The following arguments are supported:
- number model_id
- Vector3 position
- Angle angle
- string template (List can be found here)
- string decal (List can be found here)
- number health
- Color tone1
- Color tone2
- boolean enabled
- World world
- number mass
- Vector3 linear_velocity
- Vector3 angular_velocity
- boolean invulnerable
Example
PlayerChat = function(args)
local words = args.text:split(" ")
if words[1] == "/spawn" then
if words[2] then
local spawnArgs = {}
spawnArgs.position = args.player:GetPosition()
spawnArgs.angle = args.player:GetAngle()
spawnArgs.model_id = tonumber(words[2])
spawnArgs.world = args.player:GetWorld()
spawnArgs.tone1 = Color(255, 80, 80)
spawnArgs.tone2 = Color(200, 100, 100)
Vehicle.Create(spawnArgs)
else
args.player:SendChatMessage("Use: /spawn modelid", Color(200, 100, 100))
end
return false
end
return true
end
Events:Subscribe("PlayerChat", PlayerChat)