· 6 years ago · Dec 04, 2019, 03:40 PM
1
2
3local frame_rate = 0.0
4local get_abs_fps = function()
5 frame_rate = 0.9 * frame_rate + (1.0 - 0.9) * globals.AbsoluteFrameTime()
6 return math.floor((1.0 / frame_rate) + 0.5)
7end
8local function setMath(int, max, declspec)
9 local int = (int > max and max or int)
10
11 local tmp = max / int;
12 local i = (declspec / tmp)
13 i = (i >= 0 and math.floor(i + 0.5) or math.ceil(i - 0.5))
14
15 return i
16end
17function gradient(x1, y1, x2, y2, left)
18 local w = x2 - x1
19 local h = y2 - y1
20
21 for i = 0, w do
22 local a = (i / w) * 200
23
24 draw.Color(0, 0, 0, a)
25 if left then
26 draw.FilledRect(x1 + i, y1, x1 + i + 1, y1 + h)
27 else
28 draw.FilledRect(x1 + w - i, y1, x1 + w - i + 1, y1 + h)
29 end
30 end
31end
32local function getColor(number, max)
33 local r, g, b
34 i = setMath(number, max, 9)
35
36 if i <= 1 then r, g, b = 255, 0, 0
37 elseif i == 2 then r, g, b = 237, 27, 3
38 elseif i == 3 then r, g, b = 235, 63, 6
39 elseif i == 4 then r, g, b = 229, 104, 8
40 elseif i == 5 then r, g, b = 228, 126, 10
41 elseif i == 6 then r, g, b = 220, 169, 16
42 elseif i == 7 then r, g, b = 213, 201, 19
43 elseif i == 8 then r, g, b = 176, 205, 10
44 elseif i == 9 then r, g, b = 124, 195, 13
45 end
46
47 return r, g, b
48end
49local function getColor2(number, max)
50 local r, g, b
51 i = setMath(number, max, 9)
52
53 if i <= 1 then r, g, b = 124, 195, 13
54 elseif i == 9 then r, g, b = 124, 195, 13
55 elseif i == 8 then r, g, b = 176, 205, 10
56 elseif i == 7 then r, g, b = 213, 201, 19
57 elseif i == 6 then r, g, b = 220, 169, 16
58 elseif i == 6 then r, g, b = 228, 126, 10
59 elseif i == 4 then r, g, b = 229, 104, 8
60 elseif i == 3 then r, g, b = 235, 63, 6
61 elseif i == 2 then r, g, b = 237, 27, 3
62 end
63
64 return r, g, b
65end
66local speed =0
67
68local fps_ref = gui.Reference("MISC", "ENHANCEMENT", "Appearance")
69local fpscheckbox = gui.Checkbox(fps_ref, "msc_fps_warning", "FPS Warning", 0)
70
71local pitch, yaw, roll;
72function angles_util( UCMD )
73 pitch, yaw, roll = UCMD:GetViewAngles();
74end
75callbacks.Register( 'CreateMove', 'angles_util', angles_util );
76
77function draw_fake()
78if engine.GetServerIP() ~= nil and entities.GetLocalPlayer():IsAlive() then
79local fpsvalue = gui.GetValue("msc_fps_warning");
80
81local Entity = entities.GetLocalPlayer();
82
83InAir = Entity:GetProp("m_fFlags")
84
85local VelocityX, VelocityY = Entity:GetPropFloat( "localdata", "m_vecVelocity[0]" ), Entity:GetPropFloat( "localdata", "m_vecVelocity[1]" )
86local InitialVelocity = math.sqrt( VelocityX^2 + VelocityY^2 );
87local FinalVelocity = math.min( 9999, InitialVelocity ) + 0.2;
88if Entity:IsAlive() then
89 Velocity = math.floor( FinalVelocity )
90else
91 Velocity = 0
92end
93
94local font0 = draw.CreateFont('Verdana', 25, 700)
95local ducking = gui.GetValue("rbot_antiaim_fakeduck")
96draw.SetFont(font0)
97
98if get_abs_fps() <=60 and fpsvalue == true then
99local r, g, b = getColor(get_abs_fps(), 100)
100draw.Color(r, g, b, 255)
101if input.IsButtonDown(ducking) then
102if InAir < 257 then
103if Velocity > 250 or InAir < 257 then
104 draw.Text( 10, 1005, "FPS" )
105else
106 draw.Text( 10, 1030, "FPS" )
107end
108else
109 draw.Text( 10, 1005, "FPS" )
110end
111end
112
113if input.IsButtonDown(ducking) == false then
114if InAir < 257 or Velocity > 250 then
115 draw.Text( 10, 1005, "FPS" )
116else
117 draw.Text( 10, 1030, "FPS" )
118end
119end
120end
121
122if gui.GetValue("rbot_active") == true and gui.GetValue("rbot_antiaim_enable") == true then
123if engine.GetServerIP() ~= nil and Entity:IsAlive() then
124if InAir < 257 or Velocity > 250 then
125if gui.GetValue("msc_fakelag_enable") == true and Velocity >= 300 and input.IsButtonDown(ducking) == false then
126 draw.Color( 168,222,0,255 )
127 draw.Text( 10, 1030, "LC" )
128else
129if input.IsButtonDown(ducking) == false or InAir < 257 or Velocity > 250 then
130if gui.GetValue("msc_fakelag_mode") == 2 then
131 draw.Color( 168,222,0,255 )
132 draw.Text( 10, 1030, "LC" )
133else
134 draw.Color( 228,24,0,255 )
135 draw.Text( 10, 1030, "LC" )
136end
137end
138end
139end
140end
141else
142if engine.GetServerIP() ~= nil and Entity:IsAlive() and gui.GetValue("msc_fakelag_enable") == true then
143if InAir < 257 or Velocity > 250 then
144if gui.GetValue("msc_fakelag_enable") == true and Velocity >= 300 and input.IsButtonDown(ducking) == false then
145 draw.Color( 168,222,0,255 )
146 draw.Text( 10, 1030, "LC" )
147else
148if input.IsButtonDown(ducking) == false or InAir < 257 or Velocity > 250 then
149if gui.GetValue("msc_fakelag_mode") == 2 then
150 draw.Color( 168,222,0,255 )
151 draw.Text( 10, 1030, "LC" )
152else
153 draw.Color( 228,24,0,255 )
154 draw.Text( 10, 1030, "LC" )
155end
156end
157end
158end
159end
160end
161
162if gui.GetValue("rbot_active") == true and gui.GetValue("rbot_antiaim_enable") == true and engine.GetServerIP() ~= nil and Entity:IsAlive() then
163
164 local local_player = entities.GetLocalPlayer();
165 local lowerbody = local_player:GetProp('m_flLowerBodyYawTarget');
166
167
168if gui.GetValue("rbot_antiaim_stand_desync") == 0 then
169 r,g,b = 228,24,0
170else
171
172 if (math.abs(yaw - lowerbody) <= 1 ) then
173 r,g,b = 228,24,0
174end
175 if (math.abs(yaw - lowerbody) >= 10 ) then
176 r,g,b = 222,60,0
177end
178 if (math.abs(yaw - lowerbody) >= 20 ) then
179 r,g,b = 222,93,0
180end
181 if (math.abs(yaw - lowerbody) >= 30 ) then
182 r,g,b = 215,110,0
183end
184 if (math.abs(yaw - lowerbody) >= 40 ) then
185 r,g,b = 210,140,0
186end
187 if (math.abs(yaw - lowerbody) >= 50 ) then
188 r,g,b = 201,160,0
189end
190 if (math.abs(yaw - lowerbody) >= 60 ) then
191 r,g,b = 208,205,0
192end
193 if (math.abs(yaw - lowerbody) >= 70 ) then
194 r,g,b = 211, 222, 0
195end
196 if (math.abs(yaw - lowerbody) >= 80 ) then
197 r,g,b = 168,222,0
198end
199end
200
201if Velocity > 0 and Velocity <=70 then
202if gui.GetValue("rbot_antiaim_move_desync") == 0 then
203 r,g,b = 228,24,0
204else
205 r,g,b = 211, 222, 0
206end
207end
208
209if Velocity > 70 and Velocity <=250 then
210if gui.GetValue("rbot_antiaim_move_desync") == 0 then
211 r,g,b = 228,24,0
212else
213 r,g,b = 208,205,0
214end
215end
216
217if input.IsButtonDown(1) or input.IsButtonDown(69) then
218 r,g,b = 228,24,0
219end
220
221 draw.Color( r, g, b, 255 )
222
223if get_abs_fps() <=60 and fpsvalue == true then
224if input.IsButtonDown(ducking) then
225if InAir < 257 then
226if Velocity > 250 or InAir < 257 then
227 draw.Text( 10, 980, "FAKE" )
228else
229 draw.Text( 10, 1005, "FAKE" )
230end
231else
232 draw.Text( 10, 980, "FAKE" )
233end
234end
235
236if input.IsButtonDown(ducking) == false then
237if InAir < 257 or Velocity > 250 then
238 draw.Text( 10, 980, "FAKE" )
239else
240 draw.Text( 10, 1005, "FAKE" )
241end
242end
243else
244
245if input.IsButtonDown(ducking) then
246if InAir < 257 then
247if Velocity > 250 or InAir < 257 then
248 draw.Text( 10, 1005, "FAKE" )
249else
250 draw.Text( 10, 1030, "FAKE" )
251end
252else
253 draw.Text( 10, 1005, "FAKE" )
254end
255end
256
257if input.IsButtonDown(ducking) == false then
258if InAir < 257 or Velocity > 250 then
259 draw.Text( 10, 1005, "FAKE" )
260else
261 draw.Text( 10, 1030, "FAKE" )
262end
263end
264
265end
266
267if input.IsButtonDown(ducking) then
268if InAir < 257 or Velocity > 250 then
269return
270end
271draw.Color( 255, 255, 255, 255 )
272draw.Text( 10, 1030, "DUCK" )
273end
274end
275
276end
277
278end
279
280callbacks.Register('Draw', 'draw_fake', draw_fake)
281
282
283local aspect_ratio_table = {};
284local aspect_misc = gui.Reference('SETTINGS', "Miscellaneous");
285local aspect_ratio_check = gui.Checkbox(aspect_misc, "aspect_ratio_check", "Aspect Ratio Changer", false);
286local aspect_ratio_reference = gui.Slider(aspect_misc, "aspect_ratio_reference", "Force aspect ratio", 100, 1, 199)
287local function gcd(m, n) while m ~= 0 do m, n = math.fmod(n, m), m; end return n end
288
289local function set_aspect_ratio(aspect_ratio_multiplier)
290local screen_width, screen_height = draw.GetScreenSize(); local aspectratio_value = (screen_width*aspect_ratio_multiplier)/screen_height;
291 if aspect_ratio_multiplier == 1 or not aspect_ratio_check:GetValue() then aspectratio_value = 0; end
292 client.SetConVar( "r_aspectratio", tonumber(aspectratio_value), true); end
293
294local function on_aspect_ratio_changed()
295 local screen_width, screen_height = draw.GetScreenSize();
296 for i=1, 200 do local i2=i*0.01; i2 = 2 - i2; local divisor = gcd(screen_width*i2, screen_height); if screen_width*i2/divisor < 100 or i2 == 1 then aspect_ratio_table[i] = screen_width*i2/divisor .. ":" .. screen_height/divisor; end end
297local aspect_ratio = aspect_ratio_reference:GetValue()*0.01; aspect_ratio = 2 - aspect_ratio; set_aspect_ratio(aspect_ratio); end
298callbacks.Register('Draw', "does shit" ,on_aspect_ratio_changed)
299
300
301--slowwalk fix (wip)--------
302local gui_set = gui.SetValue
303local gui_get = gui.GetValue
304local c_reg = callbacks.Register
305local b_toggle = input.IsButtonDown
306
307--local autodir = gui_get("rbot_antiaim_autodir")
308--local targets = gui_get("rbot_antiaim_at_targets")
309
310local auto = gui_get("rbot_autosniper_autostop")
311local awp = gui_get("rbot_sniper_autostop")
312local ssg = gui_get("rbot_scout_autostop")
313local rev = gui_get("rbot_revolver_autostop")
314local pist = gui_get("rbot_pistol_autostop")
315local smg = gui_get("rbot_smg_autostop")
316local rifle = gui_get("rbot_rifle_autostop")
317local shotg = gui_get("rbot_shotgun_autostop")
318local lmg = gui_get("rbot_lmg_autostop")
319local shared = gui_get("rbot_shared_autostop")
320
321local key = "shift" ---key
322
323function Freestand()
324
325
326 if b_toggle(key) then
327 local classicf = draw.CreateFont("Verdana", 28, 700)
328draw.SetFont(classicf)
329draw.Color(126, 183, 50,255);
330--draw.Text(5, 939, "SW")
331 --gui_set("rbot_antiaim_autodir", 0)
332 --gui_get("rbot_antiaim_at_targets", 0)
333
334 gui_set("rbot_autosniper_autostop", 0)
335 gui_set("rbot_lmg_autostop", 0)
336 gui_set("rbot_pistol_autostop", 0)
337 gui_set("rbot_revolver_autostop", 0)
338 gui_set("rbot_rifle_autostop", 0)
339 gui_set("rbot_scout_autostop", 0)
340 gui_set("rbot_shared_autostop", 0)
341 gui_set("rbot_shotgun_autostop", 0)
342 gui_set("rbot_smg_autostop", 0)
343 gui_set("rbot_sniper_autostop", 0)
344
345
346
347
348 else
349
350 local classicf = draw.CreateFont("Verdana", 28, 700)
351draw.SetFont(classicf)
352draw.Color(255, 0, 0,255);
353--draw.Text(5, 939, "SW")
354
355 --gui_set("rbot_antiaim_autodir", 2)
356 --gui_get("rbot_antiaim_at_targets", 2)
357
358 gui_set("rbot_autosniper_autostop", auto)
359 gui_set("rbot_lmg_autostop", lmg)
360 gui_set("rbot_pistol_autostop", pist)
361 gui_set("rbot_revolver_autostop", rev)
362 gui_set("rbot_rifle_autostop", rifle)
363 gui_set("rbot_scout_autostop", ssg)
364 gui_set("rbot_shared_autostop", shared)
365 gui_set("rbot_shotgun_autostop", shotg)
366 gui_set("rbot_smg_autostop", smg)
367 gui_set("rbot_sniper_autostop", awp)
368
369
370 end
371end
372
373
374c_reg("Draw", "Freestand when slowwalk", Freestand)
375
376
377local font_icon = draw.CreateFont("Webdings", 30, 30)
378local font_warning = draw.CreateFont("Verdana", 15, 15)
379
380-- Script --------
381------------------
382
383-- UI Elements --
384local ref_msc_auto_other = gui.Reference("MISC", "AUTOMATION", "Other")
385
386local key_blockbot = gui.Keybox(ref_msc_auto_other, "msc_blockbot", "Blockbot On Key", 0)
387local cob_blockbot_mode = gui.Combobox(ref_msc_auto_other, "msc_blockbot_mode", "Blockbot Mode", "Match Speed", "Maximum Speed")
388local chb_blockbot_retreat = gui.Checkbox(ref_msc_auto_other, "chb_blockbot_retreat", "Blockbot Retreat on BunnyHop", 0)
389-----------------
390
391
392-- Shared Variables
393local Target = nil
394local CrouchBlock = false
395local LocalPlayer = nil
396
397local function OnFrameMain()
398
399 LocalPlayer = entities.GetLocalPlayer()
400
401 if LocalPlayer == nil or engine.GetServerIP() == nil then
402 return
403 end
404
405 if (key_blockbot:GetValue() == nil or key_blockbot:GetValue() == 0) or not LocalPlayer:IsAlive() then
406 return
407 end
408
409 if input.IsButtonDown(key_blockbot:GetValue()) and Target == nil then
410
411 for Index, Entity in pairs(entities.FindByClass("CCSPlayer")) do
412 if Entity:GetIndex() ~= LocalPlayer:GetIndex() and Entity:IsAlive() then
413 if Target == nil then
414 Target = Entity;
415 elseif vector.Distance({LocalPlayer:GetAbsOrigin()}, {Target:GetAbsOrigin()}) > vector.Distance({LocalPlayer:GetAbsOrigin()}, {Entity:GetAbsOrigin()}) then
416 Target = Entity;
417 end
418 end
419 end
420
421 elseif not input.IsButtonDown(key_blockbot:GetValue()) or not Target:IsAlive() then
422 Target = nil
423 end
424
425 if Target ~= nil then
426 local NearPlayer_toScreen = {client.WorldToScreen(Target:GetBonePosition(5))}
427
428 if select(3, Target:GetHitboxPosition(0)) < select(3, LocalPlayer:GetAbsOrigin()) and vector.Distance({LocalPlayer:GetAbsOrigin()}, {Target:GetAbsOrigin()}) < 100 then
429 CrouchBlock = true
430 draw.Color(255, 255, 0, 255)
431 else
432 CrouchBlock = false
433 draw.Color(255, 0, 0, 255)
434 end
435
436 draw.SetFont(font_icon)
437
438 if NearPlayer_toScreen[1] ~= nil and NearPlayer_toScreen[2] ~= nil then
439 draw.TextShadow(NearPlayer_toScreen[1] - select(1, draw.GetTextSize("x")) / 2, NearPlayer_toScreen[2], "x")
440 end
441
442 end
443
444end
445
446local function OnCreateMoveMain(UserCmd)
447
448 if Target ~= nil then
449 local LocalAngles = {UserCmd:GetViewAngles()}
450 local VecForward = {vector.Subtract( {Target:GetAbsOrigin()}, {LocalPlayer:GetAbsOrigin()} )}
451 local AimAngles = {vector.Angles( VecForward )}
452 local TargetSpeed = vector.Length(Target:GetPropFloat("localdata", "m_vecVelocity[0]"), Target:GetPropFloat("localdata", "m_vecVelocity[1]"), Target:GetPropFloat("localdata", "m_vecVelocity[2]"))
453
454 if CrouchBlock then
455 if cob_blockbot_mode:GetValue() == 0 then
456 UserCmd:SetForwardMove( ( (math.sin(math.rad(LocalAngles[2]) ) * VecForward[2]) + (math.cos(math.rad(LocalAngles[2]) ) * VecForward[1]) ) * 10 )
457 UserCmd:SetSideMove( ( (math.cos(math.rad(LocalAngles[2]) ) * -VecForward[2]) + (math.sin(math.rad(LocalAngles[2]) ) * VecForward[1]) ) * 10 )
458 elseif cob_blockbot_mode:GetValue() == 1 then
459 UserCmd:SetForwardMove( ( (math.sin(math.rad(LocalAngles[2]) ) * VecForward[2]) + (math.cos(math.rad(LocalAngles[2]) ) * VecForward[1]) ) * 200 )
460 UserCmd:SetSideMove( ( (math.cos(math.rad(LocalAngles[2]) ) * -VecForward[2]) + (math.sin(math.rad(LocalAngles[2]) ) * VecForward[1]) ) * 200 )
461 end
462 else
463 local DiffYaw = AimAngles[2] - LocalAngles[2]
464
465 if DiffYaw > 180 then
466 DiffYaw = DiffYaw - 360
467 elseif DiffYaw < -180 then
468 DiffYaw = DiffYaw + 360
469 end
470
471 if TargetSpeed > 285 and chb_blockbot_retreat:GetValue() then
472 UserCmd:SetForwardMove(-math.abs(TargetSpeed))
473 end
474
475 if cob_blockbot_mode:GetValue() == 0 then
476 if math.abs(DiffYaw) > 0.75 then
477 UserCmd:SetSideMove(450 * -DiffYaw)
478 end
479 elseif cob_blockbot_mode:GetValue() == 1 then
480 if DiffYaw > 0.25 then
481 UserCmd:SetSideMove(-450)
482 elseif DiffYaw < -0.25 then
483 UserCmd:SetSideMove(450)
484 end
485 end
486
487 end
488
489 end
490
491end
492
493callbacks.Register("Draw", OnFrameMain)
494callbacks.Register("CreateMove", OnCreateMoveMain)
495
496----speclist-----
497
498local specshit = gui.Reference( "MISC", "GENERAL", "Extra");
499local BetterSpecBox = gui.Checkbox( specshit, "lua_betterspec", "Simple speclist", 0 );
500
501function betterspec()
502local specfont = draw.CreateFont('Verdana', 13)
503local sorting = 0
504local specpos1, specpos2 = gui.GetValue("wnd_showspec");
505if BetterSpecBox:GetValue() then
506gui.SetValue("msc_showspec", 0);
507local lp = entities.GetLocalPlayer();
508if lp ~= nil then
509local players = entities.FindByClass("CCSPlayer");
510for i = 1, #players do
511local player = players[i];
512if player ~= lp and player:GetHealth() <= 0 then
513local name = player:GetName();
514if player:GetPropEntity("m_hObserverTarget") ~= nil then
515local playerindex = player:GetIndex()
516if name ~= "GOTV" and playerindex ~= 1 then
517local target = player:GetPropEntity("m_hObserverTarget");
518if target:IsPlayer() then
519local targetindex = target:GetIndex();
520local myindex = client.GetLocalPlayerIndex();
521if lp:IsAlive() then
522if targetindex == myindex then
523draw.SetFont(specfont);
524draw.Color(255,255,255,255);
525draw.Text( specpos1, specpos2 + (sorting * 16), name );
526draw.TextShadow( specpos1, specpos2 + (sorting * 16), name );
527sorting = sorting + 1;
528end
529end
530end
531end
532end
533end
534end
535end
536end
537end
538callbacks.Register ("Draw", "betterspec", betterspec)
539
540----2d hitmarker--
541
542alpha = 0
543
544
545function hitmarker()
546local screencenterX, screencenterY = draw.GetScreenSize() --getting the full screensize
547screencenterX = screencenterX / 2; screencenterY = screencenterY / 2 --dividing the screensize by 2 will place it perfectly in the center no matter what resolution
548draw.Color( 255, 255, 255, alpha)
549
550draw.Line(screencenterX - 13, screencenterY + 13, screencenterX, screencenterY)
551draw.Line(screencenterX - 13, screencenterY - 13, screencenterX, screencenterY)
552draw.Line(screencenterX + 13, screencenterY + 13, screencenterX, screencenterY)
553draw.Line(screencenterX + 13, screencenterY - 13, screencenterX, screencenterY)
554if(alpha > 0) then
555 alpha = alpha - 2.5
556 end
557end
558
559
560function enemyhit(event)
561 if(event:GetName() == "player_hurt") then --if the game event "player_hurt" gets called then
562 local attacker = event:GetInt("attacker") --getting the attacker
563 local attackerindex = client.GetPlayerIndexByUserID(attacker) --retrieves the attackers entity index by using the GetPlayerIndexByUserID function aimwares api provides us
564 if(attackerindex == client.GetLocalPlayerIndex()) then --if the attackers index for the player who got hurt matches the localplayer index, it means we're the attacker
565 alpha = 255
566 end
567 end
568end
569
570callbacks.Register( "FireGameEvent", "enemyhitfunction", enemyhit)
571callbacks.Register( "Draw", "hitmarker", hitmarker)
572
573---disable post procce\--
574
575local Register = callbacks.Register
576
577local Convar = client.SetConVar
578
579function PostProcess()
580
581 Convar("mat_postprocess_enable", 0, true)
582
583end
584
585Register("Draw", "PostProcess", PostProcess)
586
587----extra fakelag----
588
589local SetValue = gui.SetValue;
590local GetValue = gui.GetValue;
591
592local Version = "6.5"
593
594local MSC_FAKELAG_REF = gui.Reference( "MISC", "ENHANCEMENT", "Fakelag" );
595
596local FAKELAG_SMART_MODE_TEXT = gui.Text( MSC_FAKELAG_REF, "Fakelag Smart Mode" )
597local FAKELAG_SMART_MODE = gui.Checkbox( MSC_FAKELAG_REF, "lua_fakelag_smartmode_enable", "Enable", 0 );
598local FAKELAG_SMART_MODE_STANDING = gui.Combobox( MSC_FAKELAG_REF, "lua_fakelag_standing", "While Standing", "Off", "Factor", "Switch", "Adaptive", "Random", "Peek", "Rapid Peek" );
599local FAKELAG_SMART_MODE_STANDING_FACTOR = gui.Slider( MSC_FAKELAG_REF, "lua_fakelag_standing_factor", "Factor", 15, 1, 62 );
600local FAKELAG_SMART_MODE_MOVING = gui.Combobox( MSC_FAKELAG_REF, "lua_fakelag_moving", "While Moving", "Off", "Factor", "Switch", "Adaptive", "Random", "Peek", "Rapid Peek" );
601local FAKELAG_SMART_MODE_MOVING_FACTOR = gui.Slider( MSC_FAKELAG_REF, "lua_fakelag_moving_factor", "Factor", 15, 1, 62 );
602local FAKELAG_SMART_MODE_INAIR = gui.Combobox( MSC_FAKELAG_REF, "lua_fakelag_inair", "While In Air", "Off", "Factor", "Switch", "Adaptive", "Random", "Peek", "Rapid Peek" );
603local FAKELAG_SMART_MODE_INAIR_FACTOR = gui.Slider( MSC_FAKELAG_REF, "lua_fakelag_inair_factor", "Factor", 15, 1, 62 );
604
605local FAKELAG_EXTRA_TEXT = gui.Text( MSC_FAKELAG_REF, "Fakelag Extra" );
606local FAKELAG_EXTRA = gui.Checkbox( MSC_FAKELAG_REF, "lua_fakelag_extra_enable", "Enable", 0 );
607local FAKELAG_ON_MULTIBOX = gui.Multibox( MSC_FAKELAG_REF, "Disable on" );
608local FAKELAG_ON_SLOWWALK = gui.Checkbox( FAKELAG_ON_MULTIBOX, "lua_fakelag_slowwalk", "Slow Walk", 0 );
609local FAKELAG_ON_KNIFE = gui.Checkbox( FAKELAG_ON_MULTIBOX, "lua_fakelag_knife", "Knife", 0 );
610local FAKELAG_ON_TASER = gui.Checkbox( FAKELAG_ON_MULTIBOX, "lua_fakelag_taser", "Taser", 0 );
611local FAKELAG_ON_GRENADE = gui.Checkbox( FAKELAG_ON_MULTIBOX, "lua_fakelag_grenade", "Grenade", 0 );
612local FAKELAG_ON_PISTOL = gui.Checkbox( FAKELAG_ON_MULTIBOX, "lua_fakelag_pistol", "Pistol", 0 );
613local FAKELAG_ON_REVOLVER = gui.Checkbox( FAKELAG_ON_MULTIBOX, "lua_fakelag_revolver", "Revolver", 0 );
614local FAKELAG_ON_PING = gui.Checkbox( FAKELAG_ON_MULTIBOX, "lua_fakelag_ping", "On Ping", 0 )
615local FAKELAG_ON_PING_AMOUNT = gui.Slider( MSC_FAKELAG_REF, "lua_fakelag_ping_amount", "On Ping Amount", 120, 0, 1000 )
616
617local Ping = 0
618local Time = 0
619
620callbacks.Register( 'Draw', function()
621
622if entities.GetLocalPlayer() == nil then
623return
624end
625
626local LocalPlayerEntity = entities.GetLocalPlayer();
627local WeaponID = LocalPlayerEntity:GetWeaponID();
628local WeaponType = LocalPlayerEntity:GetWeaponType();
629
630if ( WeaponType == 0 and WeaponID ~= 31 ) then Knife = true else Knife = false end
631if ( WeaponType == 1 and WeaponID ~= 64 ) then Pistol = true else Pistol = false end
632if WeaponID == 31 then Taser = true else Taser = false end
633if WeaponType == 9 then Grenade = true else Grenade = false end
634if WeaponID == 64 then Revolver = true else Revolver = false end
635
636end
637)
638
639local function FakelagExtra()
640
641if FAKELAG_EXTRA:GetValue() then
642
643if ( FAKELAG_ON_KNIFE:GetValue() and Knife ) or -- On Knife
644 ( FAKELAG_ON_TASER:GetValue() and Taser ) or -- On Taser
645 ( FAKELAG_ON_GRENADE:GetValue() and Grenade ) or -- On Grenade
646 ( FAKELAG_ON_PISTOL:GetValue() and Pistol ) or -- On Pistol
647 ( FAKELAG_ON_REVOLVER:GetValue() and Revolver ) then -- On Revolver
648SetValue( "msc_fakelag_enable", 0 );
649else
650SetValue( "msc_fakelag_enable", 1 );
651end
652
653end
654
655end
656
657local function FakelagOnPing()
658
659if FAKELAG_EXTRA:GetValue() then
660if FAKELAG_ON_PING:GetValue() then
661
662if entities.GetPlayerResources() ~= nil then
663Ping = entities.GetPlayerResources():GetPropInt( "m_iPing", client.GetLocalPlayerIndex() );
664end
665FakelagOnPingAmount = math.floor( FAKELAG_ON_PING_AMOUNT:GetValue() )
666
667if ( Ping >= FakelagOnPingAmount ) or
668 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_KNIFE:GetValue() and Knife ) or
669 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_TASER:GetValue() and Taser ) or
670 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_GRENADE:GetValue() and Grenade ) or
671 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_PISTOL:GetValue() and Pistol ) or
672 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_REVOLVER:GetValue() and Revolver ) then
673SetValue( "msc_fakelag_enable", 0 );
674else
675SetValue( "msc_fakelag_enable", 1 );
676end
677
678end
679end
680
681end
682
683local function FakelagOnSlowWalk()
684
685if FAKELAG_EXTRA:GetValue() then
686
687if GetValue( "msc_slowwalk" ) ~= 0 then
688SlowWalkFakelagOff = input.IsButtonDown( GetValue( "msc_slowwalk" ) )
689end
690
691if FAKELAG_ON_SLOWWALK:GetValue() and GetValue( "msc_slowwalk" ) ~= 0 then
692if ( SlowWalkFakelagOff ) or
693 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_KNIFE:GetValue() and Knife ) or
694 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_TASER:GetValue() and Taser ) or
695 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_GRENADE:GetValue() and Grenade ) or
696 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_PISTOL:GetValue() and Pistol ) or
697 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_REVOLVER:GetValue() and Revolver ) or
698 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_PING:GetValue() and Ping >= FakelagOnPingAmount ) then
699SetValue( "msc_fakelag_enable", 0 );
700else
701SetValue( "msc_fakelag_enable", 1 );
702end
703end
704
705end
706
707end
708
709local function FakelagSmartMode()
710
711if FAKELAG_SMART_MODE:GetValue() then
712
713local FAKELAG_STANDING = FAKELAG_SMART_MODE_STANDING:GetValue();
714local FAKELAG_MOVING = FAKELAG_SMART_MODE_MOVING:GetValue();
715local FAKELAG_INAIR = FAKELAG_SMART_MODE_INAIR:GetValue();
716
717local FAKELAG_STANDING_FACTOR = math.floor( FAKELAG_SMART_MODE_STANDING_FACTOR:GetValue() )
718local FAKELAG_MOVING_FACTOR = math.floor( FAKELAG_SMART_MODE_MOVING_FACTOR:GetValue() )
719local FAKELAG_INAIR_FACTOR = math.floor( FAKELAG_SMART_MODE_INAIR_FACTOR:GetValue() )
720
721if entities.GetLocalPlayer() ~= nil then
722
723local LocalPlayerEntity = entities.GetLocalPlayer();
724local fFlags = LocalPlayerEntity:GetProp( "m_fFlags" );
725
726local VelocityX = LocalPlayerEntity:GetPropFloat( "localdata", "m_vecVelocity[0]" );
727local VelocityY = LocalPlayerEntity:GetPropFloat( "localdata", "m_vecVelocity[1]" );
728
729local Velocity = math.sqrt( VelocityX^2 + VelocityY^2 );
730
731-- Standing
732if ( Velocity == 0 and ( fFlags == 257 or fFlags == 261 or fFlags == 263 ) ) then
733Standing = true
734else
735Standing = false
736end
737
738-- Moving
739if ( Velocity > 0 and ( fFlags == 257 or fFlags == 261 or fFlags == 263 ) ) then
740Moving = true
741else
742Moving = false
743end
744
745-- In Air
746if fFlags == 256 or fFlags == 262 then
747InAir = true
748Time = globals.CurTime();
749else
750InAir = false
751end
752end
753
754if Standing and Time + 0.2 < globals.CurTime() then
755if ( FAKELAG_STANDING == 0 ) or
756 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_KNIFE:GetValue() and Knife ) or
757 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_TASER:GetValue() and Taser ) or
758 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_GRENADE:GetValue() and Grenade ) or
759 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_PISTOL:GetValue() and Pistol ) or
760 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_REVOLVER:GetValue() and Revolver ) or
761 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_PING:GetValue() and Ping >= FakelagOnPingAmount ) or
762 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_SLOWWALK:GetValue() and GetValue( "msc_slowwalk" ) ~= 0 and SlowWalkFakelagOff ) then
763SetValue( "msc_fakelag_enable", 0 );
764else
765SetValue( "msc_fakelag_enable", 1 );
766end
767if FAKELAG_STANDING > 0 then
768STANDING_MODE = ( FAKELAG_STANDING - 1 )
769end
770SetValue( "msc_fakelag_mode", STANDING_MODE );
771SetValue( "msc_fakelag_value", FAKELAG_STANDING_FACTOR );
772end
773
774if Moving and Time + 0.2 < globals.CurTime() then
775if ( FAKELAG_MOVING == 0 ) or
776 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_KNIFE:GetValue() and Knife ) or
777 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_TASER:GetValue() and Taser ) or
778 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_GRENADE:GetValue() and Grenade ) or
779 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_PISTOL:GetValue() and Pistol ) or
780 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_REVOLVER:GetValue() and Revolver ) or
781 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_PING:GetValue() and Ping >= FakelagOnPingAmount ) or
782 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_SLOWWALK:GetValue() and GetValue( "msc_slowwalk" ) ~= 0 and SlowWalkFakelagOff ) then
783SetValue( "msc_fakelag_enable", 0 );
784else
785SetValue( "msc_fakelag_enable", 1 );
786end
787if FAKELAG_MOVING > 0 then
788MOVING_MODE = ( FAKELAG_MOVING - 1 )
789end
790SetValue( "msc_fakelag_mode", MOVING_MODE );
791SetValue( "msc_fakelag_value", FAKELAG_MOVING_FACTOR );
792end
793
794if InAir then
795if ( FAKELAG_INAIR == 0 ) or
796 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_KNIFE:GetValue() and Knife ) or
797 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_TASER:GetValue() and Taser ) or
798 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_GRENADE:GetValue() and Grenade ) or
799 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_PISTOL:GetValue() and Pistol ) or
800 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_REVOLVER:GetValue() and Revolver ) or
801 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_PING:GetValue() and Ping >= FakelagOnPingAmount ) or
802 ( FAKELAG_EXTRA:GetValue() and FAKELAG_ON_SLOWWALK:GetValue() and GetValue( "msc_slowwalk" ) ~= 0 and SlowWalkFakelagOff ) then
803SetValue( "msc_fakelag_enable", 0 );
804else
805SetValue( "msc_fakelag_enable", 1 );
806end
807if FAKELAG_INAIR > 0 then
808INAIR_MODE = ( FAKELAG_INAIR - 1 )
809end
810SetValue( "msc_fakelag_mode", INAIR_MODE );
811SetValue( "msc_fakelag_value", FAKELAG_INAIR_FACTOR );
812end
813
814end
815
816end
817
818callbacks.Register( 'Draw', FakelagExtra )
819callbacks.Register( 'Draw', FakelagOnPing )
820callbacks.Register( 'Draw', FakelagOnSlowWalk )
821callbacks.Register( 'Draw', FakelagSmartMode )
822
823--------Grenade timers------------
824
825local updatetick = 0;
826local grenades = {};
827
828function EventHook(Event)
829-- Clean table on round start
830if Event:GetName() == "round_start" then
831grenades = {};
832end
833-- Remove expired grenades from Table
834if Event:GetName() == "hegrenade_detonate" or Event:GetName() == "flashbang_detonate"
835or Event:GetName() == "inferno_expire" or Event:GetName() == "inferno_extinguish" then
836updatetick = globals.TickCount();
837for index,value in pairs(grenades) do
838if value[1] == Event:GetInt("entityid") then
839table.remove(grenades, index);
840end
841end
842end
843
844end
845
846function ESPHook(Builder)
847-- Smoke Grenades
848if Builder:GetEntity():GetClass() == "CSmokeGrenadeProjectile"
849and Builder:GetEntity():GetProp("m_nSmokeEffectTickBegin") ~= 0 then
850delta = (globals.TickCount() - Builder:GetEntity():GetProp("m_nSmokeEffectTickBegin")) * globals.TickInterval();
851Builder:AddBarBottom( 1 - (delta/17.5) )
852-- Flash and HE Grenades
853elseif Builder:GetEntity():GetClass() == "CBaseCSGrenadeProjectile" then
854local found = false;
855for index,value in pairs(grenades) do
856if value[1] == Builder:GetEntity():GetIndex() then
857DeltaT = (globals.TickCount() - grenades[index][2]) * globals.TickInterval();
858Builder:AddBarBottom( 1 - (DeltaT/1.65) )
859found = true;
860break;
861end
862end
863if found == false and globals.TickCount() > updatetick then
864local gMatrix = {Builder:GetEntity():GetIndex(), globals.TickCount()};
865table.insert(grenades, gMatrix);
866end
867end
868
869end
870
871function DrawingHook()
872for indexF,valueF in pairs(entities.FindByClass("CInferno")) do
873local found = false;
874for indexT,valueT in pairs(grenades) do
875if valueT[1] == valueF:GetIndex() then
876x, y = client.WorldToScreen( valueF:GetAbsOrigin() )
877local mollysize = 25;
878if x ~= nil and y ~= nil then
879draw.Color(0, 0, 0, 255);
880draw.RoundedRectFill( x - mollysize, y, x + mollysize, y + 4 );
881draw.Color(227, 227, 227, 255);
882local math = (((globals.TickCount() - valueT[2]) * ((-1) - 1))
883/ ( (valueT[2] + 7 / globals.TickInterval()) - valueT[2])) + 1
884draw.RoundedRectFill( x - mollysize, y, x + mollysize * math, y + 4 )
885draw.Color(255, 255, 255, 255);
886draw.RoundedRect( x - mollysize, y, x + mollysize, y + 4)
887local w,h = draw.GetTextSize( "MOLLY" )
888draw.Text(x - w/2, y - h * 1.25 , "MOLLY");
889draw.TextShadow(x - w/2, y - h * 1.25 , "MOLLY");
890end
891found = true;
892break;
893end
894end
895
896if found == false and globals.TickCount() > updatetick then
897local gMatrix = {valueF:GetIndex(), globals.TickCount()};
898table.insert(grenades, gMatrix);
899end
900end
901end
902
903-- Grenade timers by Nyanpasu! (- Luiz)
904
905client.AllowListener("round_start");
906client.AllowListener("inferno_expire");
907client.AllowListener("inferno_extinguish");
908client.AllowListener("molotov_detonate");
909client.AllowListener("hegrenade_detonate");
910client.AllowListener("flashbang_detonate");
911
912callbacks.Register("FireGameEvent", "EventHookG", EventHook);
913callbacks.Register( "Draw", "DrawingHookG", DrawingHook );
914callbacks.Register( "DrawESP", "ESPHookG", ESPHook );
915
916--misc group box
917
918local vis_main = gui.Reference('MISC', "GENERAL", "Main")
919local box = gui.Groupbox( vis_main, "Extra Stuff", 0, 200, 213, 170 );
920local SniperCrosshairCheckbox = gui.Checkbox( box, "lua_snipercrosshair", "Force Crosshair", 0 );
921local ShowImpactsCheckbox = gui.Checkbox( box, "lua_showimpacts", "Show Impacts", 0 );
922local FullbrightCheckbox = gui.Checkbox( box, "lua_fullbright", "Full Brightness", 0 );
923local showlagcompensationCheckbox = gui.Checkbox( box, "showlagcompensation", "showlagcompensation", 0 );
924local CustomHitsounds_Combo = gui.Combobox(box, 'Custom_Hitsounds',"Custom Hitsound", "Off", "Metallic", "Paintcan Impact")
925
926-- Fullbright
927
928local function Fullbright()
929
930 if FullbrightCheckbox:GetValue() then
931 client.SetConVar( "mat_fullbright", 1, true )
932 else
933 client.SetConVar( "mat_fullbright", 0, true )
934 end
935
936end
937
938callbacks.Register( "Draw", "FullBrightness", Fullbright )
939
940--showlagcompensation--
941
942local function showlagcompensation()
943
944 if showlagcompensationCheckbox:GetValue() then
945 client.SetConVar( "sv_showlagcompensation", 1, true )
946 else
947 client.SetConVar( "sv_showlagcompensation", 0, true )
948 end
949
950end
951
952callbacks.Register( "Draw", "showlagcompensation", showlagcompensation )
953
954--[[custom skybox changer
955
956local msc_ref = gui.Reference( "MISC", "GENERAL", "MAIN" );
957local msc_lua_checkbox = gui.Checkbox( msc_ref, "msc_lua_checkbox", "Custom Hitsound", false );
958local msc_lua_editbox = gui.Editbox( msc_ref, "lua_editbox", "" );
959
960function Sounds(Event, Entity)
961 if ( Event:GetName() == 'player_hurt' ) then
962 local local_player = client.GetLocalPlayerIndex();
963 local attacker_uid = Event:GetInt('attacker');
964 local attacker_index = client.GetPlayerIndexByUserID(attacker_uid)
965
966 if ( attacker_index == local_player and msc_lua_checkbox:GetValue() ) then
967 local hitcmd = "play " .. msc_lua_editbox:GetValue();
968 client.Command(hitcmd, true);
969 end
970 end
971end
972
973client.AllowListener('player_hurt');
974
975callbacks.Register('FireGameEvent', 'Hitsound', Sounds);]]--
976
977
978--Galaxy Skybox----
979function SkyBox()
980 if (client.GetConVar("sv_skyname") ~= "sky_descent" and gui.GetValue("msc_restrict") ~= 1) then
981 client.SetConVar("sv_skyname", "sky_descent")
982 end
983end
984
985callbacks.Register("Draw", "SkyBox", SkyBox)
986
987--Force Crosshair
988
989local function SniperCrosshair()
990
991 if SniperCrosshairCheckbox:GetValue() then
992 if entities.GetLocalPlayer() ~= nil then
993 local LocalPlayerEntity = entities.GetLocalPlayer();
994 local isScoped = LocalPlayerEntity:GetPropInt( "m_bIsScoped" );
995
996 local Thirdperson = gui.GetValue( "vis_thirdperson_dist" );
997 local Scoperemover = gui.GetValue( "vis_scoperemover" );
998
999 if Scoperemover ~= 1 then
1000 if ( isScoped == 1 or Thirdperson > 0 ) then
1001 client.SetConVar( "weapon_debug_spread_show", 0, true );
1002 else
1003 client.SetConVar( "weapon_debug_spread_show", 3, true );
1004 end
1005 elseif Scoperemover == 1 then
1006 if ( Thirdperson > 0 and isScoped == 0 ) then
1007 client.SetConVar( "weapon_debug_spread_show", 0, true );
1008 else
1009 client.SetConVar( "weapon_debug_spread_show", 3, true );
1010 end
1011 end
1012 end
1013 else
1014 client.SetConVar( "weapon_debug_spread_show", 0, true );
1015 end
1016
1017end
1018
1019callbacks.Register( "Draw", "Sniper Crosshair", SniperCrosshair )
1020
1021--Engine Radar----
1022
1023-- Engine Radar by Nyanpasu!
1024
1025local function drawing_callback()
1026 for index, Player in pairs(entities.FindByClass("CCSPlayer")) do
1027 Player:SetProp("m_bSpotted", 1);
1028 end
1029end
1030
1031-- Engine Radar by Nyanpasu!
1032
1033callbacks.Register("Draw", "engine_radar_draw", drawing_callback);
1034
1035-- show impacts
1036
1037local function showimpacts()
1038 if ShowImpactsCheckbox:GetValue() then
1039 client.SetConVar("sv_showimpacts", 1, true)
1040 else
1041 client.SetConVar("sv_showimpacts", 0, true)
1042 end
1043end
1044callbacks.Register("Draw", "showimpacts", showimpacts)
1045
1046--Custom Hitmarker
1047
1048local function Sounds(Event, Entity)
1049 if ( Event:GetName() == 'player_hurt' ) then
1050 local local_player = client.GetLocalPlayerIndex();
1051 local attacker_uid = Event:GetInt('attacker');
1052 local attacker_index = client.GetPlayerIndexByUserID(attacker_uid)
1053
1054 if ( attacker_index == local_player ) then
1055 if CustomHitsounds_Combo:GetValue() == 2 then
1056 client.Command("play physics\\metal\\paintcan_impact_hard3.wav", true) --clockwork
1057
1058 elseif CustomHitsounds_Combo:GetValue() == 1 then
1059 client.Command("play buttons\\arena_switch_press_02.wav", true) --skeet
1060 end
1061 end
1062 end
1063end
1064
1065client.AllowListener('player_hurt');
1066
1067callbacks.Register('FireGameEvent', 'Hitsound', Sounds);
1068
1069----zeus range---
1070
1071--[[local function distance3d(x1, y1, z1, x2, y2, z2)
1072 return math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1))
1073end
1074
1075
1076
1077local msc_p2 = gui.Reference('MISC', "GENERAL", "Bypass")
1078local GroupBox = gui.Groupbox( msc_p2, "Zeus Range", 0, 260, 213, 170);
1079local ActiveCheckBox = gui.Checkbox(GroupBox, "Active", "Activate", false)
1080local Tyleline = gui.Combobox( GroupBox, 'Type_line',"Type line", "Single line","Multi line")
1081local colortype = gui.Combobox( GroupBox, 'Type_color',"Color", "Single color","Multi color")
1082local function lerp_pos(x1, y1, z1, x2, y2, z2, percentage)
1083 local x = (x2 - x1) * percentage + x1
1084 local y = (y2 - y1) * percentage + y1
1085 local z = (z2 - z1) * percentage + z1
1086 return x, y, z
1087end
1088
1089local function trace_line_skip_teammates( x1, y1, z1, x2, y2, z2, max_traces)
1090
1091 local max_traces = max_traces or 10
1092 local fraction, entindex_hit = 0, -1
1093 local x_hit, y_hit, z_hit = x1, y1, z1
1094
1095 local i=1
1096 while (entindex_hit == -1 ) and 1 > fraction and max_traces >= i do
1097 fraction, entindex_hit = engine.TraceLine( x_hit, y_hit, z_hit, x2, y2, z2,3)
1098
1099 x_hit, y_hit, z_hit = lerp_pos(x_hit, y_hit, z_hit, x2, y2, z2, 1)
1100
1101 i = i + 1
1102 end
1103
1104 local traveled_total = distance3d(x1, y1, z1, x_hit, y_hit, z_hit)
1105 local total_distance = distance3d(x1, y1, z1, x2, y2, z2)
1106
1107 return traveled_total/total_distance, entindex_hit
1108end
1109
1110local function hsv_to_rgb(h, s, v, a)
1111 local r, g, b
1112
1113 local i = math.floor(h * 6);
1114 local f = h * 6 - i;
1115 local p = v * (1 - s);
1116 local q = v * (1 - f * s);
1117 local t = v * (1 - (1 - f) * s);
1118
1119 i = i % 6
1120
1121 if i == 0 then r, g, b = v, t, p
1122 elseif i == 1 then r, g, b = q, v, p
1123 elseif i == 2 then r, g, b = p, v, t
1124 elseif i == 3 then r, g, b = p, q, v
1125 elseif i == 4 then r, g, b = t, p, v
1126 elseif i == 5 then r, g, b = v, p, q
1127 end
1128
1129 return r * 255, g * 255, b * 255, a * 255
1130end
1131
1132
1133
1134
1135local weapon_name_prev = nil
1136local last_switch = 0
1137local accuracy = 2.5
1138
1139local is_taser;
1140local is_knife;
1141local function on_item_equip(Event)
1142
1143 if (Event:GetName() ~= 'item_equip') then
1144 return;
1145 end
1146
1147 local local_player, userid, item, weptype = client.GetLocalPlayerIndex(), Event:GetInt('userid'), Event:GetString('item'), Event:GetInt('weptype');
1148
1149
1150 if (local_player == client.GetPlayerIndexByUserID(userid)) then
1151 if (item == "taser" ) then
1152 is_taser=true;
1153 is_knife=false;
1154 elseif (item=="knife")then
1155 is_knife=true;
1156 is_taser=false;
1157 else
1158 is_knife=false;
1159 is_taser=false;
1160 end
1161 end
1162end
1163
1164
1165client.AllowListener('item_equip');
1166callbacks.Register("FireGameEvent", "on_item_equip", on_item_equip);
1167
1168
1169local function on_paint()
1170
1171if ActiveCheckBox:GetValue() then
1172 local local_player = entities.GetLocalPlayer();
1173 local curtime = globals.CurTime()
1174
1175
1176
1177 local ranges
1178 local ranges_opacities
1179 if is_taser then
1180 ranges = {167}
1181 ranges_opacities = {1}
1182elseif is_knife then
1183 ranges = {32}
1184 ranges_opacities = {1}
1185 end
1186
1187 if ranges == nil then
1188 return
1189 end
1190 local Entity = entities.GetLocalPlayer();
1191 local Alive = Entity:IsAlive();
1192 if (Alive ~=true) then
1193 return
1194
1195 end
1196 local local_x, local_y, local_z = Entity:GetAbsOrigin()
1197 local_z=local_z+45
1198 local vo_z = Entity:GetProp("localdata", "m_vecViewOffset[2]")-40
1199local range
1200local range2
1201fade_multiplier = 1
1202if (Tyleline:GetValue() ==0) then
1203 for i=1, #ranges do
1204 range2= ranges[i]
1205 range = ranges[i]
1206
1207 local opacity_multiplier = ranges_opacities[i] * fade_multiplier
1208
1209 local previous_world_x, previous_world_y
1210
1211 for rot=0, 360, accuracy do
1212 local rot_temp = math.rad(rot)
1213 local temp_x, temp_y, temp_z = local_x + range * math.cos(rot_temp), local_y + range * math.sin(rot_temp), local_z
1214
1215 local fraction, entindex_hit = trace_line_skip_teammates( local_x, local_y, local_z, temp_x, temp_y, temp_z)
1216
1217 --local fraction_x, fraction_y = local_x+(temp_x-local_x)*fraction, local_y+(temp_y-local_y)*fraction
1218 local fraction_x, fraction_y = lerp_pos(local_x, local_y, local_z, temp_x, temp_y, temp_z, fraction)
1219 local world_x, world_y = client.WorldToScreen( fraction_x, fraction_y, temp_z+(range2-range))
1220
1221 local hue_extra = globals.RealTime() % 8 / 8
1222 local r, g, b = hsv_to_rgb(rot/360+hue_extra, 1, 1, 255)
1223
1224 local fraction_multiplier = 1
1225 if fraction > 0.9 then
1226 fraction_multiplier = 0.6
1227 end
1228
1229 if world_x ~= nil and previous_world_x ~= nil then
1230 if colortype:GetValue()==1 then
1231 draw.Color( r, g, b, 255*opacity_multiplier*fraction_multiplier)
1232 end
1233 draw.Line( world_x, world_y, previous_world_x, previous_world_y )
1234
1235
1236 end
1237 previous_world_x, previous_world_y = world_x, world_y
1238 end
1239 end
1240else
1241 for i=1, #ranges do
1242 range2= ranges[i]
1243 range = ranges[i]
1244 end
1245
1246 while range >5 do
1247 for i=1, #ranges do
1248
1249
1250 local opacity_multiplier = ranges_opacities[i] * fade_multiplier
1251
1252 local previous_world_x, previous_world_y
1253
1254 for rot=0, 360, accuracy do
1255 local rot_temp = math.rad(rot)
1256 local temp_x, temp_y, temp_z = local_x + range * math.cos(rot_temp), local_y + range * math.sin(rot_temp), local_z
1257
1258 local fraction, entindex_hit = trace_line_skip_teammates( local_x, local_y, local_z, temp_x, temp_y, temp_z)
1259
1260 --local fraction_x, fraction_y = local_x+(temp_x-local_x)*fraction, local_y+(temp_y-local_y)*fraction
1261 local fraction_x, fraction_y = lerp_pos(local_x, local_y, local_z, temp_x, temp_y, temp_z, fraction)
1262 local world_x, world_y = client.WorldToScreen( fraction_x, fraction_y, temp_z+(range2-range))
1263
1264 local hue_extra = globals.RealTime() % 8 / 8
1265 local r, g, b = hsv_to_rgb(rot/360+hue_extra, 1, 1, 255)
1266
1267 local fraction_multiplier = 1
1268 if fraction > 0.9 then
1269 fraction_multiplier = 0.6
1270 end
1271
1272 if world_x ~= nil and previous_world_x ~= nil then
1273 if colortype:GetValue()==1 then
1274 draw.Color( r, g, b, 255*opacity_multiplier*fraction_multiplier)
1275 end
1276 draw.Line( world_x, world_y, previous_world_x, previous_world_y )
1277
1278
1279 end
1280 previous_world_x, previous_world_y = world_x, world_y
1281 end
1282 end
1283 for i=1, #ranges do
1284
1285
1286 local opacity_multiplier = ranges_opacities[i] * fade_multiplier
1287
1288 local previous_world_x, previous_world_y
1289
1290 for rot=0, 360, accuracy do
1291 local rot_temp = math.rad(rot)
1292 local temp_x, temp_y, temp_z = local_x + range * math.cos(rot_temp), local_y + range * math.sin(rot_temp), local_z
1293
1294 local fraction, entindex_hit = trace_line_skip_teammates( local_x, local_y, local_z, temp_x, temp_y, temp_z)
1295
1296 --local fraction_x, fraction_y = local_x+(temp_x-local_x)*fraction, local_y+(temp_y-local_y)*fraction
1297 local fraction_x, fraction_y = lerp_pos(local_x, local_y, local_z, temp_x, temp_y, temp_z, fraction)
1298 local world_x, world_y = client.WorldToScreen( fraction_x, fraction_y, temp_z+(range-range2))
1299
1300 local hue_extra = globals.RealTime() % 8 / 8
1301 local r, g, b = hsv_to_rgb(rot/360+hue_extra, 1, 1, 255)
1302
1303 local fraction_multiplier = 1
1304 if fraction > 0.9 then
1305 fraction_multiplier = 0.6
1306 end
1307
1308 if world_x ~= nil and previous_world_x ~= nil then
1309 if colortype:GetValue()==1 then
1310 draw.Color( r, g, b, 255*opacity_multiplier*fraction_multiplier)
1311 end
1312 draw.Line( world_x, world_y, previous_world_x, previous_world_y )
1313
1314
1315 end
1316 previous_world_x, previous_world_y = world_x, world_y
1317 end
1318 end
1319 range =range-10
1320 end
1321
1322
1323
1324 end
1325end
1326end
1327
1328
1329
1330callbacks.Register( "Draw", "on_paint", on_paint);]]--
1331
1332---Custom View model---
1333
1334local xO = 0; local yO = 0; local zO = 0; local fO = 0;
1335local function cache() xO = client.GetConVar("viewmodel_offset_x"); yO = client.GetConVar("viewmodel_offset_y"); zO = client.GetConVar("viewmodel_offset_z"); fO = client.GetConVar("viewmodel_fov"); end cache()
1336local visref = gui.Reference("Misc", "General", "Main");
1337local wind = gui.Window("wind", "Viewmodel Extender", 200,200,200,270);
1338local gr = gui.Groupbox(wind, "Viewmodel Stuff", 10,10, 180,218)
1339local c = gui.Checkbox(visref, "c", "Show Viewmodel Extender", false)
1340local xS = gui.Slider(gr, "xS", "X", xO, -20, 20);
1341local yS = gui.Slider(gr, "yS", "Y", yO, -100, 100);
1342local zS = gui.Slider(gr, "zS", "Z", zO, -20, 20);
1343local vfov = gui.Slider(gr, "vfov", "Viewmodel FOV", fO, 0, 120);
1344
1345function doesthing()
1346if c:GetValue() then wind:SetActive(1); else wind:SetActive(0); end
1347client.SetConVar("viewmodel_offset_x", xS:GetValue(), true);
1348client.SetConVar("viewmodel_offset_y", yS:GetValue(), true);
1349client.SetConVar("viewmodel_offset_z", zS:GetValue(), true);
1350client.SetConVar("viewmodel_fov", vfov:GetValue(), true); end
1351callbacks.Register("Draw", "sets", doesthing);
1352
1353---Auto buy-----
1354
1355local msc_p2 = gui.Reference('MISC', "AUTOMATION", "Other")
1356local GroupBox = gui.Groupbox( msc_p2, "AutoBuy Settings", 0, 200, 213, 240 );
1357local ActiveCheckBox = gui.Checkbox(GroupBox, "ActiveCheckBox", "Activate", false)
1358local PrimaryWeapons = gui.Combobox( GroupBox, 'PrimaryWeapons', "Primary Weapons", "Off", "AK-47 | M4", "Scout", "AWP","Auto")
1359local SecondaryWeapons = gui.Combobox( GroupBox, 'SecondaryWeapons', "Secondary Weapons", "Off", "Elite", "P250", "Tec-9 | Five-Seven ", "R8 | Deagle")
1360local Nades = gui.Checkbox( GroupBox, "Nades", "Grenades", false);
1361local Zeus = gui.Checkbox( GroupBox, "Zeus", "Zeus", false);
1362local Armor = gui.Checkbox( GroupBox, "Armor", "Armor", false);
1363local Defuser = gui.Checkbox( GroupBox, "Defuser", "Defuser", false);
1364
1365local money = 0
1366local sleep = 0
1367local buy_act = false
1368function autobuy(Event)
1369 if (entities.GetLocalPlayer() ~= nil) then
1370 money = entities.GetLocalPlayer():GetProp("m_iAccount")
1371 end
1372 if ActiveCheckBox:GetValue() then
1373 if Event:GetName() == "round_start" then
1374 buy_act = true
1375 sleep = globals.TickCount()
1376end end end
1377
1378function buy()
1379 if buy_act == true and globals.TickCount() - sleep > 32 then
1380 buy_act = false
1381 sleep = globals.TickCount()
1382 if (SecondaryWeapons:GetValue() == 0) then
1383 elseif (SecondaryWeapons:GetValue() == 1) then
1384 client.Command("buy elite", true)
1385 elseif (SecondaryWeapons:GetValue() == 2) then
1386 client.Command("buy p250", true)
1387 elseif (SecondaryWeapons:GetValue() == 3) then
1388 client.Command("buy tec9", true)
1389 elseif (SecondaryWeapons:GetValue() == 4) then
1390 client.Command("buy deagle", true)
1391end
1392 if (money > 199) then
1393 if Zeus:GetValue() then
1394 client.Command("buy Taser", true)
1395 end end
1396
1397 if (money > 2200) then
1398 if (PrimaryWeapons:GetValue() == 0) then
1399 elseif (PrimaryWeapons:GetValue() == 1) then
1400 client.Command("buy ak47", true)
1401 elseif (PrimaryWeapons:GetValue() == 2) then
1402 client.Command("buy ssg08", true)
1403 elseif (PrimaryWeapons:GetValue() == 3) then
1404 client.Command("buy awp", true)
1405 elseif (PrimaryWeapons:GetValue() == 4) then
1406 client.Command("buy scar20", true)
1407 end
1408
1409 if Armor:GetValue() then client.Command("buy vest; buy vesthelm"); end
1410 if Nades:GetValue() then client.Command("buy hegrenade; buy incgrenade; buy molotov; buy smokegrenade; buy flashbang", true); end
1411 if Defuser:GetValue() then client.Command("buy defuser");
1412 end end end end
1413
1414client.AllowListener('round_start');
1415callbacks.Register("FireGameEvent", "autobuy", autobuy);
1416callbacks.Register("Draw", "buy", buy);
1417
1418
1419---molotov circle---
1420
1421local reference = gui.Reference("VISUALS", "WEAPONS", "Options");
1422local enable = gui.Checkbox(reference, "molotov_enable", "Molotov circle", 0 );
1423
1424
1425
1426local function drawCircle(x, y, z, radius, thickness, quality, r, g, b, a)
1427
1428 if enable:GetValue() then
1429
1430 local quality = quality or 20
1431 local thickness = thickness or 8
1432 local Screen_X_Line_Old, Screen_Y_Line_Old
1433 for rot=0, 360, quality do
1434 local rot_temp = math.rad(rot)
1435 local LineX, LineY, LineZ = radius * math.cos(rot_temp) + x, radius * math.sin(rot_temp) + y, z
1436 local Screen_X_Line, Screen_Y_Line = client.WorldToScreen(LineX, LineY, LineZ)
1437 if Screen_X_Line ~=nil and Screen_X_Line_Old ~= nil then
1438 draw.SetFont(draw.CreateFont("Tahoma", 12));
1439 draw.Color(r, g, b, a)
1440 draw.Line(Screen_X_Line, Screen_Y_Line, Screen_X_Line_Old, Screen_Y_Line_Old)
1441 for i = 0, thickness do
1442 draw.Line(Screen_X_Line, Screen_Y_Line+i, Screen_X_Line_Old, Screen_Y_Line_Old+i)
1443 end
1444 end
1445 Screen_X_Line_Old, Screen_Y_Line_Old = Screen_X_Line, Screen_Y_Line
1446 end
1447 end
1448end
1449
1450callbacks.Register("Draw", function()
1451 local ents = entities.FindByClass("CInferno")
1452 for i = 1, #ents do
1453 local molotov = ents[i]
1454 local x, y, z = molotov:GetAbsOrigin()
1455
1456 drawCircle(x, y, z, 200, 1, 15, 214, 69, 65, 255)
1457 end
1458end)
1459
1460--fakeduck flag-----
1461
1462local reference = gui.Reference("VISUALS", "ENEMIES", "Options");
1463local enable = gui.Checkbox(reference, "fakeduckflag_enable", "Is Fakeducking", 0 );
1464local storedTick = 0
1465local crouched_ticks = { }
1466
1467local function toBits(num)
1468 local t = { }
1469 while num > 0 do
1470 rest = math.fmod(num,2)
1471 t[#t+1] = rest
1472 num = (num-rest) / 2
1473 end
1474
1475 return t
1476end
1477
1478
1479callbacks.Register("DrawESP", "FD_Indicator", function(Builder)
1480 local g_Local = entities.GetLocalPlayer()
1481 local Entity = Builder:GetEntity()
1482
1483 if g_Local == nil or Entity == nil or not Entity:IsPlayer() or not Entity:IsAlive() then
1484 return
1485 end
1486 if enable:GetValue() then
1487
1488 local index = Entity:GetIndex()
1489 local m_flDuckAmount = Entity:GetProp("m_flDuckAmount")
1490 local m_flDuckSpeed = Entity:GetProp("m_flDuckSpeed")
1491 local m_fFlags = Entity:GetProp("m_fFlags")
1492
1493 if crouched_ticks[index] == nil then
1494 crouched_ticks[index] = 0
1495 end
1496
1497 if m_flDuckSpeed ~= nil and m_flDuckAmount ~= nil then
1498 if m_flDuckSpeed == 8 and m_flDuckAmount <= 0.9 and m_flDuckAmount > 0.01 and toBits(m_fFlags)[1] == 1 then
1499 if storedTick ~= globals.TickCount() then
1500 crouched_ticks[index] = crouched_ticks[index] + 1
1501 storedTick = globals.TickCount()
1502 end
1503
1504 if crouched_ticks[index] >= 5 then
1505 Builder:Color(255, 255, 0, 255)
1506 Builder:AddTextTop("Fake Duck")
1507 end
1508 else
1509 crouched_ticks[index] = 0
1510 end
1511 end
1512 end
1513end)
1514
1515---bomb info-----
1516
1517local defusing = false;
1518local plantedat = 0;
1519local planter = "???";
1520local planting = false;
1521local bombsite = "???";
1522local plantingStarted = 0;
1523
1524local textures = 0
1525local iconData, outlinedata, iconRGBA, iconW, iconH, outlineRGBA, outlineW, outlineH, iconTexture, outlineTexture
1526
1527local function dotextures()
1528iconData = http.Get( "https://i.imgur.com/0j9K6yy.png" )
1529outlineData = http.Get( "https://i.imgur.com/kWO9uwk.png" )
1530iconRGBA, iconW, iconH = common.DecodePNG(iconData)
1531outlineRGBA, outlineW, outlineH = common.DecodePNG(outlineData)
1532iconTexture = draw.CreateTexture(iconRGBA, iconW, iconH)
1533outlineTexture = draw.CreateTexture(outlineRGBA, outlineW, outlineH)
1534textures = 1
1535end
1536
1537local defaultTexture = draw.CreateTexture({255,255,255,255},100,100)
1538
1539local function lerp_pos(x1, y1, z1, x2, y2, z2, percentage)
1540
1541local x = (x2 - x1) * percentage + x1
1542local y = (y2 - y1) * percentage + y1
1543local z = (z2 - z1) * percentage + z1
1544
1545 return x, y, z
1546
1547end
1548
1549local function sitename(site)
1550
1551local a_x, a_y, a_z = entities.GetPlayerResources():GetProp("m_bombsiteCenterA")
1552local b_x, b_y, b_z = entities.GetPlayerResources():GetProp("m_bombsiteCenterB")
1553local site_x1, site_y1, site_z1 = site:GetMins()
1554local site_x2, site_y2, site_z2 = site:GetMaxs()
1555local site_x, site_y, site_z = lerp_pos(site_x1, site_y1, site_z1, site_x2, site_y2, site_z2, 0.5)
1556local distance_a, distance_b = vector.Distance(site_x, site_y, site_z, a_x, a_y, a_z), vector.Distance(site_x, site_y, site_z, b_x, b_y, b_z)
1557
1558 return distance_b > distance_a and "A" or "B"
1559
1560end
1561
1562function EventHook(Event)
1563
1564 if Event:GetName() == "bomb_beginplant" then
1565
1566 planter = client.GetPlayerNameByUserID(Event:GetInt("userid"))
1567 plantingStarted = globals.CurTime()
1568 bombsite = sitename(entities.GetByIndex(Event:GetInt("site")))
1569 planting = true
1570
1571
1572 end
1573
1574 if Event:GetName() == "bomb_abortplant" then
1575
1576 planting = false
1577
1578 end
1579
1580 if Event:GetName() == "bomb_begindefuse" then
1581
1582 defusing = true;
1583
1584 elseif Event:GetName() == "bomb_abortdefuse" then
1585
1586 defusing = false;
1587
1588 elseif Event:GetName() == "round_officially_ended" or Event:GetName() == "bomb_defused" or Event:GetName() == "bomb_exploded" then
1589
1590 defusing = false;
1591 planting = false
1592
1593 end
1594
1595 if Event:GetName() == "bomb_planted" then
1596
1597 plantedat = globals.CurTime()
1598 planting = false
1599
1600 end
1601
1602end
1603
1604function DrawingHook()
1605
1606 local font1 = draw.CreateFont("Verdana", 30)
1607 local font2 = draw.CreateFont("Verdana", 23)
1608 draw.SetFont(font1)
1609
1610 if planting == true then
1611
1612 local Player = entities.GetLocalPlayer();
1613 local ScreenW, ScreenH = draw.GetScreenSize();
1614 local PlantMath = (globals.CurTime() - plantingStarted) / 3.125
1615 local PlantTime = math.floor((((plantingStarted - globals.CurTime()) + 3.125) * 10)) / 10
1616
1617 draw.Color(75,225,0,255)
1618 draw.Text(ScreenW/100, 2, bombsite .. " - Planting")
1619 draw.TextShadow(ScreenW/100, 2, bombsite .. " - Planting")
1620 draw.Color(255,255,255,255)
1621 draw.SetFont(font2)
1622 draw.Text(ScreenW/100, 53, planter .. " - " .. PlantTime .. "s")
1623 draw.TextShadow(ScreenW/100, 53, planter .. " - " .. PlantTime .. "s")
1624 if Player:GetTeamNumber() == 3 and Player:GetPropBool("m_bHasDefuser") == true then
1625 draw.Color(255,255,255,255)
1626 if textures == 0 then dotextures() end
1627 if iconW ~= 40 or outlineW ~= 40 then draw.Text(ScreenW/100, 75, "Broken texture")
1628 else
1629 draw.SetTexture(iconTexture)
1630 draw.FilledRect(ScreenW/100, 75, ScreenW/100 + 40, 115)
1631 draw.SetTexture(outlineTexture)
1632 draw.FilledRect(ScreenW/100, 75, ScreenW/100 + 40, 115)
1633 draw.SetTexture(defaultTexture)
1634 end
1635 end
1636 draw.Color(0, 0, 0, 170);
1637 draw.FilledRect( 0, 0, ScreenW/200, ScreenH );
1638 draw.Color(0, 255, 0, 255);
1639 draw.FilledRect( 0, ScreenH - (ScreenH * PlantMath), ScreenW/200, ScreenH );
1640 draw.Color(255, 255, 255, 255);
1641
1642 end
1643
1644 if entities.FindByClass("CPlantedC4")[1] ~= nil then
1645
1646 local Bomb = entities.FindByClass("CPlantedC4")[1];
1647
1648 if Bomb:GetProp("m_bBombTicking") and Bomb:GetProp("m_bBombDefused") == 0 and globals.CurTime() < Bomb:GetProp("m_flC4Blow") then
1649
1650 local ScreenW, ScreenH = draw.GetScreenSize();
1651 local Player = entities.GetLocalPlayer();
1652 local bombtimer = math.floor((plantedat - globals.CurTime() + Bomb:GetProp("m_flTimerLength")) * 10) / 10
1653
1654 if bombtimer < 0 then bombtimer = 0.0 end
1655
1656 if defusing == true then
1657
1658 local BombMath = ((globals.CurTime() - Bomb:GetProp("m_flDefuseCountDown")) * (0 - 1)) / ((Bomb:GetProp("m_flDefuseCountDown") - Bomb:GetProp("m_flDefuseLength")) - Bomb:GetProp("m_flDefuseCountDown")) + 1;
1659
1660 draw.Color(0, 0, 0, 170);
1661 draw.FilledRect( 0, 0, ScreenW/200, ScreenH );
1662 draw.Color(0, 135, 255, 255);
1663 draw.FilledRect( 0, ScreenH * BombMath, ScreenW/200, ScreenH );
1664
1665 if bombtimer < 5 then
1666
1667 draw.Color(240, 20, 0, 255);
1668
1669 elseif bombtimer < 10 then
1670
1671 draw.Color(210, 150, 0, 255);
1672
1673 else
1674
1675 draw.Color(75, 225, 0, 255);
1676
1677 end
1678
1679 draw.SetFont(font1)
1680 draw.Text( ScreenW/100, 2, bombsite .. " - " .. bombtimer .. "s");
1681 draw.TextShadow( ScreenW/100, 2, bombsite .. " - " .. bombtimer .. "s");
1682 draw.Color(255, 255, 255, 255);
1683
1684 if Bomb:GetProp("m_flDefuseCountDown") > Bomb:GetProp("m_flC4Blow") then
1685
1686 draw.Color(255, 0, 0, 255);
1687
1688 end
1689
1690 local defusetime = math.floor( (Bomb:GetProp("m_flDefuseCountDown") - globals.CurTime()) * 10 ) / 10
1691
1692 draw.SetFont(font2)
1693 draw.Text(ScreenW/100, 53, "Defusing - " .. defusetime .. "s")
1694 draw.TextShadow(ScreenW/100, 53, "Defusing - " .. defusetime .. "s")
1695
1696 if Player:GetTeamNumber() == 3 and Player:GetPropBool("m_bHasDefuser") == true then
1697 draw.Color(255,255,255,255)
1698 if textures == 0 then dotextures() end
1699 if iconW ~= 40 or outlineW ~= 40 then draw.Text(ScreenW/100, 75, "Broken texture")
1700 else
1701 draw.SetTexture(iconTexture)
1702 draw.FilledRect(ScreenW/100, 75, ScreenW/100 + 40, 115)
1703 draw.SetTexture(outlineTexture)
1704 draw.FilledRect(ScreenW/100, 75, ScreenW/100 + 40, 115)
1705 draw.SetTexture(defaultTexture)
1706 end
1707 end
1708
1709 else
1710
1711 local BombMath = ((globals.CurTime() - Bomb:GetProp("m_flC4Blow")) * (0 - 1)) / ((Bomb:GetProp("m_flC4Blow") - Bomb:GetProp("m_flTimerLength")) - Bomb:GetProp("m_flC4Blow")) + 1;
1712
1713 draw.Color(0, 0, 0, 170);
1714 draw.FilledRect( 0, 0, ScreenW/200, ScreenH );
1715 draw.Color(0, 255, 0, 255);
1716 draw.FilledRect( 0, ScreenH * BombMath, ScreenW/200, ScreenH );
1717
1718 if bombtimer < 5 then
1719
1720 draw.Color(240, 20, 0, 255);
1721
1722 elseif bombtimer < 10 then
1723
1724 draw.Color(210, 150, 0, 255);
1725
1726 else
1727
1728 draw.Color(75, 225, 0, 255);
1729
1730 end
1731
1732 draw.SetFont(font1)
1733 draw.Text( ScreenW/100, 2, bombsite .. " - " .. bombtimer .. "s");
1734 draw.TextShadow( ScreenW/100, 2, bombsite .. " - " .. bombtimer .. "s");
1735
1736 if Player:GetTeamNumber() == 3 and Player:GetPropBool("m_bHasDefuser") == true then
1737 draw.Color(255,255,255,255)
1738 if textures == 0 then dotextures() end
1739 if iconW ~= 40 or outlineW ~= 40 then draw.Text(ScreenW/100, 75, "Broken texture")
1740 else
1741 draw.SetTexture(iconTexture)
1742 draw.FilledRect(ScreenW/100, 75, ScreenW/100 + 40, 115)
1743 draw.SetTexture(outlineTexture)
1744 draw.FilledRect(ScreenW/100, 75, ScreenW/100 + 40, 115)
1745 draw.SetTexture(defaultTexture)
1746 end
1747 end
1748
1749 end
1750
1751 if Player:IsAlive() and globals.CurTime() < Bomb:GetProp("m_flC4Blow") then
1752
1753 local hpleft = math.floor(0.5 + BombDamage(Bomb, Player))
1754
1755 if hpleft >= Player:GetHealth() then
1756
1757 draw.Color(240, 20, 0, 255)
1758 draw.SetFont(font2)
1759 local formatting = draw.GetTextSize("FATAL")
1760 draw.Text(ScreenW/2 - formatting/2, ScreenH/20, "FATAL");
1761 draw.TextShadow(ScreenW/2 - formatting/2, ScreenH/20, "FATAL");
1762
1763 elseif hpleft <= 0 then return
1764
1765 else
1766
1767 draw.Color(75, 225, 0, 255)
1768 draw.SetFont(font2)
1769 local formattinghp = draw.GetTextSize("-" .. hpleft .. " HP")
1770 draw.Text(ScreenW/2 - formattinghp/2, ScreenH/20, "-" .. hpleft .. " HP");
1771 draw.TextShadow(ScreenW/2 - formattinghp/2, ScreenH/20, "-" .. hpleft .. " HP");
1772
1773 end
1774 end
1775
1776 elseif Bomb:GetProp("m_bBombTicking") and Bomb:GetProp("m_bBombDefused") == 0 and globals.CurTime() < (Bomb:GetProp("m_flC4Blow") + 2) then
1777
1778 local ScreenW, ScreenH = draw.GetScreenSize();
1779 local Player = entities.GetLocalPlayer();
1780
1781 if Player:IsAlive() and globals.CurTime() < (Bomb:GetProp("m_flC4Blow") + 1) then
1782
1783 local hpleft = math.floor(0.5 + BombDamage(Bomb, Player))
1784
1785 if hpleft >= Player:GetHealth() then
1786
1787 draw.Color(240, 20, 0, 255)
1788 draw.SetFont(font2)
1789 local formatting = draw.GetTextSize("FATAL")
1790 draw.Text(ScreenW/2 - formatting/2, ScreenH/20, "FATAL");
1791 draw.TextShadow(ScreenW/2 - formatting/2, ScreenH/20, "FATAL");
1792
1793 elseif hpleft <= 0 then return
1794
1795 else
1796
1797 draw.Color(75, 225, 0, 255)
1798 draw.SetFont(font2)
1799 local formattinghp = draw.GetTextSize("-" .. hpleft .. " HP")
1800 draw.Text(ScreenW/2 - formattinghp/2, ScreenH/20, "-" .. hpleft .. " HP");
1801 draw.TextShadow(ScreenW/2 - formattinghp/2, ScreenH/20, "-" .. hpleft .. " HP");
1802
1803 end
1804 end
1805 end
1806 end
1807end
1808
1809function BombDamage(Bomb, Player)
1810
1811 local C4Distance = math.sqrt((select(1,Bomb:GetAbsOrigin()) - select(1,Player:GetAbsOrigin())) ^ 2 +
1812 (select(2,Bomb:GetAbsOrigin()) - select(2,Player:GetAbsOrigin())) ^ 2 +
1813 (select(3,Bomb:GetAbsOrigin()) - select(3,Player:GetAbsOrigin())) ^ 2);
1814
1815 local Gauss = (C4Distance - 75.68) / 789.2
1816 local flDamage = 450.7 * math.exp(-Gauss * Gauss);
1817
1818 if Player:GetProp("m_ArmorValue") > 0 then
1819
1820 local flArmorRatio = 0.5;
1821 local flArmorBonus = 0.5;
1822
1823 if Player:GetProp("m_ArmorValue") > 0 then
1824
1825 local flNew = flDamage * flArmorRatio;
1826 local flArmor = (flDamage - flNew) * flArmorBonus;
1827
1828 if flArmor > Player:GetProp("m_ArmorValue") then
1829
1830 flArmor = Player:GetProp("m_ArmorValue") * (1 / flArmorBonus);
1831 flNew = flDamage - flArmor;
1832
1833 end
1834
1835 flDamage = flNew;
1836
1837 end
1838
1839 end
1840
1841 return math.max(flDamage, 0);
1842
1843end
1844
1845client.AllowListener( "bomb_beginplant" );
1846client.AllowListener( "bomb_abortplant" );
1847client.AllowListener( "bomb_begindefuse" );
1848client.AllowListener( "bomb_abortdefuse" );
1849client.AllowListener( "bomb_defused" );
1850client.AllowListener( "bomb_exploded" );
1851client.AllowListener( "round_officially_ended" );
1852client.AllowListener( "bomb_planted" );
1853
1854callbacks.Register("FireGameEvent", "EventHookB", EventHook);
1855callbacks.Register("Draw", "DrawingHookB", DrawingHook)