|
1 | | --- Loads newmodels functions, which allow usage of custom model IDs "as if they were normal IDs" |
2 | | -loadstring(exports.newmodels_azul:import())() |
| 1 | +-- Method with exports |
| 2 | +-- These vehicles will be destroyed if newmodels_azul stops |
| 3 | +-- because they are children of that resource. |
3 | 4 |
|
4 | 5 | -- Vehicle model, x,y,z, rx,ry,rz, interior,dimension |
5 | 6 | local VEHICLE_SPAWNS = { |
6 | | - {525, -938.74, 1034.21, 23.59, 3.42, 2.85, 20.27, 0, 0}, |
7 | 7 | {490, -941.95, 1043.03, 24.25, 355.90, 356.51, 199.00, 0, 0}, |
8 | | - {-1, -951.79, 1069.05, 25.96, 356.28, 356.34, 204.01, 0, 0}, |
9 | | - {-5, -944.88, 1051.90, 24.84, 355.97, 356.23, 198.86, 0, 0}, |
| 8 | + {-1, -947.94, 1060.05, 25.96, 356.28, 356.34, 204.01, 0, 0}, |
10 | 9 | } |
11 | 10 |
|
12 | 11 | local function createVehicles() |
13 | 12 | for i, data in ipairs(VEHICLE_SPAWNS) do |
14 | 13 | local model, x, y, z, rx, ry, rz, interior, dimension = unpack(data) |
15 | | - local vehicle = createVehicle(model, x, y, z, rx, ry, rz) |
| 14 | + local vehicle = exports["newmodels_azul"]:createVehicle(model, x, y, z, rx, ry, rz) |
16 | 15 | if vehicle then |
17 | 16 | setElementInterior(vehicle, interior) |
18 | 17 | setElementDimension(vehicle, dimension) |
19 | | - print("#" .. i .. " - Created vehicle with ID " .. model .. " at " .. x .. ", " .. y .. ", " .. z) |
| 18 | + print("test_vehicles #" .. i .. " - Created vehicle with ID " .. model .. " at " .. x .. ", " .. y .. ", " .. z) |
20 | 19 | end |
21 | 20 | end |
22 | 21 | end |
23 | 22 | addEventHandler("onResourceStart", resourceRoot, createVehicles, false) |
24 | | - |
25 | | --- Outputs, for example: |
26 | | --- This vehicle has the custom model ID -1, which is based on the default model ID 490 (FBI Rancher) |
27 | | -addCommandHandler("myvehicle", function(player) |
28 | | - local vehicle = getPedOccupiedVehicle(player) |
29 | | - if not vehicle then |
30 | | - outputChatBox("You are not in a vehicle", player, 255, 0, 0) |
31 | | - return |
32 | | - end |
33 | | - local model = getElementModel(vehicle) |
34 | | - local baseModel = getElementBaseModel(vehicle) |
35 | | - if model == baseModel then |
36 | | - outputChatBox("This vehicle has the default model ID " .. model .. " ("..(tostring(getVehicleNameFromModel(model)) or "")..")", player, 0, 255, 0) |
37 | | - else |
38 | | - if not baseModel then |
39 | | - outputChatBox("This vehicle has the custom model ID " .. model .. ", but the base model ID could not be determined", player, 255, 0, 0) |
40 | | - return |
41 | | - end |
42 | | - outputChatBox("This vehicle has the custom model ID " .. model .. ", which is based on the default model ID " .. baseModel .. " ("..(tostring(getVehicleNameFromModel(baseModel)) or "")..")", player, 0, 255, 0) |
43 | | - end |
44 | | -end, false, false) |
0 commit comments