-
Notifications
You must be signed in to change notification settings - Fork 5
/
client.lua
169 lines (142 loc) · 5.5 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
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
-- Config here
local UI = {
x = 0.3,
y = 0.43,
}
--[[
For support join my discord: https://discord.gg/Z9Mxu72zZ6
PRESETS:
Bottom of screen
x = 0.000,
y = 0.43,
Bottom right of screen
x = 0.3,
y = 0.43,
Top of screen
x = 0.000,
y = -0.43,
DO NOT EDIT ANYTHING BELOW THIS IF YOU DON'T KNOW WHAT YOU'RE DOING!
]]--
function Text(text, x, y, scale)
SetTextFont(4)
SetTextProportional(0)
SetTextScale(scale, scale)
SetTextEdge(1, 0, 0, 0, 255)
SetTextDropShadow(0, 0, 0, 0,255)
SetTextOutline()
SetTextJustification(0)
SetTextEntry("STRING")
AddTextComponentString(text)
DrawText(x, y)
end
Citizen.CreateThread(function()
while true do
Citizen.Wait(1)
local Ped = GetPlayerPed(-1)
local Heli = IsPedInAnyHeli(Ped)
local PedVehicle = GetVehiclePedIsIn(GetPlayerPed(-1),false)
local HeliSpeed = GetEntitySpeed(GetVehiclePedIsIn(GetPlayerPed(-1), false)) * 2.24
local Engine = GetIsVehicleEngineRunning(PedVehicle)
local Height = GetEntityHeightAboveGround(PedVehicle)
local MainRotorHealth = GetHeliMainRotorHealth(PedVehicle)
local TailRotorHealth = GetHeliTailRotorHealth(PedVehicle)
if Heli then
-- engine display
if Engine then
Text("~g~ENG", UI.x + 0.4016, UI.y + 0.476, 0.55)
Text("~g~__", UI.x + 0.4016, UI.y + 0.47, 0.79)
elseif Engine == false then
Text("~r~ENG", UI.x + 0.4016, UI.y + 0.476, 0.55)
Text("~r~__", UI.x + 0.4016, UI.y + 0.47, 0.79)
end
-- Main rotor display
if MainRotorHealth > 800 and Engine then
Text("~g~MAIN", UI.x + 0.4516, UI.y + 0.476, 0.55)
Text("~g~__", UI.x + 0.4516, UI.y + 0.47, 0.79)
elseif MainRotorHealth > 200 and MainRotorHealth < 800 and Engine then
Text("~y~MAIN", UI.x + 0.4516, UI.y + 0.476, 0.55)
Text("~y~__", UI.x + 0.4516, UI.y + 0.47, 0.79)
elseif MainRotorHealth < 200 and Engine then
Text("~r~MAIN", UI.x + 0.4516, UI.y + 0.476, 0.55)
Text("~r~__", UI.x + 0.4516, UI.y + 0.47, 0.79)
elseif Engine == false then
Text("~r~MAIN", UI.x + 0.4516, UI.y + 0.476, 0.55)
Text("~r~__", UI.x + 0.4516, UI.y + 0.47, 0.79)
end
-- Tail rotor display
if TailRotorHealth > 300 and Engine then
Text("~g~TAIL", UI.x + 0.5, UI.y + 0.476, 0.55)
Text("~g~__", UI.x + 0.5, UI.y + 0.47, 0.79)
elseif TailRotorHealth > 100 and TailRotorHealth < 300 and Engine then
Text("~y~TAIL", UI.x + 0.5, UI.y + 0.476, 0.55)
Text("~y~__", UI.x + 0.5, UI.y + 0.47, 0.79)
elseif TailRotorHealth < 100 and Engine then
Text("~r~TAIL", UI.x + 0.5, UI.y + 0.476, 0.55)
Text("~r~__", UI.x + 0.5, UI.y + 0.47, 0.79)
elseif Engine == false then
Text("~r~TAIL", UI.x + 0.5, UI.y + 0.476, 0.55)
Text("~r~__", UI.x + 0.5, UI.y + 0.47, 0.79)
end
-- Altitude and speed display
Text(math.ceil(Height), UI.x + 0.549, UI.y + 0.476, 0.45)
Text("ALTITUDE", UI.x + 0.549, UI.y + 0.502, 0.29)
Text(math.ceil(HeliSpeed), UI.x + 0.598, UI.y + 0.476, 0.45)
Text("AIR SPEED", UI.x + 0.598, UI.y + 0.502, 0.29)
if HeliSpeed < 0.9 and HeliSpeed > 0.1 then
Text("1", UI.x + 0.598, UI.y + 0.476, 0.45)
elseif HeliSpeed == 0.0 then
Text("0", UI.x + 0.598, UI.y + 0.476, 0.45)
end
-- Big rectangels on the ui
DrawRect(UI.x + 0.5, UI.y + 0.5, 0.255, 0.085, 25, 25, 25, 255)
DrawRect(UI.x + 0.5, UI.y + 0.5, 0.25, 0.075, 51, 51, 51, 255)
-- Smaller squares in the rectangels.
DrawRect(UI.x + 0.402, UI.y + 0.5, 0.040, 0.050, 25, 25, 25, 255)
DrawRect(UI.x + 0.4516, UI.y + 0.5, 0.040, 0.050, 25, 25, 25, 255)
DrawRect(UI.x + 0.5, UI.y + 0.5, 0.040, 0.050, 25, 25, 25, 255)
DrawRect(UI.x + 0.549, UI.y + 0.5, 0.040, 0.050, 25, 25, 25, 255)
DrawRect(UI.x + 0.598, UI.y + 0.5, 0.040, 0.050, 25, 25, 25, 255)
-- Slows down helicopter on landing and takeoff but not if it's flying fast close to the ground.
if HeliSpeed > 15.0 and Height < 30.0 then
SetEntityMaxSpeed(PedVehicle, 300.0)
elseif HeliSpeed > 15.0 and Height < 10.0 then
SetEntityMaxSpeed(PedVehicle, 20.0)
elseif Height < 3.0 then
SetEntityMaxSpeed(PedVehicle, 1.0)
elseif Height < 5.0 then
SetEntityMaxSpeed(PedVehicle, 2.0)
elseif Height > 5.0 and Height < 10.0 then
SetEntityMaxSpeed(PedVehicle, 3.0)
elseif Height > 10.0 and Height < 15.0 then
SetEntityMaxSpeed(PedVehicle, 4.0)
elseif Height > 15.0 and Height < 20.0 then
SetEntityMaxSpeed(PedVehicle, 6.0)
elseif Height > 20.0 and Height < 25.0 then
SetEntityMaxSpeed(PedVehicle, 7.0)
elseif Height > 25.0 and Height < 30.0 then
SetEntityMaxSpeed(PedVehicle, 10.0)
elseif Height > 30.0 then
SetEntityMaxSpeed(PedVehicle, 300.0)
end
end
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(1)
local Ped = GetPlayerPed(-1)
local Heli = IsPedInAnyHeli(Ped)
local PedVehicle = GetVehiclePedIsIn(GetPlayerPed(-1),false)
local HeliSpeed = GetEntitySpeed(GetVehiclePedIsIn(GetPlayerPed(-1), false)) * 2.24
local Engine = GetIsVehicleEngineRunning(PedVehicle)
local Height = GetEntityHeightAboveGround(PedVehicle)
-- Shuts down engine 5 seconds after landing.
if Heli then
if Height < 3.0 and HeliSpeed == 0 and Engine then
Citizen.Wait(5000)
SetVehicleEngineOn(PedVehicle, false, true, true)
end
end
end
end)
print("This resource is created by Andyyy#7666 if you find any buggs or need support please let me know on discord: https://discord.gg/Z9Mxu72zZ6")