-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.lua
62 lines (49 loc) · 1.4 KB
/
client.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
local ESX = exports.es_extended:getSharedObject()
local Vehicles = json.decode(LoadResourceFile(GetCurrentResourceName(), 'vehicles.json'))
local rootOptions = {}
for k, v in pairs(Vehicles) do
local options = {}
for kk, vv in pairs(v) do
local menu = ('spawn:%s:%s'):format(k, kk)
options[kk] = {
title = kk,
menu = menu
}
local moarOptions = {}
for kkk, vvv in pairs(vv) do
moarOptions[kkk] = {
title = vvv,
image = ('https://docs.fivem.net/vehicles/%s.webp'):format(kkk),
onSelect = function()
ESX.Game.SpawnVehicle(joaat(kkk), GetEntityCoords(cache.ped), GetEntityHeading(cache.ped), function(vehicle)
local currVehicle <const> = GetVehiclePedIsIn(cache.ped, false)
if currVehicle ~= 0 then ESX.Game.DeleteVehicle(currVehicle) end
SetPedIntoVehicle(cache.ped, vehicle, -1)
end, true)
end
}
end
lib.registerContext({
id = menu,
title = kk,
menu = 'spawn:' .. k,
options = moarOptions
})
end
lib.registerContext({
id = 'spawn:' .. k,
title = k,
menu = 'spawnVehicle',
options = options
})
rootOptions[k] = {
title = k,
menu = 'spawn:' .. k
}
end
lib.registerContext({
id = 'spawnVehicle',
title = 'Spawn de Veiculos',
options = rootOptions
})
RegisterCommand('spawnveh', function() lib.showContext('spawnVehicle') end)