├── .github
└── ISSUE_TEMPLATE
│ ├── bug_report.yml
│ ├── improvement_request.yml
│ └── script_request.yml
├── HarmlessScript.lua
└── README.md
/.github/ISSUE_TEMPLATE/bug_report.yml:
--------------------------------------------------------------------------------
1 | name: Bug report
2 | description: Report bugs for existing features.
3 | title: "[BUG] "
4 | labels: bug
5 | body:
6 | - type: textarea
7 | attributes:
8 | label: What feature does this affect
9 | description: Name of the feature that you had this bug in.
10 | placeholder: |
11 | Example: Ragdoll Player (Loop)
12 | validations:
13 | required: true
14 | - type: textarea
15 | attributes:
16 | label: Describe the bug
17 | description: A clear description of what the bug is.
18 | validations:
19 | required: true
20 | - type: textarea
21 | attributes:
22 | label: How to replicate
23 | description: Steps to reproduce the behavior.
24 | placeholder: |
25 | 1. Go to '...'
26 | 2. Click on '...'
27 | 3. Scroll down to '...'
28 | 4. See error
29 | validations:
30 | required: true
31 | - type: textarea
32 | attributes:
33 | label: Expected Behavior
34 | description: A clear description of what you expected to happen.
35 | validations:
36 | required: true
37 | - type: textarea
38 | attributes:
39 | label: Possible evidence
40 | description: |
41 | Add any screenshots or videos to help explain your problem.
42 |
43 | Tip: To add screenshots or videos, just click on this area to make it stand out and then drag the files in.
44 | validations:
45 | required: false
46 | - type: textarea
47 | attributes:
48 | label: YimMenu logs
49 | description: |
50 | Could you please provide the YimMenu logs for the issue you encountered?
51 | validations:
52 | required: false
53 | - type: textarea
54 | attributes:
55 | label: Additional context
56 | description: Add any other context about the problem here.
57 | validations:
58 | required: false
59 | - type: checkboxes
60 | attributes:
61 | label: Build
62 | description: Please verify that this issue is present in the most recent version of YimMenu.
63 | options:
64 | - label: I've confirmed that the issue exists in the latest version of YimMenu.
65 | required: true
66 | - type: checkboxes
67 | attributes:
68 | label: Harmlesse's Scripts version
69 | description: Make sure you are using the latest version of Harmlesse's Scripts.
70 | options:
71 | - label: I've confirmed that I am using the latest version of this script.
72 | required: true
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/improvement_request.yml:
--------------------------------------------------------------------------------
1 | name: Suggestion for an existing feature
2 | description: Suggest a new feature/improvement for an existing feature in Harmless's Scripts.
3 | title: "[ENHANCEMENT] "
4 | labels: enhancement
5 | body:
6 | - type: textarea
7 | attributes:
8 | label: What feature is this suggestion for?
9 | description: Name of the current feature you are suggesting a improvement for.
10 | validations:
11 | required: true
12 | - type: textarea
13 | attributes:
14 | label: Describe the suggestion
15 | description: A clear description of what the suggestion is.
16 | validations:
17 | required: true
18 | - type: textarea
19 | attributes:
20 | label: Why do you think this suggestion would be useful?
21 | description: A clear description of why you think this suggestion would be useful.
22 | validations:
23 | required: true
24 | - type: textarea
25 | attributes:
26 | label: Where in the Menu should the feature be?
27 | description: Describe where in the Menu the feature should be.
28 | placeholder: |
29 | Example: Vehicle -> Fun Features
30 | validations:
31 | required: false
32 | - type: textarea
33 | attributes:
34 | label: Additional context
35 | description: Add any other context or notes about the suggestion request here.
36 | validations:
37 | required: false
38 | - type: checkboxes
39 | attributes:
40 | label: Feature
41 | description: Make sure that this suggestion IS NOT already implemented in Harmless's Scripts OR in YimMenu AND YimMenu Lua repository.
42 | options:
43 | - label: I've confirmed that this suggestion IS NOT already implemented.
44 | required: true
45 | - type: checkboxes
46 | attributes:
47 | label: Version
48 | description: Make sure you are using the latest version of Harmless's Scripts and YimMenu.
49 | options:
50 | - label: I've confirmed that I am using the latest version.
51 | required: true
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/script_request.yml:
--------------------------------------------------------------------------------
1 | name: Suggest a new feature
2 | description: Suggest a new feature you'd like to see added to Harmless's Scripts.
3 | title: "[FEATURE REQUEST] "
4 | labels: feature request
5 | body:
6 | - type: textarea
7 | attributes:
8 | label: What should the feature be called?
9 | description: Name of the feature you are suggesting.
10 | validations:
11 | required: true
12 | - type: textarea
13 | attributes:
14 | label: Describe the feature
15 | description: A clear description of what the feature should do.
16 | validations:
17 | required: true
18 | - type: textarea
19 | attributes:
20 | label: Why do you think this feature would be useful?
21 | description: A clear description of why you think this feature would be useful.
22 | validations:
23 | required: true
24 | - type: textarea
25 | attributes:
26 | label: List options for the feature
27 | description: List any options and what that said option should do.
28 | placeholder: |
29 | Example:
30 | - Enable feature [Toggle]
31 | - Spawn a vehicle [Button]
32 | validations:
33 | required: true
34 | - type: textarea
35 | attributes:
36 | label: Additional context
37 | description: Add any other context or notes about the feature here.
38 | validations:
39 | required: false
40 | - type: checkboxes
41 | attributes:
42 | label: Existing script
43 | description: Make sure that this feature DOES NOT already exist in THIS repository OR in YimMenu AND YimMenu Lua repository.
44 | options:
45 | - label: I've confirmed that this script DOES NOT already exist.
46 | required: true
47 |
--------------------------------------------------------------------------------
/HarmlessScript.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Harmless's Scripts
3 | Description: Harmless's Scripts is a collection of scripts made by Harmless.
4 | Version: 1.3.0
5 | ]]--
6 |
7 | --[[
8 |
9 | Credits List:
10 | - @pierrelasse - NPC ESP help
11 | - @xesdoog - Ragdoll Loop stuck fix; Expanded radar fix; Close button fix
12 | - @Deadlineem - Tooltip icon
13 | - @rxi - The original json library (json.lua)
14 |
15 | ]]--
16 |
17 | HSVersion = "1.3.0"
18 |
19 | gui.show_message("Harmless's Scripts", "Harmless's Scripts loaded successfully!")
20 | log.info("Version " .. HSVersion .. " loaded successfully!")
21 |
22 | HSTab = gui.get_tab("Harmless's Scripts")
23 | SelfTab = HSTab:add_tab("Self Options")
24 | TeleportTab = SelfTab:add_tab("Teleport Options")
25 | VehicleTab = HSTab:add_tab("Vehicle Options")
26 | MiscTab = HSTab:add_tab("Misc Options")
27 | QuickTab = HSTab:add_tab("Quick Options")
28 | HSSettings = HSTab:add_tab("HS Settings")
29 | HudTab = HSSettings:add_tab("HUD")
30 | ESPTab = HSSettings:add_tab("NPC ESP")
31 | ExperimentalTab = HSSettings:add_tab("Experimentals")
32 |
33 | --[[
34 |
35 | RXI JSON Library (Modified)
36 | Credits: RXI (json.lua - for the original library)
37 |
38 | ]]--
39 |
40 | function json()
41 | local json = { _version = "0.1.2" }
42 | --encode
43 | local encode
44 |
45 | local escape_char_map = {
46 | [ "\\" ] = "\\",
47 | [ "\"" ] = "\"",
48 | [ "\b" ] = "b",
49 | [ "\f" ] = "f",
50 | [ "\n" ] = "n",
51 | [ "\r" ] = "r",
52 | [ "\t" ] = "t",
53 | }
54 |
55 | local escape_char_map_inv = { [ "/" ] = "/" }
56 | for k, v in pairs(escape_char_map) do
57 | escape_char_map_inv[v] = k
58 | end
59 |
60 | local function escape_char(c)
61 | return "\\" .. (escape_char_map[c] or string.format("u%04x", c:byte()))
62 | end
63 |
64 | local function encode_nil(val)
65 | return "null"
66 | end
67 |
68 | local function encode_table(val, stack)
69 | local res = {}
70 | stack = stack or {}
71 | if stack[val] then error("circular reference") end
72 |
73 | stack[val] = true
74 |
75 | if rawget(val, 1) ~= nil or next(val) == nil then
76 | local n = 0
77 | for k in pairs(val) do
78 | if type(k) ~= "number" then
79 | error("invalid table: mixed or invalid key types")
80 | end
81 | n = n + 1
82 | end
83 | if n ~= #val then
84 | error("invalid table: sparse array")
85 | end
86 | for i, v in ipairs(val) do
87 | table.insert(res, encode(v, stack))
88 | end
89 | stack[val] = nil
90 | return "[" .. table.concat(res, ",") .. "]"
91 | else
92 | for k, v in pairs(val) do
93 | if type(k) ~= "string" then
94 | error("invalid table: mixed or invalid key types")
95 | end
96 | table.insert(res, encode(k, stack) .. ":" .. encode(v, stack))
97 | end
98 | stack[val] = nil
99 | return "{" .. table.concat(res, ",") .. "}"
100 | end
101 | end
102 |
103 | local function encode_string(val)
104 | return '"' .. val:gsub('[%z\1-\31\\"]', escape_char) .. '"'
105 | end
106 |
107 | local function encode_number(val)
108 | if val ~= val or val <= -math.huge or val >= math.huge then
109 | error("unexpected number value '" .. tostring(val) .. "'")
110 | end
111 | return string.format("%.14g", val)
112 | end
113 |
114 | local type_func_map = {
115 | [ "nil" ] = encode_nil,
116 | [ "table" ] = encode_table,
117 | [ "string" ] = encode_string,
118 | [ "number" ] = encode_number,
119 | [ "boolean" ] = tostring,
120 | }
121 |
122 | encode = function(val, stack)
123 | local t = type(val)
124 | local f = type_func_map[t]
125 | if f then
126 | return f(val, stack)
127 | end
128 | error("unexpected type '" .. t .. "'")
129 | end
130 |
131 | function json.encode(val)
132 | return ( encode(val) )
133 | end
134 |
135 |
136 | --decode
137 | local parse
138 |
139 | local function create_set(...)
140 | local res = {}
141 | for i = 1, select("#", ...) do
142 | res[ select(i, ...) ] = true
143 | end
144 | return res
145 | end
146 |
147 | local space_chars = create_set(" ", "\t", "\r", "\n")
148 | local delim_chars = create_set(" ", "\t", "\r", "\n", "]", "}", ",")
149 | local escape_chars = create_set("\\", "/", '"', "b", "f", "n", "r", "t", "u")
150 | local literals = create_set("true", "false", "null")
151 |
152 | local literal_map = {
153 | [ "true" ] = true,
154 | [ "false" ] = false,
155 | [ "null" ] = nil,
156 | }
157 |
158 | local function next_char(str, idx, set, negate)
159 | for i = idx, #str do
160 | if set[str:sub(i, i)] ~= negate then
161 | return i
162 | end
163 | end
164 | return #str + 1
165 | end
166 |
167 | local function decode_error(str, idx, msg)
168 | local line_count = 1
169 | local col_count = 1
170 | for i = 1, idx - 1 do
171 | col_count = col_count + 1
172 | if str:sub(i, i) == "\n" then
173 | line_count = line_count + 1
174 | col_count = 1
175 | end
176 | end
177 | error( string.format("%s at line %d col %d", msg, line_count, col_count) )
178 | end
179 |
180 | local function codepoint_to_utf8(n)
181 | local f = math.floor
182 | if n <= 0x7f then
183 | return string.char(n)
184 | elseif n <= 0x7ff then
185 | return string.char(f(n / 64) + 192, n % 64 + 128)
186 | elseif n <= 0xffff then
187 | return string.char(f(n / 4096) + 224, f(n % 4096 / 64) + 128, n % 64 + 128)
188 | elseif n <= 0x10ffff then
189 | return string.char(f(n / 262144) + 240, f(n % 262144 / 4096) + 128,
190 | f(n % 4096 / 64) + 128, n % 64 + 128)
191 | end
192 | error( string.format("invalid unicode codepoint '%x'", n) )
193 | end
194 |
195 | local function parse_unicode_escape(s)
196 | local n1 = tonumber( s:sub(1, 4), 16 )
197 | local n2 = tonumber( s:sub(7, 10), 16 )
198 | if n2 then
199 | return codepoint_to_utf8((n1 - 0xd800) * 0x400 + (n2 - 0xdc00) + 0x10000)
200 | else
201 | return codepoint_to_utf8(n1)
202 | end
203 | end
204 |
205 | local function parse_string(str, i)
206 | local res = ""
207 | local j = i + 1
208 | local k = j
209 |
210 | while j <= #str do
211 | local x = str:byte(j)
212 | if x < 32 then
213 | decode_error(str, j, "control character in string")
214 | elseif x == 92 then -- `\`: Escape
215 | res = res .. str:sub(k, j - 1)
216 | j = j + 1
217 | local c = str:sub(j, j)
218 | if c == "u" then
219 | local hex = str:match("^[dD][89aAbB]%x%x\\u%x%x%x%x", j + 1)
220 | or str:match("^%x%x%x%x", j + 1)
221 | or decode_error(str, j - 1, "invalid unicode escape in string")
222 | res = res .. parse_unicode_escape(hex)
223 | j = j + #hex
224 | else
225 | if not escape_chars[c] then
226 | decode_error(str, j - 1, "invalid escape char '" .. c .. "' in string")
227 | end
228 | res = res .. escape_char_map_inv[c]
229 | end
230 | k = j + 1
231 | elseif x == 34 then -- `"`: End of string
232 | res = res .. str:sub(k, j - 1)
233 | return res, j + 1
234 | end
235 | j = j + 1
236 | end
237 | decode_error(str, i, "expected closing quote for string")
238 | end
239 |
240 | local function parse_number(str, i)
241 | local x = next_char(str, i, delim_chars)
242 | local s = str:sub(i, x - 1)
243 | local n = tonumber(s)
244 | if not n then
245 | decode_error(str, i, "invalid number '" .. s .. "'")
246 | end
247 | return n, x
248 | end
249 |
250 | local function parse_literal(str, i)
251 | local x = next_char(str, i, delim_chars)
252 | local word = str:sub(i, x - 1)
253 | if not literals[word] then
254 | decode_error(str, i, "invalid literal '" .. word .. "'")
255 | end
256 | return literal_map[word], x
257 | end
258 |
259 | local function parse_array(str, i)
260 | local res = {}
261 | local n = 1
262 | i = i + 1
263 | while 1 do
264 | local x
265 | i = next_char(str, i, space_chars, true)
266 | -- Empty / end of array?
267 | if str:sub(i, i) == "]" then
268 | i = i + 1
269 | break
270 | end
271 | -- Read token
272 | x, i = parse(str, i)
273 | res[n] = x
274 | n = n + 1
275 | -- Next token
276 | i = next_char(str, i, space_chars, true)
277 | local chr = str:sub(i, i)
278 | i = i + 1
279 | if chr == "]" then break end
280 | if chr ~= "," then decode_error(str, i, "expected ']' or ','") end
281 | end
282 | return res, i
283 | end
284 |
285 | local function parse_object(str, i)
286 | local res = {}
287 | i = i + 1
288 | while 1 do
289 | local key, val
290 | i = next_char(str, i, space_chars, true)
291 | -- Empty / end of object?
292 | if str:sub(i, i) == "}" then
293 | i = i + 1
294 | break
295 | end
296 | -- Read key
297 | if str:sub(i, i) ~= '"' then
298 | decode_error(str, i, "expected string for key")
299 | end
300 | key, i = parse(str, i)
301 | -- Read ':' delimiter
302 | i = next_char(str, i, space_chars, true)
303 | if str:sub(i, i) ~= ":" then
304 | decode_error(str, i, "expected ':' after key")
305 | end
306 | i = next_char(str, i + 1, space_chars, true)
307 | -- Read value
308 | val, i = parse(str, i)
309 | -- Set
310 | res[key] = val
311 | -- Next token
312 | i = next_char(str, i, space_chars, true)
313 | local chr = str:sub(i, i)
314 | i = i + 1
315 | if chr == "}" then break end
316 | if chr ~= "," then decode_error(str, i, "expected '}' or ','") end
317 | end
318 | return res, i
319 | end
320 |
321 | local char_func_map = {
322 | [ '"' ] = parse_string,
323 | [ "0" ] = parse_number,
324 | [ "1" ] = parse_number,
325 | [ "2" ] = parse_number,
326 | [ "3" ] = parse_number,
327 | [ "4" ] = parse_number,
328 | [ "5" ] = parse_number,
329 | [ "6" ] = parse_number,
330 | [ "7" ] = parse_number,
331 | [ "8" ] = parse_number,
332 | [ "9" ] = parse_number,
333 | [ "-" ] = parse_number,
334 | [ "t" ] = parse_literal,
335 | [ "f" ] = parse_literal,
336 | [ "n" ] = parse_literal,
337 | [ "[" ] = parse_array,
338 | [ "{" ] = parse_object,
339 | }
340 |
341 | parse = function(str, idx)
342 | local chr = str:sub(idx, idx)
343 | local f = char_func_map[chr]
344 | if f then
345 | return f(str, idx)
346 | end
347 | decode_error(str, idx, "unexpected character '" .. chr .. "'")
348 | end
349 |
350 | function json.decode(str)
351 | if type(str) ~= "string" then
352 | error("expected argument of type string, got " .. type(str))
353 | end
354 | local res, idx = parse(str, next_char(str, 1, space_chars, true))
355 | idx = next_char(str, idx, space_chars, true)
356 | if idx <= #str then
357 | decode_error(str, idx, "trailing garbage")
358 | end
359 | return res
360 | end
361 |
362 | return json
363 | end
364 |
365 | json = json()
366 |
367 | local default_config = {
368 | enableScriptsCB = false,
369 | state3 = false,
370 | healthCB = false,
371 | armourCB = false,
372 | healthregenspeed = 1,
373 | armourregenspeed = 1,
374 | healthhealamount = 10,
375 | armourhealamount = 5,
376 | ragdollCB = false,
377 | ragdollLoopCB = false,
378 | ragdollLoopSpeed = 1,
379 | ragdollForceFlags = 1,
380 | ragdollForceX = 10,
381 | ragdollForceY = 10,
382 | ragdollForceZ = 10,
383 | ragdollType = 0,
384 | walkCB = false,
385 | walkSpeed = 1.2,
386 | swimCB = false,
387 | swimSpeed = 1.2,
388 | drawMarkerCB = false,
389 | QTPLineESPCB = false,
390 | maxSpeedCB = false,
391 | speedLimit = 1000,
392 | forwardSpeedCB = false,
393 | speedBoost = 100,
394 | shiftDriftCB = false,
395 | driftAmount = 1,
396 | driftTyresCB = false,
397 | autoFlipVehicleCB = false,
398 | walkOnAirCB = false,
399 | lowGraphicsCB = false,
400 | snowTrailsCB = false,
401 | tVisStartFade = 1000,
402 | tVisEndFade = 1000,
403 | tVisWallThickness = 200,
404 | tVisNoiseMin = 0.0,
405 | tVisNoiseMax = 0.0,
406 | tVisHilightIntensity = 0.5,
407 | tVisHilightNoise = 0.0,
408 | nightVisionCB = false,
409 | defaultNightVisCV = false,
410 | nVisLightRange = 100,
411 | weaponScopeCB = false,
412 | npcEspCB = false,
413 | npcEspShowEnemCB = false,
414 | npcEspBoxCB = true,
415 | npCEspTracerCB = false,
416 | npcEspLosCB = false,
417 | npcEspDistance = 50,
418 | npcEspColor = {1.0, 0.0, 0.0, 1.0},
419 | notifyCB = true,
420 | warnNotifyCB = true,
421 | errorNotifyCB = true,
422 | toolTipCB = false,
423 | toolTipV2CB = true,
424 | toolTipDelay = 0.3,
425 | toolTipIconCB = true,
426 | toolTipIconOnlyCB = false,
427 | HSConsoleLogInfoCB = true,
428 | HSConsoleLogWarnCB = true,
429 | HSConsoleLogDebugCB = false,
430 | clockCB = false,
431 | showSecondsCB = false,
432 | clockTextCB = false,
433 | clockLocX = 0.94,
434 | clockLocY = 0.01,
435 | clockScale = 0.4,
436 | clockColor = {1.0, 1.0, 1.0, 1.0},
437 | clockDropShadowCB = true,
438 | expandedRadarCB = false,
439 | radarZoom = 0,
440 | }
441 |
442 | --[[
443 |
444 | HS Config Functions
445 |
446 | ]]--
447 | function writeToFile(filename, data)
448 | local file, err = io.open(filename, "w")
449 | if file == nil then
450 | log.warning("Failed to write to " .. filename)
451 | gui.show_error("Harmless's Scripts", "Failed to write to " .. filename)
452 | return false
453 | end
454 | file:write(json.encode(data))
455 | file:close()
456 | return true
457 | end
458 |
459 | function readFromFile(filename)
460 | local file, err = io.open(filename, "r")
461 | if file == nil then
462 | return nil
463 | end
464 | local content = file:read("*all")
465 | file:close()
466 | return json.decode(content)
467 | end
468 |
469 | function checkAndCreateConfig(default_config)
470 | local configExists = io.exists("HSConfig.json")
471 | local config
472 |
473 | if not configExists then
474 | log.warning("Config file not found, creating a default config")
475 | gui.show_warning("Harmless's Scripts", "Config file not found, creating a default config")
476 | if not writeToFile("HSConfig.json", default_config) then
477 | return false
478 | end
479 | config = default_config
480 | else
481 | config = readFromFile("HSConfig.json")
482 | if config == nil then
483 | log.error("Failed to read config file")
484 | return false
485 | end
486 | end
487 |
488 | for key, defaultValue in pairs(default_config) do
489 | if config[key] == nil then
490 | config[key] = defaultValue
491 | end
492 | end
493 |
494 | if not writeToFile("HSConfig.json", config) then
495 | return false
496 | end
497 | return true
498 | end
499 |
500 | function readAndDecodeConfig()
501 | while not checkAndCreateConfig(default_config) do
502 | -- Wait for the file to be created
503 | os.execute("sleep " .. tonumber(1))
504 | log.debug("Waiting for HSConfig.json to be created")
505 | end
506 | return readFromFile("HSConfig.json")
507 | end
508 |
509 | function saveToConfig(item_tag, value)
510 | local t = readAndDecodeConfig()
511 | if t then
512 | t[item_tag] = value
513 | if not writeToFile("HSConfig.json", t) then
514 | log.debug("Failed to encode JSON to HSConfig.json")
515 | end
516 | end
517 | end
518 |
519 | function readFromConfig(item_tag)
520 | local t = readAndDecodeConfig()
521 | if t then
522 | return t[item_tag]
523 | else
524 | log.debug("Failed to decode JSON from HSConfig.json")
525 | end
526 | end
527 |
528 | function resetConfig(default_config)
529 | writeToFile("HSConfig.json", default_config)
530 | end
531 |
532 | --[[
533 |
534 | Harmless's Scripts Tab
535 |
536 | ]]--
537 | HSTab:add_imgui(function()
538 | ImGui.Spacing();ImGui.Spacing();ImGui.SeparatorText("About")
539 | ImGui.BulletText("Version: " .. HSVersion)
540 | ImGui.BulletText("Github:")
541 | ImGui.SameLine(); ImGui.TextColored(0.8, 0.9, 1, 1, "YimMenu-Lua/Harmless-Scripts")
542 | if ImGui.IsItemHovered() and ImGui.IsItemClicked(0) then
543 | ImGui.SetClipboardText("https://github.com/YimMenu-Lua/Harmless-Scripts")
544 | HSNotification("Copied to clipboard!")
545 | HSConsoleLogInfo("Copied https://github.com/YimMenu-Lua/Harmless-Scripts to clipboard!")
546 | end
547 | HSshowTooltip("Click to copy to clipboard")
548 | ImGui.Spacing();ImGui.SeparatorText("Credits")
549 | ImGui.BulletText("pierrelasse - NPC ESP help")
550 | ImGui.BulletText("xesdoog - Ragdoll Loop stuck fix; Expanded radar fix; Close button fix")
551 | ImGui.BulletText("Deadlineem - Tooltip icon idea")
552 | ImGui.BulletText("rxi - The original json library (json.lua)")
553 | end)
554 |
555 | --[[
556 |
557 | Enable "In Menu" Scripts -> Harmless's Scripts
558 |
559 | ]]--
560 | local enableScriptsCB = readFromConfig("enableScriptsCB")
561 | local state3 = readFromConfig("state3")
562 | function enableScriptsTab()
563 | enableScriptsCB = HSCheckbox(ReverseBoolToStatus(enableScriptsCB) .. " \"In Menu\" features separately (WIP)", enableScriptsCB, "enableScriptsCB")
564 | HSshowTooltip(ReverseBoolToStatus(enableScriptsCB) .. " every script in the menu separately in their respective locations", "WIP", {1, 0.7, 0.4, 1})
565 | if enableScriptsCB then
566 | state3 = HSCheckbox(ReverseBoolToStatus(state3) .. " Regeneration in \"Self\"", state3, "state3")
567 | HSshowTooltip(ReverseBoolToStatus(state3) .. " Regeneration in \"Self\"")
568 | else
569 | state3 = false
570 | saveToConfig("state3", false)
571 | end
572 | end
573 |
574 |
575 | --[[
576 |
577 | Self Options
578 |
579 | --]]
580 | SelfTab:add_imgui(function()
581 | ImGui.Spacing();ImGui.SeparatorText("Regeneration")
582 | playerRegenTab()
583 | ImGui.Spacing();ImGui.SeparatorText("Speed Multipliers")
584 | playerSpeedTab()
585 | ImGui.Spacing();ImGui.SeparatorText("Ragdoll Options")
586 | ragdollPlayerTab()
587 | end)
588 |
589 | --[[
590 |
591 | Player Regeneration -> Self Options
592 |
593 | --]]
594 | local healthCB = readFromConfig("healthCB")
595 | local armourCB = readFromConfig("armourCB")
596 | local healthregenspeed = readFromConfig("healthregenspeed") -- second(s)
597 | local armourregenspeed = readFromConfig("armourregenspeed") -- second(s)
598 | local healthhealamount = readFromConfig("healthhealamount")
599 | local armourhealamount = readFromConfig("armourhealamount")
600 | function playerRegenTab()
601 | healthCB = HSCheckbox("Player Regeneration", healthCB, "healthCB")
602 | healthregenspeed, healthregenspeedUsed = HSSliderFloat("Health Regen Speed", healthregenspeed, 0, 10, "%.1f", ImGuiSliderFlags.Logarithmic, "healthregenspeed")
603 | healthhealamount, healthhealamountUsed = HSSliderInt("Health Regen Amount", healthhealamount, 1, 50, "healthhealamount")
604 | armourCB = HSCheckbox("Armor Regeneration", armourCB, "armourCB")
605 | armourregenspeed, armourregenspeedUsed = HSSliderFloat("Armor Regen Speed", armourregenspeed, 0, 10, "%.1f", ImGuiSliderFlags.Logarithmic, "armourregenspeed")
606 | armourhealamount, armourhealamountUsed = HSSliderInt("Armor Regen Amount", armourhealamount, 1, 50, "armourhealamount")
607 | end
608 |
609 | script.register_looped("HS Health Regeneration", function(healthLoop)
610 | if healthCB and ENTITY.GET_ENTITY_HEALTH(PLAYER.PLAYER_PED_ID()) < ENTITY.GET_ENTITY_MAX_HEALTH(PLAYER.PLAYER_PED_ID()) and PLAYER.IS_PLAYER_DEAD(PLAYER.PLAYER_ID()) == false and HUD.BUSYSPINNER_IS_ON() == false then
611 | HSConsoleLogDebug("Adding " .. healthhealamount .. " amount health")
612 | local health = ENTITY.GET_ENTITY_HEALTH(PLAYER.PLAYER_PED_ID())
613 | if ENTITY.GET_ENTITY_MAX_HEALTH(PLAYER.PLAYER_PED_ID()) == health then return end
614 | ENTITY.SET_ENTITY_HEALTH(PLAYER.PLAYER_PED_ID(), health + healthhealamount, 0, 0)
615 | healthLoop:sleep(math.floor(healthregenspeed * 1000)) -- 1ms * 1000 to get seconds
616 | end
617 | end)
618 |
619 | script.register_looped("HS Armour Regeneration", function(armorLoop)
620 | if armourCB and PED.GET_PED_ARMOUR(PLAYER.PLAYER_PED_ID()) < PLAYER.GET_PLAYER_MAX_ARMOUR(PLAYER.PLAYER_ID()) and PLAYER.IS_PLAYER_DEAD(PLAYER.PLAYER_ID()) == false and HUD.BUSYSPINNER_IS_ON() == false then
621 | HSConsoleLogDebug("Adding " .. armourhealamount .. " amount armor")
622 | PED.ADD_ARMOUR_TO_PED(PLAYER.PLAYER_PED_ID(), armourhealamount)
623 | armorLoop:sleep(math.floor(armourregenspeed * 1000)) -- 1ms * 1000 to get seconds
624 | end
625 | end)
626 |
627 | --[[
628 |
629 | Ragdoll Player -> Self Options
630 |
631 | ]]--
632 | local ragdollCB = readFromConfig("ragdollCB")
633 | local ragdollLoopCB = readFromConfig("ragdollLoopCB")
634 | local ragdollLoopSpeed = readFromConfig("ragdollLoopSpeed")
635 | local ragdollForceFlags = readFromConfig("ragdollForceFlags")
636 | local ragdollForceX = readFromConfig("ragdollForceX")
637 | local ragdollForceY = readFromConfig("ragdollForceY")
638 | local ragdollForceZ = readFromConfig("ragdollForceZ")
639 | local ragdollType =readFromConfig("ragdollType")
640 |
641 | function ragdollPlayerTab()
642 | if ImGui.Button("Ragdoll Player [Once]") then
643 | ragdollPlayerOnce()
644 | HSConsoleLogDebug("Ragdolling Player Once")
645 | end
646 | ImGui.SameLine(); ragdollLoopCB = HSCheckbox("Ragdoll Player [Loop]", ragdollLoopCB, "ragdollLoopCB")
647 | ImGui.Separator()
648 | ImGui.LabelText("Parameters", "Ragdoll Settings")
649 | ragdollLoopSpeed, ragdollLoopSpeedUsed = HSSliderFloat("Loop Speed", ragdollLoopSpeed, 0, 10, "%.1f", ImGuiSliderFlags.Logarithmic, "ragdollLoopSpeed")
650 | HSshowTooltip("Change the speed at which the loop runs (in seconds)")
651 | ragdollForceFlags, ragdollForceFlagsUsed = HSSliderInt("Ragdoll Force Flags", ragdollForceFlags, 0, 5, "ragdollForceFlags")
652 | HSshowTooltip("0 = Weak Force\n1 = Strong Force\n2 = Same as 0\n3 = Same as 1\n4 = Weak Momentum\n5 = Strong Momentum")
653 | ragdollForceX, ragdollForceXUsed = HSSliderInt("Force X", ragdollForceX, 0, 100, "ragdollForceX")
654 | ragdollForceY, ragdollForceYUsed = HSSliderInt("Force Y", ragdollForceY, 0, 100, "ragdollForceY")
655 | ragdollForceZ, ragdollForceZUsed = HSSliderInt("Force Z", ragdollForceZ, 0, 100, "ragdollForceZ")
656 | ragdollType, ragdollTypeUsed = HSSliderInt("Ragdoll Type", ragdollType, 0, 3, "ragdollType")
657 | HSshowTooltip("0 = Normal Ragdoll\n1 = Falls with stiff legs/body\n2 = Narrow leg stumble\n3 = Wide leg stumble")
658 | end
659 |
660 | function ragdollPlayerOnce()
661 | local forceFlags = ragdollForceFlags
662 | local ragdollType = ragdollType
663 | local forcex = ragdollForceX
664 | local forcey = ragdollForceY
665 | local forcez = ragdollForceZ
666 | local players = PLAYER.PLAYER_PED_ID()
667 | PED.SET_PED_TO_RAGDOLL(players, 1500, 0, ragdollType, true)
668 | ENTITY.APPLY_FORCE_TO_ENTITY(players, forceFlags, forcex, forcey, forcez, 0, 0, 0, 0, false, true, true, false, true)
669 | end
670 |
671 | script.register_looped("HS Ragdoll Player Loop", function(ragdollLoop)
672 | if ragdollLoopCB then
673 | local loopspd = ragdollLoopSpeed * 1000
674 | local forceFlags = ragdollForceFlags
675 | local ragdollType = ragdollType
676 | local forcex = ragdollForceX
677 | local forcey = ragdollForceY
678 | local forcez = ragdollForceZ
679 | local players = PLAYER.PLAYER_PED_ID()
680 | PED.SET_PED_TO_RAGDOLL(players, 3000, 0, ragdollType, true, true, false)
681 | ENTITY.APPLY_FORCE_TO_ENTITY(players, forceFlags, forcex, forcey, forcez, 0, 0, 0, 0, false, true, true, false, true)
682 | ragdollLoop:sleep(math.floor(loopspd))
683 | end
684 | end)
685 |
686 | --[[
687 |
688 | Player Speed Multipliers -> Self Options
689 |
690 | ]]--
691 | local walkCB = readFromConfig("walkCB")
692 | local walkSpeed = readFromConfig("walkSpeed")
693 | local swimCB = readFromConfig("swimCB")
694 | local swimSpeed = readFromConfig("swimSpeed")
695 |
696 | function playerSpeedTab()
697 | walkCB, walkCBUsed = HSCheckbox("Walk Speed Multiplier", walkCB, "walkCB")
698 | walkSpeed, walkSpeedUsed = HSSliderFloat("Walk speed multiplier", walkSpeed, 1, 1.49, "%.1f", ImGuiSliderFlags.Logarithmic, "walkSpeed")
699 | swimCB, swimCBUsed = HSCheckbox("Swim Speed Multiplier", swimCB, "swimCB")
700 | swimSpeed, swimSpeedUsed = HSSliderFloat("Swim speed multiplier", swimSpeed, 1, 1.49, "%.1f", ImGuiSliderFlags.Logarithmic, "swimSpeed")
701 | end
702 |
703 | script.run_in_fiber(function(playerSpeedMultiplier)
704 | while true do
705 | if walkCB then
706 | PLAYER.SET_RUN_SPRINT_MULTIPLIER_FOR_PLAYER(PLAYER.PLAYER_ID(), walkSpeed)
707 | else
708 | PLAYER.SET_RUN_SPRINT_MULTIPLIER_FOR_PLAYER(PLAYER.PLAYER_ID(), 1.0)
709 | end
710 | if swimCB then
711 | PLAYER.SET_SWIM_MULTIPLIER_FOR_PLAYER(PLAYER.PLAYER_ID(), swimSpeed)
712 | else
713 | PLAYER.SET_SWIM_MULTIPLIER_FOR_PLAYER(PLAYER.PLAYER_ID(), 1.0)
714 | end
715 | playerSpeedMultiplier:yield()
716 | end
717 | end)
718 |
719 | --[[
720 |
721 | Teleport Options
722 |
723 | ]]--
724 |
725 | --[[
726 |
727 | Quick Teleport -> Teleport Options
728 |
729 | ]]--
730 |
731 | TeleportTab:add_imgui(function()
732 | ImGui.Spacing();ImGui.SeparatorText("Quick Teleport")
733 | quickTeleportTab()
734 | ImGui.Spacing();ImGui.SeparatorText("Popular Locations")
735 | PopularLocTab()
736 | end)
737 |
738 | local teleportLocations = {}
739 | local drawMarkerCB = readFromConfig("drawMarkerCB")
740 | local QTPLineESPCB = readFromConfig("QTPLineESPCB")
741 |
742 | function quickTeleportTab()
743 | local player = PLAYER.PLAYER_PED_ID()
744 | local currentCoords = ENTITY.GET_ENTITY_COORDS(player, true)
745 |
746 | if ImGui.Button("Save Current Location") then
747 | local heading = ENTITY.GET_ENTITY_HEADING(player)
748 | teleportLocations[1] = {currentCoords.x, currentCoords.y, currentCoords.z, heading}
749 | HSNotification("Saved current location!")
750 | HSConsoleLogDebug("Saved current location")
751 | HSConsoleLogDebug("Saved location: x = " .. currentCoords.x .. ", y = " .. currentCoords.y .. ", z = " .. currentCoords.z .. ", heading = " .. heading)
752 | end
753 |
754 | if teleportLocations[1] ~= nil then
755 | local savedLocation = teleportLocations[1]
756 | ImGui.Text(string.format("Saved location: X=%.2f, Y=%.2f, Z=%.2f", savedLocation[1], savedLocation[2], savedLocation[3]))
757 |
758 | local dx = savedLocation[1] - currentCoords.x
759 | local dy = savedLocation[2] - currentCoords.y
760 | local dz = savedLocation[3] - currentCoords.z
761 | local distance = math.sqrt(dx*dx + dy*dy + dz*dz)
762 | ImGui.Text(string.format("Distance to saved location: %.0f meters", distance))
763 |
764 | if ImGui.Button("Teleport to Saved Location") then
765 | PED.SET_PED_COORDS_KEEP_VEHICLE(player, savedLocation[1], savedLocation[2], savedLocation[3])
766 | ENTITY.SET_ENTITY_HEADING(player, savedLocation[4])
767 | HSNotification("Teleported to saved location!")
768 | HSConsoleLogDebug("Teleported to saved location")
769 | end
770 |
771 | ImGui.Separator()
772 | drawMarkerCB, drawMarkerCBToggled = HSCheckbox("Draw Marker", drawMarkerCB, "drawMarkerCB")
773 | HSshowTooltip("Draws a marker at the saved location")
774 | QTPLineESPCB, QTPLineESPCBToggled = HSCheckbox("Line ESP", QTPLineESPCB, "QTPLineESPCB")
775 | HSshowTooltip("Draws a line from the player to the saved location")
776 | end
777 | end
778 |
779 | local function drawMarker()
780 | if drawMarkerCB then
781 | local savedLocation = teleportLocations[1]
782 | if savedLocation ~= nil then
783 | local player = PLAYER.PLAYER_PED_ID()
784 | GRAPHICS.DRAW_MARKER(1, savedLocation[1], savedLocation[2], savedLocation[3], 0, 0, 0, 0, 0, 0, 2.0, 2.0, savedLocation[3] + 1500.0, 255, 255, 255, 100, false, false, 2, false, 0, 0, false)
785 | end
786 | end
787 | end
788 |
789 | local function QTPLineESP()
790 | if QTPLineESPCB then
791 | local savedLocation = teleportLocations[1]
792 | if savedLocation ~= nil then
793 | local player = PLAYER.PLAYER_PED_ID()
794 | local playerCoords = ENTITY.GET_ENTITY_COORDS(player, true)
795 | GRAPHICS.DRAW_LINE(playerCoords.x, playerCoords.y, playerCoords.z, savedLocation[1], savedLocation[2], savedLocation[3], 255, 255, 255, 255)
796 | end
797 | end
798 | end
799 |
800 | script.register_looped("QuickTP Loops", function(quicktploops)
801 | drawMarker()
802 | QTPLineESP()
803 | end)
804 |
805 | --[[
806 |
807 | Popular Locations -> Teleport Options
808 |
809 | ]]--
810 |
811 | TeleportToLocCB = true
812 | popularLocations = {
813 | {name = "Select a location", x = 0.0, y = 0.0, z = 0.0, heading = 0.0},
814 | {name = "Los Santos Customs", x = -376, y = -123, z = 39, heading = 233.0},
815 | {name = "LS Airport Customs", x = -1134.2, y = -1984.4, z = 13.2, heading = 235.5},
816 | {name = "La Mesa Customs", x = 709.8, y = -1082.7, z = 22.4, heading = 235.5},
817 | {name = "Senora Desert Customs", x = 1178.7, y = 2666.2, z = 37.881, heading = 235.5},
818 | {name = "Beeker's Customs", x = 126.2, y = 6608.2, z = 31.9, heading = 235.5},
819 | {name = "Benny's vehicles", x = -210.7, y = -1301.4, z = 31.3, heading = 235.5},
820 | {name = "Airport center", x = -1336.0, y = -3044.0, z = 14, heading = 0.0},
821 | {name = "Airport Hanger", x = -1000.0, y = -3025.0, z = 13.0, heading = 0.0},
822 | {name = "Airport Gate", x = -994.4, y = -2851.7, z = 14.0, heading = 148.2},
823 | {name = "Airport Back", x = -1704.8, y = -2831.4, z = 14.0, heading = 239.0},
824 | {name = "Maze Bank Top", x = -75.0, y = -818.0, z = 326.0, heading = 0.0},
825 | {name = "Maze Bank Bottom", x = -53.0, y = -791.5, z = 44.0, heading = 315.8},
826 | {name = "Eclipse Towers", x = -807.3, y = 301.9, z = 86.1, heading = 235.5},
827 | {name = "Casino Enterance", x = 918.6, y = 50.3, z = 80.8, heading = 235.5},
828 | {name = "Casino Parking Lot", x = 899.6, y = -20.4, z = 78.8, heading = 87.0},
829 | {name = "Ammunation", x = 247.4, y = -45.9, z = 70.0, heading = 235.5},
830 | {name = "Impound Lot", x = 401.0, y = -1631.8, z = 29.3, heading = 235.5},
831 | {name = "Mors Mutual Insurance", x = -224.0, y = -1180.8, z = 23.0, heading = 2.6},
832 | {name = "Mask Shop", x = -1338.2, y = -1278.1, z = 4.9, heading = 235.5},
833 | {name = "Tattoo Shop", x = -1155.7, y = -1422.5, z = 4.8, heading = 235.5},
834 | {name = "Clothes Store", x = -719.0, y = -158.2, z = 37.0, heading = 235.5},
835 | {name = "Airport Tower", x = -985.0, y = -2642.0, z = 63.5, heading = 235.5}
836 | }
837 |
838 | function PopularLocTab()
839 | local player = PLAYER.PLAYER_PED_ID()
840 |
841 | -- Create a list of location names
842 | locationNames = {}
843 | for i, location in ipairs(popularLocations) do
844 | table.insert(locationNames, location.name)
845 | end
846 |
847 | TeleportToLocCB, teleportToLocToggled = HSCheckbox("Teleport to Location", TeleportToLocCB, "TeleportToLocCB")
848 | if teleportToLocToggled then
849 | ViewLocAsCamCB = false
850 | end
851 |
852 | popularLocationsIndex = 0
853 | current_item = popularLocationsIndex
854 | wasUsed = false
855 | current_item, wasUsed = HSCombobox("", current_item, locationNames, #locationNames, 7)
856 | if wasUsed then
857 | popularLocationsIndex = current_item
858 | selectedLocation = popularLocations[current_item + 1]
859 | if TeleportToLocCB then
860 | PED.SET_PED_COORDS_KEEP_VEHICLE(player, selectedLocation.x, selectedLocation.y, selectedLocation.z)
861 | ENTITY.SET_ENTITY_HEADING(player, selectedLocation.heading)
862 | HSConsoleLogDebug("Teleported to " .. selectedLocation.name)
863 | end
864 | end
865 | end
866 |
867 | --[[
868 |
869 | Vehicle Options
870 |
871 | ]]--
872 | VehicleTab:add_imgui(function()
873 | ImGui.Spacing();ImGui.SeparatorText("Speed Manipulation")
874 | setVehicleMaxSpeedTab()
875 | setVehicleForwardSpeedTab()
876 | ImGui.Spacing();ImGui.SeparatorText("Drift")
877 | shiftDriftTab()
878 | ImGui.Spacing();ImGui.SeparatorText("Vehicle Manipulation")
879 | autoFlipVehicleTab()
880 | end)
881 |
882 | --[[
883 |
884 | Set Vehicle Max Speed -> Vehicle Options
885 |
886 | ]]--
887 | local maxSpeedCB = readFromConfig("maxSpeedCB")
888 | local speedLimit = readFromConfig("speedLimit")
889 | function setVehicleMaxSpeedTab()
890 | maxSpeedCB, maxSpeedToggled = HSCheckbox("Set Vehicle Max Speed", maxSpeedCB, "maxSpeedCB")
891 | HSshowTooltip("This will set your vehicle's max speed to the speed you set")
892 | speedLimit, speedLimitUsed = HSSliderInt("Speed Limit", speedLimit, 1, 1000, "speedLimit")
893 | end
894 |
895 | script.register_looped("HS Set Vehicle Max Speed Loop", function(speedLoop)
896 | if maxSpeedCB then
897 | local speed = speedLimit
898 | local CurrentVeh = PED.GET_VEHICLE_PED_IS_IN(PLAYER.PLAYER_PED_ID(), true)
899 | VEHICLE.SET_VEHICLE_MAX_SPEED(CurrentVeh, speed)
900 | else
901 | local CurrentVeh = PED.GET_VEHICLE_PED_IS_IN(PLAYER.PLAYER_PED_ID(), true)
902 | VEHICLE.SET_VEHICLE_MAX_SPEED(CurrentVeh, 0.0)
903 | end
904 | end)
905 |
906 | --[[
907 |
908 | Set Vehicle Forward Speed -> Vehicle Options
909 |
910 | ]]--
911 | local forwardSpeedCB = readFromConfig("forwardSpeedCB")
912 | local speedBoost = readFromConfig("speedBoost")
913 | function setVehicleForwardSpeedTab()
914 | forwardSpeedCB, forwardSpeedToggled = HSCheckbox("Set Vehicle Forward Speed", forwardSpeedCB, "forwardSpeedCB")
915 | HSshowTooltip("When enabled, press \"W\" to go forward at the speed you set")
916 | speedBoost, speedBoostUsed = HSSliderInt("Boosted Speed", speedBoost, 1, 1000, "speedBoost")
917 | end
918 |
919 | script.register_looped("HS Set Vehicle Forward Speed Loop", function(speedLoop)
920 | if forwardSpeedCB and PAD.IS_CONTROL_PRESSED(0, 71) and PED.IS_PED_IN_VEHICLE(PLAYER.PLAYER_PED_ID(), PED.GET_VEHICLE_PED_IS_IN(PLAYER.PLAYER_PED_ID(), true), false) then
921 | local speed = speedBoost
922 | local CurrentVeh = PED.GET_VEHICLE_PED_IS_IN(PLAYER.PLAYER_PED_ID(), true)
923 | VEHICLE.SET_VEHICLE_FORWARD_SPEED(CurrentVeh, speed)
924 | end
925 | end)
926 |
927 | --[[
928 |
929 | Shift Drift -> Vehicle Options
930 |
931 | ]]--
932 | local shiftDriftCB = readFromConfig("shiftDriftCB")
933 | local driftAmount = readFromConfig("driftAmount")
934 | local driftTyresCB = readFromConfig("driftTyresCB")
935 | function shiftDriftTab()
936 | shiftDriftCB, shiftDriftToggled = HSCheckbox("Shift Drift", shiftDriftCB, "shiftDriftCB")
937 | if shiftDriftToggled then
938 | if not shiftDriftCB then
939 | driftTyresCB = false
940 | saveToConfig("driftTyresCB", false)
941 | end
942 | end
943 | HSshowTooltip("Press \"Shift\" to drift")
944 | if shiftDriftCB then
945 | driftTyresCB, driftTyresToggled = HSCheckbox("Use Low Grip Tyres", driftTyresCB, "driftTyresCB")
946 | HSshowTooltip("This will use GTAV's Low Grip Tyres for drifting instead")
947 | end
948 | if not driftTyresCB then
949 | driftAmount, driftAmountUsed = HSSliderInt("Drift Amount", driftAmount, 0, 3, "driftAmount")
950 | HSshowTooltip("0 = Loosest Drift\n1 = Loose Drift (Recommended)\n2 = Stiff Drift\n3 = Stiffest Drift")
951 | end
952 | end
953 |
954 | script.register_looped("HS Shift Drift Loop", function(driftLoop)
955 | local CurrentVeh = PED.GET_VEHICLE_PED_IS_IN(PLAYER.PLAYER_PED_ID(), true)
956 | if driftTyresCB and PAD.IS_CONTROL_PRESSED(0, 21) then
957 | VEHICLE.SET_DRIFT_TYRES(CurrentVeh, true)
958 | else
959 | VEHICLE.SET_DRIFT_TYRES(CurrentVeh, false)
960 | end
961 | if shiftDriftCB and PAD.IS_CONTROL_PRESSED(0, 21) and not driftTyresCB then
962 | VEHICLE.SET_VEHICLE_REDUCE_GRIP(CurrentVeh, true)
963 | VEHICLE.SET_VEHICLE_REDUCE_GRIP_LEVEL(CurrentVeh, driftAmount)
964 | else
965 | VEHICLE.SET_VEHICLE_REDUCE_GRIP(CurrentVeh, false)
966 | end
967 | end)
968 |
969 | --[[
970 |
971 | Auto Flip Vehicle -> Vehicle Options
972 |
973 | ]]--
974 | local autoFlipVehicleCB = readFromConfig("autoFlipVehicleCB")
975 | function autoFlipVehicleTab()
976 | autoFlipVehicleCB, autoFlipVehicleToggled = HSCheckbox("Auto Flip Vehicle", autoFlipVehicleCB, "autoFlipVehicleCB")
977 | HSshowTooltip("This will automatically flip your vehicle upright if it is upside down")
978 | end
979 |
980 | script.register_looped("HS Auto Flip Vehicle Loop", function(flipLoop)
981 | if autoFlipVehicleCB then
982 | local players = PLAYER.PLAYER_PED_ID()
983 | local vehicle = PED.GET_VEHICLE_PED_IS_IN(players, false)
984 | if vehicle ~= 0 then
985 | if ENTITY.IS_ENTITY_UPSIDEDOWN(vehicle) then
986 | local getrot = ENTITY.GET_ENTITY_ROTATION(vehicle, 1)
987 | local forwardVector = ENTITY.GET_ENTITY_FORWARD_VECTOR(vehicle)
988 | ENTITY.SET_ENTITY_ROTATION(vehicle, forwardVector.x, forwardVector.y, getrot.z, 1, true)
989 | end
990 | end
991 | flipLoop:sleep(1000)
992 | end
993 | end)
994 |
995 | --[[
996 |
997 | Misc Options
998 |
999 | ]]--
1000 | MiscTab:add_imgui(function()
1001 | ImGui.Spacing();ImGui.SeparatorText("Player Movement")
1002 | walkOnAirTab()
1003 | ImGui.Spacing();ImGui.SeparatorText("Low Graphics")
1004 | lowGraphicsTab()
1005 | ImGui.Spacing();ImGui.SeparatorText("Snow Trails")
1006 | snowTrailsTab()
1007 | end)
1008 |
1009 | --[[
1010 |
1011 | Walk on Air -> Misc Options
1012 |
1013 | ]]--
1014 | local walkOnAirCB = readFromConfig("walkOnAirCB")
1015 | function walkOnAirTab()
1016 | walkOnAirCB, walkOnAirToggled = HSCheckbox("Walk on Air", walkOnAirCB, "walkOnAirCB")
1017 | HSshowTooltip("Air Jesus")
1018 | end
1019 |
1020 | local object = nil
1021 | local objectSpawned = false
1022 |
1023 | function spawnObject(walkOnAirLoop) -- Spawns the "air" (object)
1024 | local model = -698352776
1025 | STREAMING.REQUEST_MODEL(model)
1026 | while not STREAMING.HAS_MODEL_LOADED(model) do walkOnAirLoop:yield() end -- Wait for the model to load
1027 |
1028 | gui.show_message("Controls", "Left SHIFT = go up\nLeft CTRL = go down")
1029 | HSConsoleLogDebug("Spawning object")
1030 | local player = PLAYER.PLAYER_PED_ID()
1031 | local coords = ENTITY.GET_ENTITY_COORDS(player, true)
1032 | object = OBJECT.CREATE_OBJECT(model, coords.x, coords.y, coords.z - 1.2, true, false, false)
1033 | ENTITY.SET_ENTITY_ROTATION(object, 270, 0, 0, 1, true)
1034 | ENTITY.SET_ENTITY_VISIBLE(object, false, false)
1035 | ENTITY.SET_ENTITY_ALPHA(object, 0, false)
1036 | ENTITY.SET_ENTITY_COLLISION(object, true, false)
1037 | ENTITY.SET_ENTITY_DYNAMIC(object, false)
1038 | ENTITY.FREEZE_ENTITY_POSITION(object, true)
1039 | end
1040 |
1041 | function deleteObject()
1042 | if object ~= nil then
1043 | HSConsoleLogDebug("Deleting object")
1044 | OBJECT.DELETE_OBJECT(object)
1045 | object = nil
1046 | end
1047 | end
1048 |
1049 | script.register_looped("HS Walk on Air Loop", function(walkOnAirLoop)
1050 | if walkOnAirCB then
1051 | if not objectSpawned then
1052 | spawnObject(walkOnAirLoop)
1053 | objectSpawned = true
1054 | end
1055 | if object ~= nil then
1056 | local player = PLAYER.PLAYER_PED_ID()
1057 | local playerCoords = ENTITY.GET_ENTITY_COORDS(player, true)
1058 | if PAD.IS_CONTROL_PRESSED(0, 36) then -- 36 = left CTRl
1059 | ENTITY.SET_ENTITY_COORDS_NO_OFFSET(object, playerCoords.x, playerCoords.y, playerCoords.z - 1.4, false, false, false, false)
1060 | walkOnAirLoop:sleep(100)
1061 | elseif PAD.IS_CONTROL_PRESSED(0, 21) then -- 21 = left SHIFT
1062 | ENTITY.SET_ENTITY_COORDS_NO_OFFSET(object, playerCoords.x, playerCoords.y, playerCoords.z - 0.7, false, false, false, false)
1063 | walkOnAirLoop:sleep(50)
1064 | else
1065 | ENTITY.SET_ENTITY_COORDS_NO_OFFSET(object, playerCoords.x, playerCoords.y, playerCoords.z - 1.075, false, false, false, false)
1066 | walkOnAirLoop:sleep(50)
1067 | end
1068 | end
1069 | else
1070 | objectSpawned = false
1071 | deleteObject()
1072 | end
1073 | end)
1074 |
1075 | --[[
1076 |
1077 | Low Graphics -> Misc Options
1078 |
1079 | ]]--
1080 |
1081 | local lowGraphicsCB = readFromConfig("lowGraphicsCB")
1082 | function lowGraphicsTab()
1083 | lowGraphicsCB, lowGraphicsToggled = HSCheckbox("Low Graphics", lowGraphicsCB, "lowGraphicsCB")
1084 | HSshowTooltip("Enables low graphics mode")
1085 | if lowGraphicsToggled then
1086 | if lowGraphicsCB then
1087 | STREAMING.SET_FOCUS_POS_AND_VEL(9999, 9999, -9999, 0, 0, 0)
1088 | elseif not lowGraphicsCB then
1089 | STREAMING.CLEAR_FOCUS()
1090 | end
1091 | end
1092 | end
1093 |
1094 | --[[
1095 |
1096 | Snow Trails -> Misc Options
1097 |
1098 | ]]--
1099 |
1100 | local snowTrailsCB = readFromConfig("snowTrailsCB")
1101 | function snowTrailsTab()
1102 | snowTrailsCB, snowTrailsToggled = HSCheckbox("Snow Trails", snowTrailsCB, "snowTrailsCB")
1103 | HSshowTooltip("Enables snow trails for peds and vehicles")
1104 | if snowTrailsToggled then
1105 | if snowTrailsCB then
1106 | GRAPHICS.USE_SNOW_FOOT_VFX_WHEN_UNSHELTERED(true)
1107 | GRAPHICS.USE_SNOW_WHEEL_VFX_WHEN_UNSHELTERED(true)
1108 | elseif not snowTrailsCB then
1109 | GRAPHICS.USE_SNOW_FOOT_VFX_WHEN_UNSHELTERED(false)
1110 | GRAPHICS.USE_SNOW_WHEEL_VFX_WHEN_UNSHELTERED(false)
1111 | end
1112 | end
1113 | end
1114 |
1115 |
1116 | --[[
1117 |
1118 | Quick Options
1119 |
1120 | ]]--
1121 | QuickTab:add_imgui(function()
1122 | ImGui.Text("YimMenu Hotkeys exsist for all of these, but what if you don't want to use hotkeys?")
1123 | SelfPed = PLAYER.PLAYER_PED_ID()
1124 |
1125 | -- Self Options
1126 | ImGui.Spacing();ImGui.SeparatorText("Player")
1127 | if ImGui.Button("Clear Wanted Level") then
1128 | command.call("clearwantedlvl",{})
1129 | command.call("clearwantedlvl",{})
1130 | end
1131 | if ImGui.Button("Heal Player") then
1132 | command.call("heal",{})
1133 | end
1134 | HSshowTooltip("This will give max health and armor to the player")
1135 | if ImGui.Button("Give All Weapons") then
1136 | command.call("giveweaps",{SelfPed})
1137 | end
1138 | HSshowTooltip("Give all weapons only works Online")
1139 | if ImGui.Button("Give All Ammo") then
1140 | command.call("giveammo",{SelfPed})
1141 | end
1142 | HSshowTooltip("Give all ammo only works Online")
1143 | if ImGui.Button("Fill Ammo") then
1144 | command.call("fillammo",{})
1145 | end
1146 | if ImGui.Button("Give Max Armor") then
1147 | command.call("givearmor",{SelfPed})
1148 | end
1149 | HSshowTooltip("Give max armor only works Online")
1150 | if ImGui.Button("Clean Player") then
1151 | command.call("clean",{})
1152 | end
1153 | if ImGui.Button("Fill Snacks") then
1154 | command.call("fillsnacks",{})
1155 | end
1156 | ImGui.PushStyleColor(ImGuiCol.Text, 1, 0.7, 0.4, 1)
1157 | if ImGui.Button("Suicide :)") then
1158 | command.call("suicide",{})
1159 | end
1160 | ImGui.PopStyleColor()
1161 |
1162 | -- Teleport Options
1163 | ImGui.Spacing();ImGui.SeparatorText("Teleport")
1164 | if ImGui.Button("TP to Waypoint") then
1165 | command.call("waypointtp",{})
1166 | end
1167 | ImGui.SameLine()
1168 | if ImGui.Button("TP to Objective") then
1169 | command.call("objectivetp",{})
1170 | end
1171 |
1172 | -- Vehicle Options
1173 | ImGui.Spacing();ImGui.SeparatorText("Vehicle")
1174 | if ImGui.Button("Repair PV") then
1175 | command.call("repairpv", {})
1176 | end
1177 | if ImGui.Button("Upgrade Vehicle") then
1178 | command.call("upgradeveh",{SelfPed})
1179 | end
1180 | HSshowTooltip("Upgrade vehicle only works Online")
1181 | ImGui.SameLine()
1182 | if ImGui.Button("Downgrade Vehicle") then
1183 | command.call("downgradeveh",{SelfPed})
1184 | end
1185 | HSshowTooltip("Downgrade vehicle only works Online")
1186 | if ImGui.Button("Bring PV") then
1187 | command.call("bringpv",{})
1188 | end
1189 | ImGui.SameLine()
1190 | if ImGui.Button("TP into Personal Vehicle") then
1191 | command.call("pvtp",{})
1192 | end
1193 |
1194 | -- Misc Options
1195 | ImGui.Spacing();ImGui.SeparatorText("Misc")
1196 | if ImGui.Button("Leave Online") then
1197 | NETWORK.NETWORK_SESSION_LEAVE_SINGLE_PLAYER()
1198 | end
1199 | ImGui.PushStyleColor(ImGuiCol.Text, 1, 0.8, 0.45, 1)
1200 | if ImGui.Button("Damage Player") then
1201 | ENTITY.SET_ENTITY_HEALTH(SelfPed, 100, 0, 0)
1202 | end
1203 | ImGui.PopStyleColor()
1204 | ImGui.PushStyleColor(ImGuiCol.Text, 1, 0, 0, 1)
1205 | if ImGui.Button("Rage Quit") then
1206 | command.call("fastquit",{})
1207 | end
1208 | ImGui.PopStyleColor()
1209 | end)
1210 |
1211 | --[[
1212 |
1213 | HS Settings
1214 |
1215 | ]]
1216 |
1217 | local notifyCB = readFromConfig("notifyCB")
1218 | local warnNotifyCB = readFromConfig("warnNotifyCB")
1219 | local errorNotifyCB = readFromConfig("errorNotifyCB")
1220 | local toolTipCB = readFromConfig("toolTipCB")
1221 | local toolTipV2CB = readFromConfig("toolTipV2CB")
1222 | toolTipDelay = readFromConfig("toolTipDelay") -- default 0.3 seconds (300ms)
1223 | toolTipIconCB = readFromConfig("toolTipIconCB")
1224 | toolTipIconOnlyCB = readFromConfig("toolTipIconOnlyCB")
1225 | local HSConsoleLogInfoCB = readFromConfig("HSConsoleLogInfoCB")
1226 | local HSConsoleLogWarnCB = readFromConfig("HSConsoleLogWarnCB")
1227 | local HSConsoleLogDebugCB = readFromConfig("HSConsoleLogDebugCB")
1228 | HSSettings:add_imgui(function()
1229 |
1230 | --- HS Notifications
1231 | ImGui.Spacing();ImGui.SeparatorText("Notifications")
1232 | -- (The notifs seemed self-explanatory, so I disabled the tooltips)
1233 | notifyCB, notifyToggled = HSCheckbox("HS Notifications", notifyCB, "notifyCB")
1234 | if not notifyCB then
1235 | warnNotifyCB = false
1236 | saveToConfig("warnNotifyCB", false)
1237 | errorNotifyCB = false
1238 | saveToConfig("errorNotifyCB", false)
1239 | end
1240 | --HSshowTooltip(ReverseBoolToStatus(notifyCB) .. " notifications for Harmless's Scripts")
1241 | warnNotifyCB, warnNotifyToggled = HSCheckbox("HS Warning Notifications", warnNotifyCB, "warnNotifyCB")
1242 | --HSshowTooltip(ReverseBoolToStatus(warnNotifyCB) .. " warning notifications for Harmless's Scripts")
1243 | errorNotifyCB, errorNotifyToggled = HSCheckbox("HS Error Notifications", errorNotifyCB, "errorNotifyCB")
1244 | --HSshowTooltip(ReverseBoolToStatus(errorNotifyCB) .. " error notifications for Harmless's Scripts")
1245 |
1246 | ImGui.Spacing();ImGui.SeparatorText("Tooltips")
1247 | --- ImGui ToolTip
1248 | toolTipCB, toolTipToggled = HSCheckbox("HS Tooltips", toolTipCB, "toolTipCB")
1249 | if toolTipCB then
1250 | toolTipV2CB = false
1251 | saveToConfig("toolTipV2CB", false)
1252 | end
1253 | --HSshowTooltip(ReverseBoolToStatus(toolTipCB) .. " the default ImGui tooltip for Harmless's Scripts")
1254 |
1255 | --- HS ToolTip V2 (Custom ToolTip)
1256 | toolTipV2CB, toolTipV2Toggled = HSCheckbox("HS ToolTip V2", toolTipV2CB, "toolTipV2CB")
1257 | if toolTipV2CB then
1258 | toolTipCB = false
1259 | saveToConfig("toolTipCB", false)
1260 | end
1261 | HSshowTooltip(ReverseBoolToStatus(toolTipV2CB) .. " exerimental version of custom tooltips", "This is a custom-made tooltip for Harmless's Scripts. It's currently in an experimental phase, so you may encounter some bugs and glitches.", {1, 0.4, 0.4, 1})
1262 |
1263 | -- ToolTip Delay Slider
1264 | toolTipDelay, toolTipDelayUsed = HSSliderFloat("HS ToolTip Delay", toolTipDelay, 0, 1, "%.2f", ImGuiSliderFlags.Logarithmic, "toolTipDelay")
1265 | HSshowTooltip("The amount of time in seconds before the tooltip appears")
1266 |
1267 | --- ToolTip Icon Toggle
1268 | toolTipIconCB, toolTipIconToggled = HSCheckbox("HS ToolTip Icon", toolTipIconCB, "toolTipIconCB")
1269 | HSshowTooltip("Shows a question mark icon next to buttons, sliders, etc")
1270 | if not toolTipIconCB then
1271 | toolTipIconOnlyCB = false
1272 | saveToConfig("toolTipIconOnlyCB", false)
1273 | end
1274 |
1275 | --- View ToolTip Only on Icon Hover
1276 | toolTipIconOnlyCB, toolTipIconOnlyToggled = HSCheckbox("HS ToolTip Icon Hover Only", toolTipIconOnlyCB, "toolTipIconOnlyCB")
1277 | HSshowTooltip("Tooltip is shown only when hovering over the question mark icon")
1278 |
1279 | --- HS Console Logs
1280 | ImGui.Spacing();ImGui.SeparatorText("Console Logs")
1281 | -- (The toggles seemed self-explanatory, so I disabled the tooltips)
1282 | HSConsoleLogInfoCB, HSConsoleLogInfoToggled = HSCheckbox("HS Console Logs (Info)", HSConsoleLogInfoCB, "HSConsoleLogInfoCB")
1283 | --HSshowTooltip(ReverseBoolToStatus(HSConsoleLogInfoCB) .. " info console logs for Harmless's Scripts")
1284 | HSConsoleLogWarnCB, HSConsoleLogWarnToggled = HSCheckbox("HS Console Logs (Warning)", HSConsoleLogWarnCB, "HSConsoleLogWarnCB")
1285 | --HSshowTooltip(ReverseBoolToStatus(HSConsoleLogWarnCB) .. " warning console logs for Harmless's Scripts")
1286 | HSConsoleLogDebugCB, HSConsoleLogDebugToggled = HSCheckbox("HS Console Logs (Debug)", HSConsoleLogDebugCB, "HSConsoleLogDebugCB")
1287 | --HSshowTooltip(ReverseBoolToStatus(HSConsoleLogDebugCB) .. " debug console logs for Harmless's Scripts")
1288 |
1289 | --- Reset Config Button
1290 | ImGui.PushStyleColor(ImGuiCol.Text, 1, 0, 0, 1)
1291 | if ImGui.Button("Reset Config") then
1292 | ImGui.OpenPopup("Reset Config?")
1293 | end
1294 | ImGui.PopStyleColor()
1295 | if ImGui.BeginPopupModal("Reset Config?", ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse) then
1296 | local centerX, centerY = GetScreenCenter()
1297 | ImGui.SetWindowPos(centerX - 100, centerY - 75)
1298 | ImGui.SetWindowSize(250, 190)
1299 | ImGui.TextColored(1, 1, 1, 1, "Are you sure you want \nto reset the config?")
1300 | ImGui.TextColored(1, 0, 0, 1, "NB! You have to reload the \nLua script to see changes!")
1301 | ImGui.Spacing()
1302 | if HSButton("YES", {1, 0, 0, 1}) then
1303 | resetConfig()
1304 | ImGui.CloseCurrentPopup()
1305 | HSConsoleLogWarn("Please reload the Lua script to apply changes!")
1306 | HSWarnNotif("Please reload the Lua script to apply changes!")
1307 | end
1308 | ImGui.SameLine();ImGui.Dummy(130, 1);ImGui.SameLine()
1309 | if HSButton("NO", {0.9, 1, 0.9, 1}) then
1310 | ImGui.CloseCurrentPopup()
1311 | end
1312 | ImGui.EndPopup()
1313 | end
1314 | HSshowTooltip("Reset the Harmless's Scripts options to default config", "You have to reload the Lua script to see changes!", {1, 0.7, 0.4, 1})
1315 | end)
1316 |
1317 | --[[
1318 |
1319 | HUD Tab
1320 |
1321 | ]]--
1322 |
1323 | HudTab:add_imgui(function()
1324 | ImGui.Spacing();ImGui.SeparatorText("On-Screen Clock")
1325 | showTimeTab()
1326 | ImGui.Spacing();ImGui.SeparatorText("Radar Manipulation")
1327 | radarManipulation()
1328 | end)
1329 |
1330 | --[[
1331 |
1332 | Show Local Time -> HUD Tab
1333 |
1334 | ]]--
1335 |
1336 | local clockCB = readFromConfig("clockCB")
1337 | local showSecondsCB = readFromConfig("showSecondsCB")
1338 | local clockTextCB = readFromConfig("clockTextCB")
1339 | local clockLocX = readFromConfig("clockLocX")
1340 | local clockLocY = readFromConfig("clockLocY")
1341 | local clockScale = readFromConfig("clockScale")
1342 | local clockColor = readFromConfig("clockColor")
1343 | local clockDropShadowCB = readFromConfig("clockDropShadowCB")
1344 |
1345 | function showTimeTab()
1346 | clockCB, clockToggled = HSCheckbox("Show Local Time", clockCB, "clockCB")
1347 | HSshowTooltip("Draws your local time on your screen")
1348 | if clockCB then
1349 | showSecondsCB, showSecondsToggled = HSCheckbox("Show Seconds", showSecondsCB, "showSecondsCB")
1350 | clockTextCB, clockTextToggled = HSCheckbox("Show Text", clockTextCB, "clockTextCB")
1351 | HSshowTooltip("Show the \"Current time:\" text")
1352 | clockLocX, clockLocXUsed = HSSliderFloat("Clock Location X", clockLocX, 0.01, 1, "%.2f", ImGuiSliderFlags.Logarithmic, "clockLocX")
1353 | HSshowTooltip("X (left/right) location of the text")
1354 | clockLocY, clockLocYUsed = HSSliderFloat("Clock Location Y", clockLocY, 0.01, 1, "%.2f", ImGuiSliderFlags.Logarithmic, "clockLocY")
1355 | HSshowTooltip("Y (up/down) location of the text")
1356 | clockScale, clockScaleUsed = HSSliderFloat("Clock Scale", clockScale, 0.1, 1, "%.1f", ImGuiSliderFlags.Logarithmic, "clockScale")
1357 | HSshowTooltip("Scale of the text")
1358 | clockColor, clockColorUsed = HSColorEdit4("Clock Color", clockColor, "clockColor")
1359 | clockDropShadowCB, clockDropShadowToggled = HSCheckbox("Text Drop Shadow", clockDropShadowCB, "clockDropShadowCB")
1360 | end
1361 | end
1362 |
1363 | script.register_looped("HS Show Time Loop", function(showTimeLoop)
1364 | if clockCB then
1365 | local timestamp = os.time()
1366 | local date = os.date("*t", timestamp)
1367 |
1368 | local function formatTimeUnit(timeUnit)
1369 | return timeUnit < 10 and "0" .. timeUnit or timeUnit
1370 | end
1371 |
1372 | local defaultTime = date.hour .. ":" .. formatTimeUnit(date.min)
1373 | local seconds = formatTimeUnit(date.sec)
1374 |
1375 | local clockText = defaultTime
1376 | if showSecondsCB then
1377 | clockText = clockText .. ":" .. seconds
1378 | end
1379 | if clockTextCB then
1380 | clockText = "Current time: " .. clockText
1381 | end
1382 |
1383 | if clockDropShadowCB then
1384 | dropShadow = 1
1385 | elseif not clockDropShadowCB then
1386 | dropShadow = 0
1387 | end
1388 | local clockColorR = math.floor(clockColor[1] * 255)
1389 | local clockColorG = math.floor(clockColor[2] * 255)
1390 | local clockColorB = math.floor(clockColor[3] * 255)
1391 | local clockColorA = math.floor(clockColor[4] * 255)
1392 |
1393 | HUD.BEGIN_TEXT_COMMAND_DISPLAY_TEXT("STRING")
1394 | HUD.ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(clockText)
1395 | HUD.SET_TEXT_JUSTIFICATION(0)
1396 | HUD.SET_TEXT_SCALE(clockScale, clockScale)
1397 | HUD.SET_TEXT_DROPSHADOW(dropShadow, 1, 1, 1, 1)
1398 | HUD.SET_TEXT_COLOUR(clockColorR, clockColorG, clockColorB, clockColorA)
1399 | HUD.END_TEXT_COMMAND_DISPLAY_TEXT(clockLocX, clockLocY, 0)
1400 | end
1401 | end)
1402 |
1403 | --[[
1404 |
1405 | Radar Manipulations -> HUD Tab
1406 |
1407 | ]]--
1408 |
1409 | local expandedRadarCB = readFromConfig("expandedRadarCB")
1410 | local radarZoom = readFromConfig("radarZoom")
1411 |
1412 | function radarManipulation()
1413 | expandedRadarCB, expandedRadarToggled = HSCheckbox("Show Expanded Radar", expandedRadarCB, "expandedRadarCB")
1414 | HSshowTooltip(ReverseBoolToStatus(expandedRadarCB) .. " expanded radar on your screen", "Currently not working in Online", {1,0.7,0.4,1})
1415 | if expandedRadarCB then -- moved the execution here and removed the wile loop because it was causing the script to immediately hide the minimap in GTA online whenever it runs. we don't need to loop it because it's basically an on/off switch depending on the state of the checkbox.
1416 | -- if not CFX.IS_BIGMAP_ACTIVE() then -- afaik, this is required to set the expanded radar in online but we can't run CFX natives. Not entirely sure though!
1417 | HUD.SET_BIGMAP_ACTIVE(true, false) -- still not working in online though but it works fine in SP.
1418 | -- end
1419 | else
1420 | HUD.SET_BIGMAP_ACTIVE(false, false)
1421 | end
1422 | radarZoom, radarZoomUsed = HSSliderInt("Radar Zoom", radarZoom, 0, 1400, "radarZoom")
1423 | HSshowTooltip("This will change the zoom of the radar\n0 = Default\n1400 = Max Zoomed Out")
1424 | if radarZoom then
1425 | HUD.SET_RADAR_ZOOM(radarZoom)
1426 | end
1427 | end
1428 | --[[
1429 |
1430 | NPC ESP -> HS Settings
1431 |
1432 | Credits to @pierrelasse in GitHub for helping me with this :D
1433 |
1434 | ]]--
1435 |
1436 | ESPTab:add_imgui(function()
1437 | npcEspTab()
1438 | end)
1439 |
1440 | local npcEspCB = readFromConfig("npcEspCB")
1441 | local npcEspShowEnemCB = readFromConfig("npcEspShowEnemCB")
1442 | local npcEspBoxCB = readFromConfig("npcEspBoxCB")
1443 | local npcEspTracerCB = readFromConfig("npCEspTracerCB")
1444 | local npcEspLosCB = readFromConfig("npcEspLosCB")
1445 | local npcEspDistance = readFromConfig("npcEspDistance")
1446 | local npcEspColor = readFromConfig("npcEspColor")
1447 |
1448 | function npcEspTab()
1449 | npcEspCB, npcEspToggled = HSCheckbox("NPC ESP", npcEspCB, "npcEspCB")
1450 | npcEspShowEnemCB, npcEspShowEnemCBToggled = HSCheckbox("Show Only Enemies", npcEspShowEnemCB, "npcEspShowEnemCB")
1451 | npcEspBoxCB, npcEspBoxCBToggled = HSCheckbox("NPC ESP Box", npcEspBoxCB, "npcEspBoxCB")
1452 | HSshowTooltip("Draws a box around NPCs")
1453 | npcEspTracerCB, npcEspTracerCBToggled = HSCheckbox("NPC ESP Tracer", npcEspTracerCB, "npCEspTracerCB")
1454 | HSshowTooltip("Draws a line from the NPC to the player")
1455 | npcEspDistance, npcEspDistanceUsed = HSSliderFloat("ESP Max Distance", npcEspDistance, 0, 150, "%.0f", ImGuiSliderFlags.Logarithmic, "npcEspDistance")
1456 | HSshowTooltip("Sets max distance for how far the NPC ESP will work")
1457 | npcEspColor, npcEspColorUsed = HSColorEdit4("ESP Color", npcEspColor, "npcEspColor")
1458 | end
1459 |
1460 | function calculate_distance(x1, y1, z1, x2, y2, z2)
1461 | return math.sqrt((x2 - x1) ^ 2 + (y2 - y1) ^ 2 + (z2 - z1) ^ 2)
1462 | end
1463 |
1464 | function draw_rect(x, y, width, height)
1465 | GRAPHICS.DRAW_RECT(x, y, width, height, math.floor(npcEspColor[1] * 255), math.floor(npcEspColor[2] * 255), math.floor(npcEspColor[3] * 255), math.floor(npcEspColor[4] * 255), false)
1466 | end
1467 |
1468 | script.register_looped("HS NPC ESP Loop", function(npcEspLoop)
1469 | if npcEspCB then
1470 | local player = PLAYER.PLAYER_PED_ID()
1471 | local playerCoords = ENTITY.GET_ENTITY_COORDS(player, true)
1472 | local allPeds = entities.get_all_peds_as_handles()
1473 | for i, ped in ipairs(allPeds) do
1474 | if ENTITY.DOES_ENTITY_EXIST(ped) and not PED.IS_PED_A_PLAYER(ped) and PED.IS_PED_HUMAN(ped) and not PED.IS_PED_DEAD_OR_DYING(ped, true) then
1475 | local pedCoords = ENTITY.GET_ENTITY_COORDS(ped, true)
1476 |
1477 | HSConsoleLogDebug("Found ped " .. ped .. " at coordinates " .. tostring(pedCoords))
1478 | local distance = SYSTEM.VDIST(playerCoords.x, playerCoords.y, playerCoords.z, pedCoords.x, pedCoords.y, pedCoords.z)
1479 | if distance <= npcEspDistance then
1480 | local pedEnemy = PED.IS_PED_IN_COMBAT(ped, player)
1481 | if pedEnemy then
1482 | HSConsoleLogDebug("Ped is an enemy: " .. tostring(pedEnemy))
1483 | end
1484 | local success, screenX, screenY = GRAPHICS.GET_SCREEN_COORD_FROM_WORLD_COORD(pedCoords.x, pedCoords.y, pedCoords.z, 0.0, 0.0)
1485 | HSConsoleLogDebug("Screen coords: " .. tostring(screenX) .. ", " .. tostring(screenY))
1486 | if success and npcEspBoxCB and (not npcEspShowEnemCB or pedEnemy) then
1487 | -- Calculate the distance from the ped to the camera
1488 | local camCoords = CAM.GET_GAMEPLAY_CAM_COORD()
1489 | HSConsoleLogDebug("Camera coords: " .. tostring(camCoords))
1490 | local distanceToCam = calculate_distance(pedCoords.x, pedCoords.y, pedCoords.z, camCoords.x, camCoords.y, camCoords.z)
1491 | HSConsoleLogDebug("Distance to ped " .. ped .. " is " .. distanceToCam)
1492 |
1493 | -- Size of the box based on the distance to the camera
1494 | local boxSize = 2 * (1 / distanceToCam)
1495 |
1496 | -- Minimum box thickness
1497 | local minThickness = 0.001
1498 |
1499 | -- Thickness of the outline based on the distance to the camera, with a lower limit
1500 | local thickness = math.max(minThickness, 0.0015 * (1 / distanceToCam))
1501 | HSConsoleLogDebug("Box thickness: " .. thickness)
1502 |
1503 | -- Call the functions to draw the box
1504 | draw_rect(screenX, screenY - boxSize / 2 + 0.001, boxSize / 4, thickness) -- Top
1505 | draw_rect(screenX, screenY + boxSize / 2 - 0.001, boxSize / 4, thickness) -- Bottom
1506 | draw_rect(screenX - boxSize / 8, screenY, thickness, boxSize - 2 * thickness) -- Left
1507 | draw_rect(screenX + boxSize / 8, screenY, thickness, boxSize - 2 * thickness) -- Right
1508 | end
1509 | -- Draw a line from the player to the NPC if the tracer is enabled
1510 | if success and npcEspTracerCB and (not npcEspShowEnemCB or pedEnemy) then
1511 | GRAPHICS.DRAW_LINE(playerCoords.x, playerCoords.y, playerCoords.z, pedCoords.x, pedCoords.y, pedCoords.z, math.floor(npcEspColor[1] * 255), math.floor(npcEspColor[2] * 255), math.floor(npcEspColor[3] * 255), math.floor(npcEspColor[4] * 255))
1512 | end
1513 | end
1514 | end
1515 | end
1516 | end
1517 | end)
1518 |
1519 | --[[
1520 |
1521 | Experimentals (WIP) -> HS Settings
1522 |
1523 | ]]--
1524 | ExperimentalTab:add_imgui(function()
1525 | ImGui.Text("Experimental features that I'm working on and may add to this tab.")
1526 | ImGui.Text("Feel free to test them out and give any feedback.")
1527 | end)
1528 | --[[
1529 |
1530 | Harmless's Scripts Functions
1531 |
1532 | ]]--
1533 |
1534 | -- HS Notification Functions
1535 | function HSNotification(message)
1536 | if notifyCB then
1537 | gui.show_message("Harmless's Scripts", message)
1538 | end
1539 | end
1540 |
1541 | function HSWarnNotif(message)
1542 | if notifyCB and warnNotifyCB then
1543 | gui.show_warning("Harmless's Scripts", message)
1544 | end
1545 | end
1546 |
1547 | function HSErrorNotif(message)
1548 | if notifyCB and errorNotifyCB then
1549 | gui.show_error("Harmless's Scripts", message)
1550 | end
1551 | end
1552 |
1553 | -- HS Console Log Functions
1554 | function HSConsoleLogInfo(message) -- Info
1555 | if HSConsoleLogInfoCB then
1556 | log.info(message)
1557 | end
1558 | end
1559 | function HSConsoleLogWarn(message) -- Warning
1560 | if HSConsoleLogWarnCB then
1561 | log.warning(message)
1562 | end
1563 | end
1564 | function HSConsoleLogDebug(message) -- Debug
1565 | if HSConsoleLogDebugCB then
1566 | log.debug(message)
1567 | end
1568 | end
1569 |
1570 |
1571 | --[[
1572 |
1573 | HS Tooltip Functions
1574 |
1575 | --]]
1576 |
1577 | hoverStartTimes = {}
1578 | showTooltips = {}
1579 |
1580 | local commonFlags = ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse | ImGuiWindowFlags.NoInputs
1581 | local fullScreenFlags = ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoBackground | commonFlags
1582 | local toolTipBaseFlags = ImGuiWindowFlags.AlwaysAutoResize | commonFlags
1583 | local commonChildFlags = ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoBackground | commonFlags
1584 |
1585 | local function GetFullScreenResolution(screenWidth, screenHeight, offsetY)
1586 | ImGui.Begin("", fullScreenFlags)
1587 | ImGui.SetNextWindowPos(screenWidth / 2, screenHeight - offsetY, ImGuiCond.Always, 0.5, 1.0)
1588 | end
1589 |
1590 | local function displayToolTipWindow(winWidth, winHeight)
1591 | ImGui.BeginChild("Tooltip Window", winWidth, winHeight, false, commonChildFlags)
1592 | end
1593 |
1594 | local function displayHotkeyInfo()
1595 | ImGui.SameLine(); ImGui.Dummy(10, 1)
1596 | ImGui.SameLine(); ImGui.BeginGroup()
1597 | ImGui.Text("Set Hotkey: F12 (WIP)")
1598 | ImGui.Text("Current Hotkey: None (WIP)")
1599 | ImGui.EndGroup()
1600 | ImGui.End()
1601 | end
1602 |
1603 | -- Chekcs if the item is hovered and if it's hovered for 200ms, it will show the tooltip
1604 | local function hoverCheck(message)
1605 | if ImGui.IsItemHovered() then
1606 | hoverStartTimes[message] = hoverStartTimes[message] or os.clock()
1607 | if os.clock() - hoverStartTimes[message] >= toolTipDelay then
1608 | showTooltips[message] = true
1609 | hoverStartTimes[message] = nil
1610 | end
1611 | else
1612 | hoverStartTimes[message] = nil
1613 | showTooltips[message] = false
1614 | end
1615 | end
1616 |
1617 | -- Show (?) icon
1618 | -- Credits: @Deadlineem and Extras Addon for the tooltip icon idea "(?)"
1619 | local function displayToolTipIcon(smColor)
1620 | if toolTipIconCB then
1621 | ImGui.SameLine()
1622 | if smColor then
1623 | ImGui.PushStyleColor(ImGuiCol.Text, smColor[1], smColor[2], smColor[3], smColor[4] - 0.4)
1624 | ImGui.Text("(?)")
1625 | ImGui.PopStyleColor()
1626 | elseif not smColor then
1627 | ImGui.PushStyleColor(ImGuiCol.Text, 0.4, 0.4, 0.4, 1)
1628 | ImGui.Text("(?)")
1629 | ImGui.PopStyleColor()
1630 | end
1631 | end
1632 | end
1633 |
1634 | function HSshowTooltip(message, specialMessage, smColor)
1635 | -- Display Tooltip Icon depending on the settings
1636 | if toolTipIconOnlyCB then
1637 | displayToolTipIcon(smColor)
1638 | hoverCheck(message)
1639 | elseif not toolTipIconOnlyCB then
1640 | hoverCheck(message)
1641 | displayToolTipIcon(smColor)
1642 | end
1643 |
1644 | -- Show Tooltip
1645 | if showTooltips[message] then
1646 | if toolTipCB and not toolTipV2CB then
1647 | if specialMessage then
1648 | message = message .. "\n\n Note: " .. specialMessage
1649 | ImGui.SetTooltip(message)
1650 | else
1651 | ImGui.SetTooltip(message)
1652 | end
1653 | -- Show Tooltip V2
1654 | elseif toolTipV2CB and not toolTipCB then
1655 | local screenWidth, screenHeight = GRAPHICS.GET_ACTUAL_SCREEN_RESOLUTION(0,0)
1656 | GetFullScreenResolution(screenWidth, screenHeight, 100)
1657 | if ImGui.Begin("ToolTip Base", toolTipBaseFlags) then
1658 | local textWidth = 300
1659 | local _, textHeight = ImGui.CalcTextSize(message, false, textWidth)
1660 | if specialMessage and smColor then
1661 | local _, specialtextHeight = ImGui.CalcTextSize(specialMessage, false, textWidth)
1662 | local totalHeight = textHeight + (specialtextHeight + 10)
1663 | displayToolTipWindow(textWidth, totalHeight)
1664 | ImGui.TextWrapped(message)
1665 | ImGui.PushStyleColor(ImGuiCol.Text, smColor[1], smColor[2], smColor[3], smColor[4])
1666 | ImGui.TextWrapped(specialMessage)
1667 | ImGui.PopStyleColor()
1668 | elseif specialMessage and not smColor then
1669 | local _, specialtextHeight = ImGui.CalcTextSize(specialMessage, false, textWidth)
1670 | local totalHeight = textHeight + (specialtextHeight + 10)
1671 | displayToolTipWindow(textWidth, totalHeight)
1672 | ImGui.TextWrapped(message)
1673 | ImGui.TextWrapped(specialMessage)
1674 | elseif not specialMessage and not smColor then
1675 | displayToolTipWindow(textWidth, textHeight)
1676 | ImGui.TextWrapped(message)
1677 | end
1678 | ImGui.EndChild()
1679 | displayHotkeyInfo()
1680 | end
1681 | ImGui.End()
1682 | end
1683 | end
1684 | end
1685 |
1686 | --[[
1687 |
1688 | HS Utility Functions
1689 |
1690 | ]]--
1691 | function BoolToStatus(boolValue) -- Convert bool true/false to Enable/Disable
1692 | return boolValue and "Enable" or "Disable"
1693 | end
1694 |
1695 | function ReverseBoolToStatus(boolValue) -- Reverse bool convert true/false to Disable/Enable
1696 | return boolValue and "Disable" or "Enable"
1697 | end
1698 |
1699 | function GetScreenResolution()
1700 | local screenWidth, screenHeight = GRAPHICS.GET_ACTUAL_SCREEN_RESOLUTION(0,0)
1701 | return screenWidth, screenHeight
1702 | end
1703 |
1704 | function GetScreenCenter()
1705 | local screenWidth, screenHeight = GetScreenResolution()
1706 | local centerX = screenWidth / 2
1707 | local centerY = screenHeight / 2
1708 | return centerX, centerY
1709 | end
1710 |
1711 | --[[
1712 |
1713 | Custom ImGui Item Functions
1714 |
1715 | ]]--
1716 | function HSCheckbox(label, bool_variable, item_tag)
1717 | local newBool, toggled = ImGui.Checkbox(label, bool_variable)
1718 | if toggled then
1719 | bool_variable = newBool
1720 | saveToConfig(item_tag, bool_variable)
1721 | end
1722 | return bool_variable, toggled
1723 | end
1724 |
1725 | function HSSliderFloat(label, float_variable, min, max, format, flags, item_tag)
1726 | local newFloat, used = ImGui.SliderFloat(label, float_variable, min, max, format, flags)
1727 | if used then
1728 | float_variable = newFloat
1729 | saveToConfig(item_tag, float_variable)
1730 | end
1731 | return float_variable, used
1732 | end
1733 |
1734 | function HSSliderInt(label, int_variable, min, max, item_tag)
1735 | local newInt, used = ImGui.SliderInt(label, int_variable, min, max)
1736 | if used then
1737 | int_variable = newInt
1738 | saveToConfig(item_tag, int_variable)
1739 | end
1740 | return int_variable, used
1741 | end
1742 |
1743 | function HSColorEdit4(label, color_variable, item_tag)
1744 | local newColor, used = ImGui.ColorEdit4(label, color_variable)
1745 | if used then
1746 | color_variable = newColor
1747 | saveToConfig(item_tag, color_variable)
1748 | end
1749 | return color_variable, used
1750 | end
1751 |
1752 | function HSCombobox(label, current_item, items, items_count, popup_max_height_in_items)--, item_tag)
1753 | if items ~= nil and #items == items_count then
1754 | newInt, used = ImGui.Combo(label, current_item, items, items_count, popup_max_height_in_items)
1755 | end
1756 | if used then
1757 | current_item = newInt
1758 | --saveToConfig(item_tag, current_item) -- Not needed for comboboxes really, or for the purpose I'm currently using it for.
1759 | end
1760 | return current_item, used
1761 | end
1762 |
1763 | function HSButton(label, txtColor)
1764 | ImGui.PushStyleColor(ImGuiCol.Text, txtColor[1], txtColor[2], txtColor[3], txtColor[4])
1765 | local used = ImGui.Button(label)
1766 | ImGui.PopStyleColor()
1767 | return used
1768 | end
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | # Harmless's Lua Scripts
3 |
4 | Fun and useful Lua scripts for [YimMenu](https://github.com/YimMenu/YimMenu/) made by [Harmless](https://github.com/Harmless05/) :D
5 |
6 |
7 | - [Script Layout](#script-layout)
8 | - [Current Features of Harmless's Scripts](#current-features-of-harmlesss-scripts)
9 | - [How to install](#how-to-install)
10 | - [Warranty Disclaimer](#warranty-disclaimer)
11 | - [Usage of Harmless's Scripts](#usage-of-harmlesss-scripts)
12 | - [Reporting and suggestions](#reporting-and-suggestions)
13 |
14 | ## Script Layout
15 |
16 |
17 | Self Tab
18 |
19 | - Player Regeneration
20 | - Player Speed Multipliers
21 | - Ragdoll Player
22 |
23 |
24 |
25 |
26 | Teleport Tab
27 |
28 | - Quick Teleport
29 | - Popular Locations
30 |
31 |
32 |
33 |
34 | Vehicle Tab
35 |
36 | - Set Vehicle Max Speed
37 | - Set Vehicle Forward Speed
38 | - Shift Drift
39 | - Auto Flip Vehicle
40 |
41 |
42 |
43 |
44 | Misc Tab
45 |
46 | - Walk on Air
47 | - Low Graphics (Potato mode)
48 | - Snow Trails
49 |
50 |
51 |
52 |
53 | Quick Tab
54 |
55 | - Self Options
56 | - Clear Wanted Level
57 | - Heal Player
58 | - Give All Weapons
59 | - Give All Ammo
60 | - Fill Ammo
61 | - Give Max Armor
62 | - Clean Player
63 | - Fill Snacks
64 | - Teleport Options
65 | - Teleport to Waypoint
66 | - Teleport to Objective
67 | - Vehicle Options
68 | - Repair Personal Vehicle
69 | - Upgrade Vehicle
70 | - Downgrade Vehicle
71 | - Bring Personal Vehicle
72 | - TP into Personal Vehicle
73 | - Misc Options
74 | - Leave Online
75 | - Damage Player
76 | - Rage Quit
77 |
78 |
79 |
80 |
81 | Settings
82 |
83 | - Notifications
84 | - ImGui Tooltip (YimMenu Default)
85 | - Custom Tooltip
86 | - Console Logs
87 | - Reset Config
88 |
89 |
90 |
91 |
92 | HUD
93 |
94 | - Show Local Time
95 | - Expanded Radar
96 | - Radar Zoom
97 |
98 |
99 |
100 |
101 | NPC ESP
102 |
103 | - NPC ESP
104 | - Show Only Hostile NPCs
105 | - Box ESP
106 | - Tracers (Line ESP)
107 | - Max Distance
108 | - ESP Color
109 |
110 |
111 |
112 | ## Current Features of Harmless's Scripts
113 |
114 | | Name | Description | Location |
115 | | ----------- | ----------- | ----------- |
116 | | Ragdoll Player | Ragdoll yourself once or looped | Self |
117 | | Walk on Air | Walk on air (literally) | Self |
118 | | Player Speed Multipliers | Set the speed multiplier of walk and swim speed | Self |
119 | | Player Regeneration | Regenerate your health and armor | Self |
120 | | Set Vehicle Max Speed | Set the max speed limit of your vehicle | Vehicle |
121 | | Set Vehicle Forward Speed | Set the forward speed of your vehicle | Vehicle |
122 | | Shift Drift | Press SHIFT to drift your vehicle | Vehicle |
123 | | Auto Flip Vehicle | Flip your vehicle automatically back upwards | Vehicle |
124 | | Thermal and Night Vision | Enable Thermal and Night Vision | Misc |
125 | | Quick Options | Ease of access to more "popular" options | Quick |
126 | | Quick Teleport | Save your current location and teleport to it later | Teleport |
127 | | Popular Locations | Teleport to popular GTAV locations | Teleport -> Popular Locations |
128 | | Show Local Time | Shows your local time on the screen | HUD |
129 | | NPC ESP | ESP for NPCs | Misc |
130 | | Radar Zoom | Zoom the radar in and out | HUD |
131 | | Expanded Radar | Show expanded radar (has the same effect when pressin Z, but is always on) | HUD |
132 | | Custom Tooltip | Custom tooltip for Harmless's Scripts | |
133 |
134 |
135 | ## How to install
136 |
137 | 1. Download the latest release [here](https://github.com/YimMenu-Lua/Harmless-Scripts/releases/latest)
138 | 2. Put the script in the `scripts` folder of YimMenu
139 | - You can find the YimMenu folder by opening the RUN window (Windows key + R) and typing `%appdata%` and pressing enter
140 | - Then look for the `YimMenu` -> `scripts` folder and put the script in there
141 | - **OR** you can open YimMenu goto in the menu `Settings` -> `Lua Scripts` and click on the `Open Lua Scripts Folder` button. Then put the script in there
142 | 3. Launch GTA V and open YimMenu if you haven't already
143 | 4. Click on the `Reload All` button if the script does not appear
144 |
145 | ## Warranty Disclaimer
146 |
147 | The scripts provided in this repository are provided "as is" without warranty of any kind. These lua scripts may not work as expected and the author (Harmless) isn’t responsible for any issues that arise from their use. By using these scripts, you accept all risks and agree to not hold Harmless accountable for any negative outcomes.
148 |
149 | Please use this Harmless's Scripts at your own risk. By using this lua script, you agree to indemnify and hold Harmless, the author from any and all claims, damages, losses, liabilities, costs, and expenses arising from your use of the lua script.
150 |
151 | ## Usage of Harmless's Scripts
152 |
153 | You are welcome to use my script, but please **DO NOT claim** them as your own. **Please credit me** if you wish to use Harmless's Scripts in your own script or create a forked version.
154 |
155 | You are welcome to use Harmless's Scripts lua in this repository for your own **personal projects**. However, please note that they are not intended for commercial use. If you wish to use Harmless's Scripts for commercial purposes, please contact me (Harmless) to obtain permission.
156 |
157 | ## Reporting and suggestions
158 |
159 | If you encounter any issues or bugs while using Harmless's Scripts, please report them to this [repository's issue tracker](https://github.com/YimMenu-Lua/Harmless-Scripts/issues) or get in touch with me directly via Discord. Please include as much information as possible, including the script name, the version of the script, and the version of YimMenu you are using.
160 |
161 | You are also welcome to suggest new scripts, features, or improvements to existing features of Harmless's Scripts. Please note that I may not be able to implement all suggestions, but I will do my best to consider them
162 |
163 |
164 | #### You can report your issues by visiting the following link:
165 |
--------------------------------------------------------------------------------