-
Notifications
You must be signed in to change notification settings - Fork 0
/
langay[test stage].lua
433 lines (361 loc) · 19.2 KB
/
langay[test stage].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
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
-- imports start
local ffi = require('ffi')
local vector = require 'vector'
local trace = require("gamesense/trace")
local entitylib = require 'gamesense/entity'
local antiaim_funcs = require("gamesense/antiaim_funcs")
local c_entity = require 'gamesense/entity'
local http = require 'gamesense/http'
local base64 = require 'gamesense/base64'
local clipboard = require 'gamesense/clipboard'
local steamworks = require 'gamesense/steamworks'
local bit_band, bit_lshift, client_color_log, client_create_interface, client_delay_call, client_find_signature, client_key_state, client_reload_active_scripts, client_screen_size, client_set_event_callback, client_system_time, client_timestamp, client_unset_event_callback, database_read, database_write, entity_get_classname, entity_get_local_player, entity_get_origin, entity_get_player_name, entity_get_prop, entity_get_steam64, entity_is_alive, globals_framecount, globals_realtime, math_ceil, math_floor, math_max, math_min, panorama_loadstring, renderer_gradient, renderer_line, renderer_rectangle, table_concat, table_insert, table_remove, table_sort, ui_get, ui_is_menu_open, ui_mouse_position, ui_new_checkbox, ui_new_color_picker, ui_new_combobox, ui_new_slider, ui_set, ui_set_visible, setmetatable, pairs, error, globals_absoluteframetime, globals_curtime, globals_frametime, globals_maxplayers, globals_tickcount, globals_tickinterval, math_abs, type, pcall, renderer_circle_outline, renderer_load_rgba, renderer_measure_text, renderer_text, renderer_texture, tostring, ui_name, ui_new_button, ui_new_hotkey, ui_new_label, ui_new_listbox, ui_new_textbox, ui_reference, ui_set_callback, ui_update, unpack, tonumber = bit.band, bit.lshift, client.color_log, client.create_interface, client.delay_call, client.find_signature, client.key_state, client.reload_active_scripts, client.screen_size, client.set_event_callback, client.system_time, client.timestamp, client.unset_event_callback, database.read, database.write, entity.get_classname, entity.get_local_player, entity.get_origin, entity.get_player_name, entity.get_prop, entity.get_steam64, entity.is_alive, globals.framecount, globals.realtime, math.ceil, math.floor, math.max, math.min, panorama.loadstring, renderer.gradient, renderer.line, renderer.rectangle, table.concat, table.insert, table.remove, table.sort, ui.get, ui.is_menu_open, ui.mouse_position, ui.new_checkbox, ui.new_color_picker, ui.new_combobox, ui.new_slider, ui.set, ui.set_visible, setmetatable, pairs, error, globals.absoluteframetime, globals.curtime, globals.frametime, globals.maxplayers, globals.tickcount, globals.tickinterval, math.abs, type, pcall, renderer.circle_outline, renderer.load_rgba, renderer.measure_text, renderer.text, renderer.texture, tostring, ui.name, ui.new_button, ui.new_hotkey, ui.new_label, ui.new_listbox, ui.new_textbox, ui.reference, ui.set_callback, ui.update, unpack, tonumber
local entity_get_local_player, entity_is_enemy, entity_get_all, entity_set_prop, entity_is_alive, entity_is_dormant, entity_get_player_name, entity_get_game_rules, entity_get_origin, entity_hitbox_position, entity_get_players, entity_get_prop = entity.get_local_player, entity.is_enemy, entity.get_all, entity.set_prop, entity.is_alive, entity.is_dormant, entity.get_player_name, entity.get_game_rules, entity.get_origin, entity.hitbox_position, entity.get_players, entity.get_prop
local math_cos, math_sin, math_rad, math_sqrt = math.cos, math.sin, math.rad, math.sqrt
local math_floor = math.floor
local ffi_cdef, ffi_cast, ffi_new = ffi.cdef, ffi.cast, ffi.new
local bit_band, bit_bor, v_interface, v_check = bit.band, bit.bor, {}, {}
local math_cos, math_sin, math_rad, math_sqrt = math.cos, math.sin, math.rad, math.sqrt
-- ui start
current_tab = ui.new_combobox("LUA", "B", "Tabs", {'Home', 'Resolver', 'ChatGPT Peek'})
local text1 = ui.new_label("LUA", "B", "langay.lua for gs")
local text2 = ui.new_label("LUA", "B", "last live build 29.11.24")
local text3 = ui.new_label("LUA", "B", "username: " .. nickname)
local resolver_enabled = ui.new_checkbox("LUA", "B", "Enable Enhanced Resolver")
local resolver_debug = ui.new_checkbox("LUA", "B", "Enhanced Resolver Debug")
local resolver_mode = ui.new_combobox("LUA", "B", "Enhanced Resolver Mode", "Standard", "Adaptive", "Experimental", "Advanced", "Predictive", "Complex", "Custom")
local resolver_iterations = ui.new_slider("LUA", "B", "Enhanced Resolver Iterations", 1, 10, 1, true, "", 1)
local resolver_backtrack = ui.new_checkbox("LUA", "B", "Enable Enhanced Backtracking")
local resolver_predictive = ui.new_checkbox("LUA", "B", "Enable Enhanced Predictive Adjustments")
local resolver_spin = ui.new_checkbox("LUA", "B", "Enable Spin Resolver")
local resolver_fakelag = ui.new_checkbox("LUA", "B", "Enable Fake Lag Resolver")
local resolver_desync = ui.new_checkbox("LUA", "B", "Enable Desync Resolver")
local resolver_delay = ui.new_slider("LUA", "B", "Resolver Delay (ms)", 0, 1000, 0, true, "ms", 1)
local resolver_complexity = ui.new_slider("LUA", "B", "Resolver Complexity", 1, 100, 50, true, "", 1)
local function manage_visibility()
local selected_tab = ui.get(current_tab) -- Получаем текущий выбранный таб
-- Управляем видимостью элементов "Home"
local is_home_tab = selected_tab == "Home"
ui.set_visible(text1, is_home_tab)
ui.set_visible(text2, is_home_tab)
ui.set_visible(text3, is_home_tab)
-- Управляем видимостью элементов "Resolver"
local is_resolver_tab = selected_tab == "Resolver"
ui.set_visible(resolver_enabled, is_resolver_tab)
ui.set_visible(resolver_debug, is_resolver_tab)
ui.set_visible(resolver_mode, is_resolver_tab)
ui.set_visible(resolver_iterations, is_resolver_tab)
ui.set_visible(resolver_backtrack, is_resolver_tab)
ui.set_visible(resolver_predictive, is_resolver_tab)
ui.set_visible(resolver_spin, is_resolver_tab)
ui.set_visible(resolver_fakelag, is_resolver_tab)
ui.set_visible(resolver_desync, is_resolver_tab)
ui.set_visible(resolver_delay, is_resolver_tab)
ui.set_visible(resolver_complexity, is_resolver_tab)
-- Вы можете добавить управление видимостью для других табов, таких как "ChatGPT Peek", если потребуется.
end
-- Вызываем управление видимостью при изменении таба
ui.set_callback(current_tab, manage_visibility)
-- Устанавливаем начальную видимость элементов
manage_visibility()
local cached_yaw = {}
local cached_lby = {}
local player_states = {}
local shot_history = {}
local desync_cache = {}
local last_resolved_time = {}
local function normalize_angle(angle)
while angle > 180 do angle = angle - 360 end
while angle < -180 do angle = angle + 360 end
return angle
end
local function calculate_delta(angle1, angle2)
if angle1 == nil or angle2 == nil then
return 0
end
return math.abs(normalize_angle(angle1 - angle2))
end
local function get_max_desync_delta(player)
return (entity.get_prop(player, "m_flPoseParameter", 11) * 58) + 0.5
end
local function update_player_state(player)
if not player_states[player] then
player_states[player] = { shots_fired = 0, hits = 0, misses = 0, desync_detected = false, last_yaw = nil }
end
end
local function log_debug(message)
if ui.get(resolver_debug) then
client.log(message)
end
end
local function get_random_factor()
return math.random() * ui.get(resolver_complexity) / 100
end
local function resolve_standard(player)
local player_yaw = entity.get_prop(player, "m_angEyeAngles[1]")
local player_lby = entity.get_prop(player, "m_flLowerBodyYawTarget")
local yaw_delta = calculate_delta(player_yaw, cached_yaw[player])
local lby_delta = calculate_delta(player_lby, cached_lby[player])
if yaw_delta > 35 then
local new_yaw = normalize_angle(player_yaw + get_max_desync_delta(player))
entity.set_prop(player, "m_angEyeAngles[1]", new_yaw)
else
entity.set_prop(player, "m_angEyeAngles[1]", player_lby)
end
cached_yaw[player] = player_yaw
cached_lby[player] = player_lby
end
local function resolve_adaptive(player)
local player_yaw = entity.get_prop(player, "m_angEyeAngles[1]")
local player_lby = entity.get_prop(player, "m_flLowerBodyYawTarget")
local yaw_delta = calculate_delta(player_yaw, cached_yaw[player])
local lby_delta = calculate_delta(player_lby, cached_lby[player])
if yaw_delta > 35 then
local max_desync = get_max_desync_delta(player)
local new_yaw = normalize_angle(player_yaw + max_desync)
entity.set_prop(player, "m_angEyeAngles[1]", new_yaw)
else
entity.set_prop(player, "m_angEyeAngles[1]", player_lby)
end
cached_yaw[player] = player_yaw
cached_lby[player] = player_lby
end
local function resolve_experimental(player)
local player_yaw = entity.get_prop(player, "m_angEyeAngles[1]")
local player_lby = entity.get_prop(player, "m_flLowerBodyYawTarget")
local yaw_delta = calculate_delta(player_yaw, cached_yaw[player])
local lby_delta = calculate_delta(player_lby, cached_lby[player])
if yaw_delta > 35 then
local max_desync = get_max_desync_delta(player)
local iterations = ui.get(resolver_iterations)
for i = 1, iterations do
local new_yaw = normalize_angle(player_yaw + (i * (max_desync / iterations)))
entity.set_prop(player, "m_angEyeAngles[1]", new_yaw)
end
else
entity.set_prop(player, "m_angEyeAngles[1]", player_lby)
end
cached_yaw[player] = player_yaw
cached_lby[player] = player_lby
end
local function resolve_advanced(player)
local player_yaw = entity.get_prop(player, "m_angEyeAngles[1]")
local player_lby = entity.get_prop(player, "m_flLowerBodyYawTarget")
local max_desync = get_max_desync_delta(player)
local yaw_delta = calculate_delta(player_yaw, cached_yaw[player])
local lby_delta = calculate_delta(player_lby, cached_lby[player])
if yaw_delta > 35 then
local new_yaw = normalize_angle(player_yaw + max_desync * 0.75)
entity.set_prop(player, "m_angEyeAngles[1]", new_yaw)
elseif lby_delta > 35 then
local new_yaw = normalize_angle(player_lby + max_desync * 0.75)
entity.set_prop(player, "m_angEyeAngles[1]", new_yaw)
else
entity.set_prop(player, "m_angEyeAngles[1]", player_lby)
end
cached_yaw[player] = player_yaw
cached_lby[player] = player_lby
end
local function resolve_predictive(player)
local player_yaw = entity.get_prop(player, "m_angEyeAngles[1]")
local player_lby = entity.get_prop(player, "m_flLowerBodyYawTarget")
local max_desync = get_max_desync_delta(player)
local yaw_delta = calculate_delta(player_yaw, cached_yaw[player])
local lby_delta = calculate_delta(player_lby, cached_lby[player])
if yaw_delta > 35 then
local predicted_yaw = normalize_angle(player_yaw + (yaw_delta / 2))
entity.set_prop(player, "m_angEyeAngles[1]", predicted_yaw)
elseif lby_delta > 35 then
local predicted_yaw = normalize_angle(player_lby + (lby_delta / 2))
entity.set_prop(player, "m_angEyeAngles[1]", predicted_yaw)
else
entity.set_prop(player, "m_angEyeAngles[1]", player_lby)
end
cached_yaw[player] = player_yaw
cached_lby[player] = player_lby
end
local function resolve_complex(player)
local player_yaw = entity.get_prop(player, "m_angEyeAngles[1]")
local player_lby = entity.get_prop(player, "m_flLowerBodyYawTarget")
local max_desync = get_max_desync_delta(player)
local yaw_delta = calculate_delta(player_yaw, cached_yaw[player])
local lby_delta = calculate_delta(player_lby, cached_lby[player])
local random_factor = get_random_factor()
if yaw_delta > 35 then
local new_yaw = normalize_angle(player_yaw + max_desync * random_factor)
entity.set_prop(player, "m_angEyeAngles[1]", new_yaw)
elseif lby_delta > 35 then
local new_yaw = normalize_angle(player_lby + max_desync * random_factor)
entity.set_prop(player, "m_angEyeAngles[1]", new_yaw)
else
entity.set_prop(player, "m_angEyeAngles[1]", player_lby)
end
cached_yaw[player] = player_yaw
cached_lby[player] = player_lby
end
local function resolve_custom(player)
local player_yaw = entity.get_prop(player, "m_angEyeAngles[1]")
local player_lby = entity.get_prop(player, "m_flLowerBodyYawTarget")
local max_desync = get_max_desync_delta(player)
local yaw_delta = calculate_delta(player_yaw, cached_yaw[player])
local lby_delta = calculate_delta(player_lby, cached_lby[player])
local random_factor = get_random_factor()
if yaw_delta > 35 then
local new_yaw = normalize_angle(player_yaw + max_desync * random_factor)
entity.set_prop(player, "m_angEyeAngles[1]", new_yaw)
elseif lby_delta > 35 then
local new_yaw = normalize_angle(player_lby + max_desync * random_factor)
entity.set_prop(player, "m_angEyeAngles[1]", new_yaw)
else
local new_yaw = normalize_angle(player_yaw + (max_desync * random_factor / 2))
entity.set_prop(player, "m_angEyeAngles[1]", new_yaw)
end
cached_yaw[player] = player_yaw
cached_lby[player] = player_lby
end
local function resolver(player)
local resolver_type = ui.get(resolver_mode)
if resolver_type == "Standard" then
resolve_standard(player)
elseif resolver_type == "Adaptive" then
resolve_adaptive(player)
elseif resolver_type == "Experimental" then
resolve_experimental(player)
elseif resolver_type == "Advanced" then
resolve_advanced(player)
elseif resolver_type == "Predictive" then
resolve_predictive(player)
elseif resolver_type == "Complex" then
resolve_complex(player)
elseif resolver_type == "Custom" then
resolve_custom(player)
end
end
local backtrack_cache = {}
local function backtrack_enemy(player)
if not backtrack_cache[player] then
backtrack_cache[player] = {}
end
table.insert(backtrack_cache[player], entity.get_prop(player, "m_flSimulationTime"))
if #backtrack_cache[player] > 5 then
table.remove(backtrack_cache[player], 1)
end
local last_record = backtrack_cache[player][#backtrack_cache[player]]
if last_record then
entity.set_prop(player, "m_flSimulationTime", last_record)
end
end
local function predictive_resolver(player)
local player_yaw = entity.get_prop(player, "m_angEyeAngles[1]")
local player_lby = entity.get_prop(player, "m_flLowerBodyYawTarget")
local velocity = { entity.get_prop(player, "m_vecVelocity[0]"), entity.get_prop(player, "m_vecVelocity[1]") }
local velocity_length = math.sqrt(velocity[1]^2 + velocity[2]^2)
if velocity_length > 0.1 then
local new_yaw = normalize_angle(player_yaw + (velocity_length / 10))
entity.set_prop(player, "m_angEyeAngles[1]", new_yaw)
else
entity.set_prop(player, "m_angEyeAngles[1]", player_lby)
end
end
local function spin_resolver(player)
local player_yaw = entity.get_prop(player, "m_angEyeAngles[1]")
local spin_angle = (globals.tickcount() % 360)
local new_yaw = normalize_angle(player_yaw + spin_angle)
entity.set_prop(player, "m_angEyeAngles[1]", new_yaw)
end
local function fakelag_resolver(player)
local player_velocity = { entity.get_prop(player, "m_vecVelocity[0]"), entity.get_prop(player, "m_vecVelocity[1]") }
local player_yaw = entity.get_prop(player, "m_angEyeAngles[1]")
local velocity_length = math.sqrt(player_velocity[1]^2 + player_velocity[2]^2)
if velocity_length < 5 then
local new_yaw = normalize_angle(player_yaw + get_max_desync_delta(player))
entity.set_prop(player, "m_angEyeAngles[1]", new_yaw)
end
end
local function desync_resolver(player)
local player_yaw = entity.get_prop(player, "m_angEyeAngles[1]")
local desync_delta = get_max_desync_delta(player)
if desync_cache[player] then
local previous_desync = desync_cache[player]
local desync_change = math.abs(desync_delta - previous_desync)
if desync_change > 10 then
local new_yaw = normalize_angle(player_yaw + desync_change)
entity.set_prop(player, "m_angEyeAngles[1]", new_yaw)
end
end
desync_cache[player] = desync_delta
end
local function resolve_advanced_aim(player)
local player_yaw = entity.get_prop(player, "m_angEyeAngles[1]")
local player_lby = entity.get_prop(player, "m_flLowerBodyYawTarget")
local max_desync = get_max_desync_delta(player)
local random_factor = get_random_factor()
if calculate_delta(player_yaw, player_lby) > 35 then
local new_yaw = normalize_angle(player_yaw + (max_desync * random_factor))
entity.set_prop(player, "m_angEyeAngles[1]", new_yaw)
else
entity.set_prop(player, "m_angEyeAngles[1]", player_lby)
end
cached_yaw[player] = player_yaw
cached_lby[player] = player_lby
end
client.set_event_callback("paint", function()
if ui.get(resolver_enabled) then
local players = entity.get_players(true)
for i = 1, #players do
local player = players[i]
resolver(player)
resolve_advanced_aim(player)
if ui.get(resolver_backtrack) then
backtrack_enemy(player)
end
if ui.get(resolver_predictive) then
predictive_resolver(player)
end
if ui.get(resolver_spin) then
spin_resolver(player)
end
if ui.get(resolver_fakelag) then
fakelag_resolver(player)
end
if ui.get(resolver_desync) then
desync_resolver(player)
end
end
end
end)
client.log("langay resolver loaded!")
local function track_shots(player, event_type)
if not player_states[player] then
update_player_state(player)
end
if event_type == "fire" then
player_states[player].shots_fired = player_states[player].shots_fired + 1
log_debug("Shot fired by player: " .. player .. " Total shots: " .. player_states[player].shots_fired)
elseif event_type == "hit" then
player_states[player].hits = player_states[player].hits + 1
log_debug("Shot hit by player: " .. player .. " Total hits: " .. player_states[player].hits)
elseif event_type == "miss" then
player_states[player].misses = player_states[player].misses + 1
log_debug("Shot missed by player: " .. player .. " Total misses: " .. player_states[player].misses)
end
end
-- Event callbacks for tracking shots, hits, and misses
client.set_event_callback("weapon_fire", function(event)
local player = client.userid_to_entindex(event.userid)
if player then
track_shots(player, "fire")
end
end)
client.set_event_callback("player_hurt", function(event)
local player = client.userid_to_entindex(event.userid)
if player then
track_shots(player, "hit")
end
end)
client.set_event_callback("player_death", function(event)
local player = client.userid_to_entindex(event.userid)
if player then
track_shots(player, "miss")
end
end)