This repository has been archived by the owner on Apr 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
/
client_interactions.lua
92 lines (87 loc) · 3.32 KB
/
client_interactions.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
CreateThread(function()
exports['qb-target']:AddTargetBone(Config.PetrolCanRefuelBones,{
options = {
{
type = "client",
event = 'cc-fuel:client:petrolcanrefuel',
label = 'Refuel Car',
icon = 'fas fa-gas-pump',
item = 'weapon_petrolcan',
canInteract = function(entity)
if GetVehicleEngineHealth(entity) <= 0 then return false end
if isFueling == false then
local curGasCanDurability = GetCurrentGasCanDurability()
if curGasCanDurability == nil then return false end
if curGasCanDurability > 0 then return true end
return false
end
return false
end
},
},
distance = 2.5,
})
exports['qb-target']:AddTargetBone(Config.SiphonBones,{
options = {
{
type="client",
event="cc-fuel:client:siphonfuel",
label = "Siphon Fuel",
icon = 'fas fa-gas-pump',
item = 'fuelsiphon',
canInteract = function(entity)
if GetVehicleEngineHealth(entity) <= 0 then return false end
if isFueling then return false end
local curGasCanDurability = GetCurrentGasCanDurability()
if curGasCanDurability == nil then return false end
if curGasCanDurability >= 100 then return false end
return Config.AllowFuelSiphoning
end
}
},
distance = 3.0,
})
exports['qb-target']:AddTargetModel(Config.GasPumpModels, {
options = {
{
icon = "fas fa-gas-pump",
label = "Get Fuel",
action = function(entity)
TriggerEvent("cc-fuel:client:pumprefuel", entity)
end
},
{
type = "client",
event = "cc-fuel:client:buypetrolcan",
icon = "fas fa-gas-pump",
label = "Buy Petrol Can"
},
{
type = "client",
event = "cc-fuel:client:refillpetrolcan",
icon = "fas fa-gas-pump",
label = "Refuel Petrol Can",
canInteract = function(entity)
return CanPumpRefuelPetrolCan()
end
}
},
distance = 3.0
})
if Config.Blips then
for k, v in pairs(Config.FuelStations) do
FuelStationBlip = AddBlipForCoord(v.x, v.y, v.z)
SetBlipSprite(FuelStationBlip, Config.BlipSpirte)
SetBlipDisplay(FuelStationBlip, 2)
SetBlipScale(FuelStationBlip, Config.BlipSize)
SetBlipAsShortRange(FuelStationBlip, true)
SetBlipColour(FuelStationBlip, Config.BlipColor)
BeginTextCommandSetBlipName("STRING")
AddTextComponentSubstringPlayerName(Config.BlipLabel)
EndTextCommandSetBlipName(FuelStationBlip)
end
end
end)
AddEventHandler('onResourceStop',function(name)
if (GetCurrentResourceName() ~= name) then return end
end)