-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathclient.lua
More file actions
200 lines (159 loc) · 6.7 KB
/
client.lua
File metadata and controls
200 lines (159 loc) · 6.7 KB
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
local Core = nil
local framework = "NONE"
local cfg = lib.require('config')
local minDuration = cfg.minDuration
local maxDuration = cfg.maxDuration
lib.locale()
CreateThread(function()
Wait(5)
if cfg.core == 'qb-core' then
if GetResourceState(cfg.QBFramework) == 'starting' or GetResourceState(cfg.QBFramework) == 'started' then
framework = "QB"
end
elseif cfg.core == 'es_extended' then
if GetResourceState(cfg.ESXCoreName) == 'starting' or GetResourceState(cfg.ESXCoreName) == 'started' then
framework = "ESX"
end
end
end)
CreateThread(function()
Wait(5)
if framework == "QB" then
local Core = exports[cfg.QBFramework]:GetCoreObject()
--Fliperiino event
RegisterNetEvent('nc_carflip:flipcar')
AddEventHandler('nc_carflip:flipcar', function()
print("Fliping vehicle!")
return FlipCarOver()
end)
-- Fliperiino function
function FlipCarOver()
local ped = PlayerPedId()
local pedcoords = GetEntityCoords(ped)
local VehicleData = Core.Functions.GetClosestVehicle()
local finalDur = math.random(minDuration, maxDuration)
local dist = #(pedcoords - GetEntityCoords(VehicleData))
local success = lib.skillCheck({'easy', 'easy', {areaSize = cfg.areaSize, speedMultiplier = cfg.speedMultiplier}, 'easy'}, {'x', 'x', 'x', 'x'})
if dist <= 3 and IsVehicleOnAllWheels(VehicleData) == false then
if success then
RequestAnimDict('missfinale_c2ig_11')
while not HasAnimDictLoaded("missfinale_c2ig_11") do
Wait(10)
end
lib.progressCircle({
label = locale('notify.fliping'),
duration = finalDur,
position = cfg.position,
useWhileDead = cfg.useWhileDead,
canCancel = cfg.canCancel,
disable = {
car = cfg.disable,
},
anim = {
dict = 'missfinale_c2ig_11',
clip = 'pushcar_offcliff_m'
},
})
local carCoords = GetEntityRotation(VehicleData, 2)
SetEntityRotation(VehicleData, carCoords[1], 0, carCoords[3], 2, true)
SetVehicleOnGroundProperly(VehicleData)
lib.notify({
id = '1',
title = locale('notify.title'),
description = locale('notify.desc'),
position = cfg.position,
style = {
backgroundColor = '#243661',
color = '#909296'
},
icon = 'car',
iconColor = '#C53030'
})
ClearPedTasks(ped)
end
elseif IsVehicleOnAllWheels(VehicleData) ~= false then
lib.notify({
id = '1',
title = locale('notify.title'),
description = locale('notify.fail'),
position = cfg.position,
style = {
backgroundColor = '#243661',
color = '#D2D2D2'
},
icon = 'warning',
iconColor = '#C53030'
})
end
end
elseif framework == "ESX" then
local Core = exports[cfg.ESXCoreName]:getSharedObject()
--Fliperiino event
RegisterNetEvent('nc_carflip:flipcar')
AddEventHandler('nc_carflip:flipcar', function()
print("Fliping vehicle!")
return FlipCarOver()
end)
-- Fliperiino function
function FlipCarOver()
local ped = PlayerPedId()
local pedcoords = GetEntityCoords(ped)
local VehicleData = Core.Game.GetClosestVehicle()
print(json.encode(VehicleData))
local finalDur = math.random(minDuration, maxDuration)
local dist = #(pedcoords - GetEntityCoords(VehicleData))
local success = lib.skillCheck({'easy', 'easy', {areaSize = cfg.areaSize, speedMultiplier = cfg.speedMultiplier}, 'hard'}, {'x', 'x', 'x', 'x'})
if dist <= 3 and IsVehicleOnAllWheels(VehicleData) == false then
if success then
RequestAnimDict('missfinale_c2ig_11')
while not HasAnimDictLoaded("missfinale_c2ig_11") do
Wait(10)
end
lib.progressCircle({
label = locale('notify.fliping'),
duration = finalDur,
position = cfg.position,
useWhileDead = cfg.useWhileDead,
canCancel = cfg.canCancel,
disable = {
car = cfg.disable,
},
anim = {
dict = 'missfinale_c2ig_11',
clip = 'pushcar_offcliff_m'
},
})
local carCoords = GetEntityRotation(VehicleData, 2)
SetEntityRotation(VehicleData, carCoords[1], 0, carCoords[3], 2, true)
SetVehicleOnGroundProperly(VehicleData)
lib.notify({
id = '1',
title = locale('notify.title'),
description = locale('notify.desc'),
position = cfg.position,
style = {
backgroundColor = '#243661',
color = '#909296'
},
icon = 'car',
iconColor = '#C53030'
})
ClearPedTasks(ped)
end
elseif IsVehicleOnAllWheels(VehicleData) ~= false then
lib.notify({
id = '1',
title = locale('notify.title'),
description = locale('notify.fail'),
position = cfg.position,
style = {
backgroundColor = '#243661',
color = '#D2D2D2'
},
icon = 'warning',
iconColor = '#C53030'
})
end
end
end
end)