forked from Andyyy7666/HelicopterHUD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.lua
133 lines (118 loc) · 4.73 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
local UI = {
x = 0.3,
y = 0.43,
}
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)
if Heli then
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 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
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
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
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
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)
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)
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)
if Heli then
local PedVehicle = GetVehiclePedIsIn(GetPlayerPed(-1),false)
local HeliSpeed = GetEntitySpeed(GetVehiclePedIsIn(GetPlayerPed(-1), false)) * 2.24
local Engine = GetIsVehicleEngineRunning(PedVehicle)
local Height = GetEntityHeightAboveGround(PedVehicle)
if Height < 3.0 and HeliSpeed == 0 and Engine then
Citizen.Wait(5000)
SetVehicleEngineOn(PedVehicle, false, true, true)
end
end
end
end)