Add Vehicle
Jump to navigation
Jump to search
Description
This code adds a vehicle of the specified model index when typing /v model
The model index defaults to 191 if it isn't specified or it isn't a number.
A chat message is also displayed for all players when the command is used.
Code
Lua, Server-Side, GTAC versions 1.0.71 and below:
addCommandHandler("v",function(commandName,arguments,client)
local player = client.player
local model = arguments:len() > 0 and tonumber(arguments) or 191
local position = {player.position.x + 0.2, player.position.y + 0.2, player.position.z}
local vehicle = game.createVehicle(model, player.game)
vehicle.game = player.game
vehicle.position = position
addToWorld(vehicle)
outputChatBox(player.name .. ' added a vehicle with model ID ' .. model .. '.', COLOUR_GREEN)
end)