-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevtools_client.lua
More file actions
218 lines (171 loc) · 5.52 KB
/
devtools_client.lua
File metadata and controls
218 lines (171 loc) · 5.52 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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
local coordsVisible = false
noClip = false
noClipSpeed = 1
noClipLabel = nil
noClipSpeeds = {
"Very Slow",
"Slow",
"Normal",
"Fast",
"Very Fast",
"Extremely Fast",
"Extremely Fast v2.0",
"Max Speed"
}
Citizen.CreateThread(function()
while true do
local sleepThread = 250
if coordsVisible then
sleepThread = 5
local playerPed = PlayerPedId()
local playerX, playerY, playerZ = table.unpack(GetEntityCoords(playerPed))
local playerH = GetEntityHeading(playerPed)
DrawGenericText(("~r~X~w~: %s ~r~Y~w~: %s ~r~Z~w~: %s ~r~H~w~: %s"):format(FormatCoord(playerX), FormatCoord(playerY), FormatCoord(playerZ), FormatCoord(playerH)))
end
Citizen.Wait(sleepThread)
end
end)
Citizen.CreateThread(function()
while true do
if noClip then
local noclipEntity = PlayerPedId()
if IsPedInAnyVehicle(noclipEntity, false) then
local vehicle = GetVehiclePedIsIn(noclipEntity, false)
if GetPedInVehicleSeat(vehicle, -1) == noclipEntity then
noclipEntity = vehicle
else
noclipEntity = nil
end
end
FreezeEntityPosition(noclipEntity, true)
SetEntityInvincible(noclipEntity, true)
DisableControlAction(0, 31, true)
DisableControlAction(0, 30, true)
DisableControlAction(0, 44, true)
DisableControlAction(0, 20, true)
DisableControlAction(0, 32, true)
DisableControlAction(0, 33, true)
DisableControlAction(0, 34, true)
DisableControlAction(0, 35, true)
local yoff = 0.0
local zoff = 0.0
if IsControlJustPressed(0, 21) then
noClipSpeed = noClipSpeed + 1
if noClipSpeed > #noClipSpeeds then
noClipSpeed = 1
end
end
if IsDisabledControlPressed(0, 32) then
yoff = 0.25;
end
if IsDisabledControlPressed(0, 33) then
yoff = -0.25;
end
if IsDisabledControlPressed(0, 34) then
SetEntityHeading(PlayerPedId(), GetEntityHeading(PlayerPedId()) + 2.0)
end
if IsDisabledControlPressed(0, 35) then
SetEntityHeading(PlayerPedId(), GetEntityHeading(PlayerPedId()) - 2.0)
end
if IsDisabledControlPressed(0, 44) then
zoff = 0.1;
end
if IsDisabledControlPressed(0, 20) then
zoff = -0.1;
end
local newPos = GetOffsetFromEntityInWorldCoords(noclipEntity, 0.0, yoff * (noClipSpeed + 0.3), zoff * (noClipSpeed + 0.3))
local heading = GetEntityHeading(noclipEntity)
SetEntityVelocity(noclipEntity, 0.0, 0.0, 0.0)
SetEntityRotation(noclipEntity, 0.0, 0.0, 0.0, 0, false)
SetEntityHeading(noclipEntity, heading)
SetEntityCollision(noclipEntity, false, false)
SetEntityCoordsNoOffset(noclipEntity, newPos.x, newPos.y, newPos.z, true, true, true)
Citizen.Wait(0)
FreezeEntityPosition(noclipEntity, false)
SetEntityInvincible(noclipEntity, false)
SetEntityCollision(noclipEntity, true, true)
else
Citizen.Wait(200)
end
end
end)
AddEventHandler("EasyAdmin:BuildMainMenuOptions", function()
trainerMenu = _menuPool:AddSubMenu(mainMenu, "Devtools","",true)
trainerMenu:SetMenuWidthOffset(menuWidth)
if permissions["devtools_coords"] and DevConfig.coords then
local thisItem = NativeUI.CreateCheckboxItem("Coords","") -- create our new item
trainerMenu:AddItem(thisItem) -- thisPlayer is global.
thisItem.CheckboxEvent = function(sender, item, checked_)
if item == thisItem then
ToggleCoords()
end
end
end
if permissions["devtools_noclip"] and DevConfig.noclip then
local thisItem = NativeUI.CreateCheckboxItem('Noclip', noClip, "")
trainerMenu:AddItem(thisItem)
thisItem.CheckboxEvent = function(sender, item, status)
if item == thisItem then
noClip = not noClip
if not noClip then
noClipSpeed = 1
end
end
end
end
if permissions["devtools_vanish"] and DevConfig.vanish then
local thisItem = NativeUI.CreateCheckboxItem('Vanish', not IsEntityVisible(PlayerPedId()), "")
trainerMenu:AddItem(thisItem)
thisItem.CheckboxEvent = function(sender, item, status)
if item == thisItem then
local playerPed = PlayerPedId()
SetEntityVisible(playerPed, not IsEntityVisible(playerPed))
end
end
end
if permissions["devtools_tpm"] and DevConfig.tpm then
local thisItem = NativeUI.CreateItem('TPM', "")
trainerMenu:AddItem(thisItem)
thisItem.Activated = function(ParentMenu,SelectedItem)
TriggerEvent('esx:tpm', source)
end
end
end)
function DrawGenericText(text)
SetTextColour(186, 186, 186, 255)
SetTextFont(7)
SetTextScale(0.378, 0.378)
SetTextWrap(0.0, 1.0)
SetTextCentre(false)
SetTextDropshadow(0, 0, 0, 0, 255)
SetTextEdge(1, 0, 0, 0, 205)
SetTextEntry("STRING")
AddTextComponentString(text)
DrawText(0.40, 0.00)
end
FormatCoord = function(coord)
if coord == nil then
return "unknown"
end
return tonumber(string.format("%.2f", coord))
end
ToggleCoords = function()
coordsVisible = not coordsVisible
end
RegisterNetEvent('esx:tpm')
AddEventHandler('esx:tpm', function()
local WaypointHandle = GetFirstBlipInfoId(8)
if DoesBlipExist(WaypointHandle) then
local waypointCoords = GetBlipInfoIdCoord(WaypointHandle)
for height = 1, 1000 do
SetPedCoordsKeepVehicle(PlayerPedId(), waypointCoords["x"], waypointCoords["y"], height + 0.0)
local foundGround, zPos = GetGroundZFor_3dCoord(waypointCoords["x"], waypointCoords["y"], height + 0.0)
if foundGround then
SetPedCoordsKeepVehicle(PlayerPedId(), waypointCoords["x"], waypointCoords["y"], height + 0.0)
break
end
Citizen.Wait(5)
end
else
end
end)