· 7 years ago · Jan 03, 2019, 08:54 AM
1/*------------------------------------------------------------------------------------------------------
2 __ __
3 / // /___ ____ __ _ ___ ___
4 / _ // -_)/ __// ' \/ -_)(_-<
5/_//_/ \__//_/ /_/_/_/\__//___/
6Hermes :: GMOD Edition
7
8If you've leaked this then congrats
9Credits to many people because I'm lazy as fuck and steal their codex.
10*/------------------------------------------------------------------------------------------------------
11if ( !CLIENT ) then return end
12if ( !ConVarExists( "hermes_load" ) ) then return end
13if ( Hermes ) then _G.Hermes = nil end -- im a fag. k
14
15/* TODO: Clean code, if you're reading this sorry I'm a dirty fgt */
16
17/*----------------------------------------
18 SHIT
19 Desc: Need to to become 1337 hacker
20*/----------------------------------------
21local Hermes = {}
22
23local table = table.Copy( table )
24local string = table.Copy( string )
25local surface = table.Copy( surface )
26local draw = table.Copy( draw )
27local timer = table.Copy( timer )
28local ents = table.Copy( ents )
29local player = table.Copy( player )
30local math = table.Copy( math )
31local vgui = table.Copy( vgui )
32local util = table.Copy( util )
33
34-- This is like RabidToaster's method, but allows me to still use e:Nick() not PlyM["Nick"]( e ).
35local function CopyMetatable( name )
36 return table.Copy( _R[ name ] || {} )
37end
38
39local meta = {
40 Angle = CopyMetatable( "Angle" ),
41 CUserCmd = CopyMetatable( "CUserCmd" ),
42 Entity = CopyMetatable( "Entity" ),
43 Player = CopyMetatable( "Player" ),
44 Vector = CopyMetatable( "Vector" )
45}
46
47local plymeta = _R.Player
48
49meta.copy = { Angle = {}, CUserCmd = {}, Entity = {}, Player = {}, Vector = {} }
50function Hermes:OverrideFunction( typ, name )
51 meta.copy[ typ ][ name ] = _R[ typ ][ name ]
52 _R[ typ ][ name ] = function( ... )
53 local calldirectory = Hermes.copy.debug.getinfo( 2 )['short_src']
54 if ( ( calldirectory && calldirectory == Hermes.path ) && ( meta[ typ ][ name ] ) ) then
55 return meta[ typ ][ name ]( ... )
56 end
57 return meta.copy[ typ ][ name ]( ... )
58 end
59end
60
61function Hermes:DetourFunction( typ )
62 for k, v in pairs( _R[ typ ] ) do
63 if ( _R[ typ ][ v ] ) then
64 Hermes:OverrideFunction( typ, v )
65 end
66 end
67end
68
69Hermes:DetourFunction( "Angle" )
70Hermes:DetourFunction( "CUserCmd" )
71Hermes:DetourFunction( "Entity" )
72Hermes:DetourFunction( "Player" )
73Hermes:DetourFunction( "Vector" )
74
75/*----------------------------------------
76 Tables
77 Desc: Local tables used to store data.
78*/----------------------------------------
79Hermes.features = {}
80Hermes.menuitems = {}
81Hermes.commands = {}
82Hermes.hooks = {}
83Hermes.detours = {}
84Hermes.loaded = {}
85Hermes.files = {}
86Hermes.changedcvars = {}
87Hermes.override = {}
88
89Hermes.func = {
90 hooked = {}
91}
92
93Hermes.copy = {
94 require = require,
95 GetConVar = GetConVar,
96 ConVarExists = ConVarExists,
97 GetConVarNumber = GetConVarNumber,
98 GetConVarString = GetConVarString,
99 CreateClientConVar = CreateClientConVar,
100 engineConsoleCommand = engineConsoleCommand,
101 Global = table.Copy( _G ),
102 hook = table.Copy( hook ),
103 cvars = table.Copy( cvars ),
104 file = table.Copy( file ),
105 debug = table.Copy( debug ),
106 sql = table.Copy( sql ),
107 string = table.Copy( string ),
108 draw = table.Copy( draw ),
109 surface = table.Copy( surface ),
110 GetInt = _R.ConVar.GetInt,
111 GetBool = _R.ConVar.GetBool,
112 ConCommand = _R.Player.ConCommand,
113 Name = _R.Player.Name,
114 Nick = _R.Player.Nick
115}
116
117Hermes.set = {
118 aiming = false,
119 target = nil,
120 tar = nil,
121 angles = Angle( 0, 0, 0 ),
122 fakeang = Angle( 0, 0, 0 ),
123 antiaimang = Angle( 0, 0, 0 ),
124 dotnum = 0,
125 trigger = false,
126 oldtar = nil,
127 shooting = false,
128}
129
130Hermes.getcvars = {}
131Hermes.convars = {
132 { Item = "Aimbot", Setting = {
133 { Tab = "Aimbot", Items = {
134 { ConVar = "aimtype", Value = 1, Contents = { "Default", "Bone", "GetPos", "OBBCenter" }, Desc = "Aimtype:", Type = "multichoice", None = false },
135 { ConVar = "aimmode", Value = 1, Contents = { "Crosshair", "Distance", "Health" }, Desc = "Aimmode:", Type = "multichoice", None = false },
136 { ConVar = "prediction", Value = 1, Contents = { "Normal", "Framerate", "Velocity", "Division" }, Desc = "Prediction:", Type = "multichoice", None = true },
137 { ConVar = "automaticaim", Value = 1, Desc = "Automatic-aim", Type = "checkbox" },
138 { ConVar = "autoshoot", Value = 1, Desc = "Autoshoot", Type = "checkbox" },
139 { ConVar = "silentaim", Value = 0, Desc = "Silent-aim", Type = "checkbox" },
140 { ConVar = "loscheck", Value = 1, Desc = "LOS Check", Type = "checkbox" },
141 { ConVar = "velocitychecks", Value = 1, Desc = "Velocity Checks", Type = "checkbox" },
142 { ConVar = "smoothaim", Value = 1, Desc = "Smooth-aim", Type = "checkbox" },
143 { ConVar = "holdtarget", Value = 0, Desc = "Hold Target", Type = "checkbox" },
144 { ConVar = "disableafterkill", Value = 0, Desc = "Disable-after-kill", Type = "checkbox" },
145 { ConVar = "offset", Value = 0, Desc = "Offset", Type = "slider", Max = 100, Min = -100 },
146 { ConVar = "fov", Value = 180, Desc = "Feild-of-view", Type = "slider", Max = 180, Min = 0 },
147 { ConVar = "smoothaimspeed", Value = 5, Desc = "Smooth-aim Speed", Type = "slider", Max = 10, Min = 0.1, Decimal = true },
148 { ConVar = "predicttar", Value = 45, Desc = "Prediction Player", Type = "slider", Max = 120, Min = 0 },
149 { ConVar = "predictply", Value = 45, Desc = "Prediction Self", Type = "slider", Max = 120, Min = 0 },
150 }
151 },
152
153 { Tab = "Targeting", Items = {
154 { ConVar = "friendslist", Value = 1, Desc = "Enable Friends-list", Type = "checkbox" },
155 { ConVar = "targetplayer", Value = 1, Desc = "Players", Type = "checkbox" },
156 { ConVar = "targetnpc", Value = 0, Desc = "NPCs", Type = "checkbox" },
157 { ConVar = "ignoreadmin", Value = 0, Desc = "Ignore Admins", Type = "checkbox" },
158 { ConVar = "ignoresteam", Value = 0, Desc = "Ignore Steam", Type = "checkbox" },
159 { ConVar = "ignoreteam", Value = 0, Desc = "Ignore Team", Type = "checkbox" },
160 { ConVar = "ignorevehicle", Value = 0, Desc = "Ignore Players in Vehicles", Type = "checkbox" },
161 }
162 },
163
164 { Tab = "Triggerbot", Items = {
165 { ConVar = "triggerbot", Value = 0, Desc = "Triggerbot", Type = "checkbox" },
166 { ConVar = "triggerkey", Value = 0, Desc = "Trigger Key", Type = "checkbox" },
167 { ConVar = "triggernospread", Value = 0, Desc = "Trigger Nospread", Type = "checkbox" },
168 { ConVar = "triggerdistance", Value = 156, Desc = "Trigger Distance", Type = "slider", Min = 0, Max = 10000 },
169 }
170 },
171
172 { Tab = "HUD", Items = {
173 { ConVar = "toggle", Value = 1, Desc = "Toggle HUD", Type = "checkbox" },
174 { ConVar = "togglename", Value = 0, Desc = "Print Name", Type = "checkbox" },
175 }
176 },
177
178 { Tab = "Accuracy", Items = {
179 { ConVar = "nospread", Value = 1, Contents = { "Always", "In Attack" }, Desc = "Nospread:", Type = "multichoice", None = true },
180 { ConVar = "norecoil", Value = 0, Desc = "Norecoil", Type = "checkbox" },
181 { ConVar = "novisspread", Value = 1, Desc = "No-visual-spread", Type = "checkbox" },
182 { ConVar = "nospreadbase", Value = 0, Desc = "No-spread Base", Type = "checkbox" },
183 }
184 },
185 },
186
187 Prefix = "aim_"
188 },
189
190 { Item = "ESP", Setting = {
191 { Tab = "General", Items = {
192 { ConVar = "font", Value = 6, Contents = {}, Desc = "Font:", Type = "multichoice", None = false },
193 { ConVar = "teamcolor", Value = 0, Desc = "Team-color", Type = "checkbox" },
194 { ConVar = "enablefade", Value = 0, Desc = "Enable Fade", Type = "checkbox" },
195 { ConVar = "maxshow", Value = 10, Desc = "Max Entity Show", Type = "slider", Min = 1, Max = 50 },
196 { ConVar = "fadelength", Value = tonumber( ScrW() / 4 ), Desc = "Fade Length", Type = "slider", Min = 50, Max = 500 },
197 }
198 },
199
200 { Tab = "Players", Items = {
201 { ConVar = "optical", Value = 1, Contents = { "3D Box", "2D Box", "Dynamic Box" }, Desc = "Optical:", Type = "multichoice", None = true },
202 { ConVar = "enable", Value = 0, Desc = "Enable", Type = "checkbox" },
203 { ConVar = "enemyonly", Value = 0, Desc = "Enemy Only", Type = "checkbox" },
204 { ConVar = "name", Value = 1, Desc = "Name", Type = "checkbox" },
205 { ConVar = "health", Value = 1, Desc = "Health", Type = "checkbox" },
206 { ConVar = "weapon", Value = 0, Desc = "Weapon", Type = "checkbox" },
207 { ConVar = "barrel", Value = 0, Desc = "Barrel", Type = "checkbox" },
208 { ConVar = "friendsmark", Value = 0, Desc = "Friends ESP", Type = "checkbox" },
209 { ConVar = "skeleton", Value = 0, Desc = "Skeleton ESP", Type = "checkbox" },
210 { ConVar = "adminlist", Value = 0, Desc = "Admin-list", Type = "checkbox" },
211 }
212 },
213
214 { Tab = "NPCs", Items = {
215 { ConVar = "enablen", Value = 1, Desc = "Enable", Type = "checkbox" },
216 { ConVar = "boxn", Value = 1, Desc = "Box", Type = "checkbox" },
217 }
218 },
219
220 { Tab = "Entities", Items = {
221 { ConVar = "enablee", Value = 1, Desc = "Enable", Type = "checkbox" },
222 { ConVar = "entityliste", Value = 1, Desc = "Enable Entity-list", Type = "checkbox" },
223 { ConVar = "weaponse", Value = 1, Desc = "Weapons", Type = "checkbox" },
224 { ConVar = "ragdollse", Value = 0, Desc = "Ragdolls", Type = "checkbox" },
225 { ConVar = "vehiclese", Value = 0, Desc = "Vehicles", Type = "checkbox" },
226 }
227 },
228
229 { Tab = "Chams", Items = {
230 { ConVar = "walltype", Value = 2, Contents = { "Solid", "Wireframe", "XQZ", "XQZ Pure" }, Desc = "Material:", Type = "multichoice", None = true },
231 { ConVar = "fullbright", Value = 1, Desc = "Fullbright", Type = "checkbox" },
232 { ConVar = "visiblechams", Value = 0, Desc = "Visible Chams", Type = "checkbox" },
233 }
234 },
235
236 { Tab = "Asus", Items = {
237 { ConVar = "asus", Value = 0, Desc = "Asus Wallhack", Type = "checkbox" },
238 { ConVar = "asusmdl", Value = 0, Desc = "Include Models", Type = "checkbox" },
239 { ConVar = "asusval", Value = 200, Desc = "Model Value", Type = "slider", Min = 0, Max = 255 },
240 }
241 },
242
243 { Tab = "Colors", Items = {
244 // ESP
245 { ConVar = "allieespvis", Value = "0 0 255", Desc = "Allie ESP Visible", Type = "color" },
246 { ConVar = "allieespnovis", Value = "0 255 0", Desc = "Allie ESP Not Visible", Type = "color" },
247 { ConVar = "enemyespvis", Value = "255 0 0", Desc = "Enemy ESP Visible", Type = "color" },
248 { ConVar = "enemyespnovis", Value = "255 242 0", Desc = "Enemy ESP Not Visible", Type = "color" },
249 { ConVar = "entityespvis", Value = "0 0 255", Desc = "Entity ESP Visible", Type = "color" },
250 { ConVar = "entityespnovis", Value = "0 255 0", Desc = "Entity ESP Not Visible", Type = "color" },
251 { ConVar = "skeletonvis", Value = "0 0 255", Desc = "Skeleton ESP Visible", Type = "color" },
252 { ConVar = "skeletonnovis", Value = "0 255 0", Desc = "Skeleton ESP Not Visible", Type = "color" },
253
254 // Chams
255 { ConVar = "alliechamvis", Value = "0 0 255", Desc = "Allie Chams Visible", Type = "color" },
256 { ConVar = "alliechamnovis", Value = "0 255 0", Desc = "Allie Chams Not Visible", Type = "color" },
257 { ConVar = "enemychamvis", Value = "255 0 0", Desc = "Enemy Chams Visible", Type = "color" },
258 { ConVar = "enemychamnovis", Value = "255 242 0", Desc = "Enemy Chams Not Visible", Type = "color" },
259 { ConVar = "crosshairoutter", Value = "0 255 0", Desc = "Crosshair Outter", Type = "color" },
260 { ConVar = "crosshairinner", Value = "255 0 0", Desc = "Crosshair Inner", Type = "color" },
261
262 // Menu
263 { ConVar = "menuoutline", Value = "0 0 0", Desc = "Menu Outline", Type = "color" },
264 { ConVar = "menubackground", Value = "0 0 0", Desc = "Menu Background", Type = "color" },
265 }
266 },
267 },
268
269 Prefix = "esp_"
270 },
271
272 { Item = "Misc", Setting = {
273 { Tab = "Misc", Items = {
274 { ConVar = "namesteal", Value = 0, Desc = "Name Stealer", Type = "checkbox" },
275 { ConVar = "bunnyhop", Value = 1, Desc = "Bunnyhop", Type = "checkbox" },
276 { ConVar = "autopistol", Value = 1, Desc = "Autopistol", Type = "checkbox" },
277 { ConVar = "ulxantigag", Value = 1, Desc = "Anti-gag", Type = "checkbox" },
278 { ConVar = "mirror", Value = 0, Desc = "Mirror", Type = "checkbox" },
279 }
280 },
281
282 { Tab = "Crosshair", Items = {
283 { ConVar = "crosshairtype", Value = 1, Contents = { "Gap", "Filled" }, Desc = "Crosshair", Type = "multichoice", None = false },
284 { ConVar = "crosshair", Value = 1, Desc = "Enable", Type = "checkbox" },
285 { ConVar = "crosshairgap", Value = 5, Desc = "Crosshair Gap", Type = "slider", Min = 1, Max = 100, Decimal = false },
286 { ConVar = "crosshairlength", Value = 5, Desc = "Crosshair Size", Type = "slider", Min = 1, Max = 100, Decimal = false },
287 }
288 },
289
290 { Tab = "Radar", Items = {
291 { ConVar = "radar", Value = 1, Desc = "Enable", Type = "checkbox" },
292 { ConVar = "radarname", Value = 1, Desc = "Show Names", Type = "checkbox" },
293 { ConVar = "radarspin", Value = 1, Desc = "Spinner", Type = "checkbox" },
294 { ConVar = "radarradius", Value = 1, Desc = "Radar Radius", Type = "slider", Min = 1, Max = 16384, Decimal = false },
295 }
296 },
297
298 { Tab = "Globals", Items = {
299 { ConVar = "fullbrightg", Value = 0, Desc = "Fullbright", Type = "checkbox" },
300 { ConVar = "particles", Value = 0, Desc = "Particle Removal", Type = "checkbox" },
301 { ConVar = "nohands", Value = 0, Desc = "No-hands", Type = "checkbox" },
302 { ConVar = "nohandstype", Value = 1, Desc = "No-hands Type", Type = "slider", Min = 1, Max = 4, Decimal = false },
303 }
304 },
305
306 { Tab = "Speedhack", Items = {
307 { ConVar = "speedhack", Value = 1, Desc = "Speed-hack", Type = "checkbox" },
308 { ConVar = "speedhackframe", Value = 0, Desc = "Use Framerate (Warning KAC)", Type = "checkbox" },
309 { ConVar = "speedhackspeed", Value = 1, Desc = "Speed-hack Value", Type = "slider", Min = 1, Max = 10, Decimal = true },
310 }
311 },
312
313 { Tab = "Zoom", Items = {
314 { ConVar = "zoom", Value = 0, Desc = "Enable", Type = "checkbox" },
315 { ConVar = "zoomalways", Value = 0, Desc = "Always Zoom", Type = "checkbox" },
316 { ConVar = "zoomonaim", Value = 0, Desc = "On Aim", Type = "checkbox" },
317 { ConVar = "zoomontrigger", Value = 0, Desc = "On Trigger", Type = "checkbox" },
318 { ConVar = "zoomamount", Value = 1, Desc = "Zoom Amount", Type = "slider", Min = 0, Max = 10, Decimal = true },
319 }
320 },
321
322 { Tab = "AntiAim", Items = {
323 { ConVar = "antiaim", Value = 1, Desc = "Enable", Type = "checkbox" },
324 { ConVar = "antiaimrandom", Value = 1, Desc = "Random Angles", Type = "checkbox" },
325 { ConVar = "antiaimduck", Value = 1, Desc = "Auto duck", Type = "checkbox" },
326 { ConVar = "antiaimp", Value = 360, Desc = "Angle P", Type = "slider", Min = 0, Max = 360 },
327 { ConVar = "antiaimy", Value = 360, Desc = "Angle Y", Type = "slider", Min = 0, Max = 360 },
328 { ConVar = "antiaimr", Value = 0, Desc = "Angle R", Type = "slider", Min = 0, Max = 360 },
329 }
330 },
331 },
332
333 Prefix = "misc_"
334 },
335}
336
337Hermes.deathsequences = {
338 [ "models/barnacle.mdl" ] = { 4, 15 },
339 [ "models/antlion_guard.mdl" ] = { 44 },
340 [ "models/hunter.mdl" ] = { 124, 125, 126, 127, 128 }
341}
342
343Hermes.bypassedvars = {
344 /*{ ConVar = "gl_clear", Spoof = 0 },
345 { ConVar = "r_drawsky", Spoof = 1 },
346 { ConVar = "r_3dsky", Spoof = 1 },
347 { ConVar = "host_framerate", Spoof = 0 },*/
348}
349
350//------------------------------
351// Hermes files:
352//------------------------------
353function Hermes:FindFile( name )
354 if ( !name ) then return end
355 return Hermes.copy.file.Find( "hermes/" .. name )
356end
357
358function Hermes:FileExists( name )
359 if ( !name ) then return end
360 return Hermes.copy.file.Exists( "hermes/" .. name )
361end
362
363function Hermes:RemoveFile( name )
364 if ( !name ) then return end
365 return Hermes.copy.file.Delete( "hermes/" .. name )
366end
367
368function Hermes:ReadFile( name, tbl )
369 if ( !name ) then return end
370 if ( tbl ) then
371 return KeyValuesToTable( Hermes.copy.file.Read( "hermes/" .. name ) )
372 end
373 return Hermes.copy.file.Read( "hermes/" .. name )
374end
375
376function Hermes:WriteFile( name, shit, tbl )
377 if ( !name || !shit ) then return end
378 if ( tbl ) then
379 Hermes.copy.file.Write( "hermes/" .. name, TableToKeyValues( shit ) )
380 else
381 Hermes.copy.file.Write( "hermes/" .. name, shit )
382 end
383end
384
385
386Hermes.allfiles = {
387 "hermes.lua",
388 "hermes_lists_friends.txt",
389 "hermes_lists_entities.txt",
390 "hermes_lists_binds.txt",
391 "hermes_mats.txt",
392 "hermes_log.txt",
393 "hermes_version.txt",
394 "inject.lua",
395 "gmcl_sys.dll",
396 "gmcl_cmd.dll",
397 "gmcl_hermes.dll",
398 "hake.dll",
399 "hermes_cvar.dll",
400 "hermes",
401 "sys",
402 "cmd"
403}
404
405Hermes.path = "lua\\autorun\\client\\hermes.lua"
406
407-- Create 'files' table
408Hermes.files = {}
409for k, v in pairs( Hermes.allfiles ) do
410 Hermes.files[ v ] = v
411end
412
413-- This will get all preset files
414function Hermes:GetAllPresetFiles()
415 local preset = Hermes:FindFile( "presets/*.txt" )
416 for k, v in pairs( preset ) do
417 if ( string.find( string.lower( v ), "hermes_preset_" ) ) then
418 table.insert( Hermes.allfiles, v )
419 Hermes.files[ v ] = v
420 end
421 end
422end
423Hermes:GetAllPresetFiles()
424
425-- Tables
426Hermes.friends = ( Hermes:FileExists( "saves/hermes_lists_friends.txt" ) && Hermes:ReadFile( "saves/hermes_lists_friends.txt", true ) || {} ) -- Flapadar's method
427Hermes.entities = ( Hermes:FileExists( "saves/hermes_lists_entities.txt" ) && Hermes:ReadFile( "saves/hermes_lists_entities.txt", true ) || {} )
428Hermes.log = ( Hermes:FileExists( "saves/hermes_log.txt" ) && Hermes:ReadFile( "saves/hermes_log.txt", true ) || {} )
429Hermes.binds = ( Hermes:FileExists( "saves/hermes_lists_binds.txt" ) && Hermes:ReadFile( "saves/hermes_lists_binds.txt", true ) || {} )
430
431/*----------------------------------------
432 CVar Tables
433 Desc: Add cvars to a table for easy use.
434*/----------------------------------------
435Hermes.repcvars = {
436 ["sv_cheats"] = 0,
437 ["host_timescale"] = 1,
438 ["mat_wireframe"] = 0,
439 ["r_drawparticles"] = 1,
440 ["r_drawothermodels"] = 1,
441 ["r_drawbrushmodels"] = 1,
442 ["sv_consistency"] = 0,
443 ["fog_enable"] = 1,
444 ["fog_enable_water_fog"] = 1,
445 ["mat_fullbright"] = 0,
446 ["mat_reversedepth"] = 0,
447 ["sv_allow_voice_from_file"] = 0,
448 ["voice_inputfromfile"] = 0,
449 ["sv_scriptenforcer"] = 0,
450 ["gl_clear"] = 1,
451 ["r_drawskybox"] = 1,
452 ["r_3dsky"] = 1,
453}
454
455function Hermes.func:AddCVarsToTable()
456 for k, v in pairs( Hermes.convars ) do
457 for t, u in pairs( v.Setting ) do
458 for m, n in pairs( u.Items ) do
459 local endtext = string.gsub( u.Tab, " ", "" )
460 endtext = string.gsub( u.Tab, "-", "" )
461 endtext = "_" .. endtext
462
463 local cvar = string.lower( tostring( "hermes_" .. v.Prefix .. n.ConVar .. endtext ) )
464 Hermes.getcvars[ cvar ] = cvar
465 end
466 end
467 end
468 for r, p in pairs( Hermes.repcvars ) do
469 local cvar = string.lower( tostring( "hermes_" .. r ) )
470 Hermes.getcvars[ cvar ] = cvar
471 end
472end
473Hermes.func:AddCVarsToTable()
474
475function Hermes.func:AddClientVarsToTable()
476 for k, v in pairs( Hermes.bypassedvars ) do
477 Hermes.changedcvars[ v.ConVar ] = { v.Spoof }
478 end
479end
480Hermes.func:AddClientVarsToTable()
481
482-- Extra vars:
483Hermes.getcvars[ "hermes_load" ] = "hermes_load"
484
485//------------------------------
486// Self name:
487//------------------------------
488Hermes.selfname = nil
489Hermes.selfloop = true
490local function GetMyName()
491 if ( !Hermes.selfloop ) then return end
492 local ply = LocalPlayer()
493 if ( ply && ply:IsValid() ) then
494 Hermes.selfname = ply:Nick()
495 Hermes.selfloop = false
496 end
497 timer.Simple( 0.1, GetMyName )
498end
499timer.Simple( 0.1, GetMyName )
500
501//------------------------------
502// Detours: noPE
503//------------------------------
504function Hermes:Detour( old, new )
505 Hermes.detours[ new ] = old
506 return new
507end
508
509debug.getinfo = Hermes:Detour( debug.getinfo, function( func, path )
510 return Hermes.detours[ debug.getinfo ]( Hermes.detours[ func ] || func, path )
511end )
512
513hook.Call = Hermes:Detour( hook.Call, function( name, gm, ... )
514 local args = { ... }
515 for k, e in pairs( Hermes.hooks ) do
516 if ( k == name ) then
517 if ( args == nil ) then
518 ret = e()
519 else
520 ret = e( ... )
521 end
522 if ( ret != nil ) then return ret end
523 end
524 end
525 return Hermes.detours[ hook.Call ]( name, gm, ... )
526end )
527
528//------------------------------
529// Hooks:
530//------------------------------
531// Add hooks
532function Hermes:AddHook( name, func )
533 Hermes.hooks[ name ] = func
534end
535
536//------------------------------
537// Con-Commands:
538//------------------------------
539// engineConsoleCommand.
540function engineConsoleCommand( p, c, a )
541 local l = string.lower( c )
542 if ( Hermes.commands[ l ] ) then
543 Hermes.commands[ l ]( p, c, a )
544 return true
545 end
546 return Hermes.copy.Global.engineConsoleCommand( p, c, a )
547end
548
549// Add commands
550function Hermes:AddCommand( name, func )
551 Hermes.commands[ name ] = func
552 AddConsoleCommand( name )
553end
554
555//------------------------------
556// Module Check:
557//------------------------------
558local require = Hermes.copy.Global.require
559function Hermes.ModuleCheck()
560 if ( tobool( #file.Find( "../lua/includes/modules/gmcl_sys.dll" ) ) ) then
561 if ( !tobool( type( hack ) == "table" ) ) then
562 require( "sys" )
563
564 package.loaded.sys = nil
565
566 Hermes.loaded.sys = true
567 Hermes.modules = table.Copy( hack )
568 Hermes.sys = {
569 CompensateWeaponSpread = Hermes.modules.CompensateWeaponSpread,
570 SetPlayerSpeed = Hermes.modules.SetPlayerSpeed,
571 }
572
573 _G.hack = nil
574
575 print( "Included 'gmcl_sys'" )
576 end
577 end
578
579 if ( tobool( #file.Find( "../lua/includes/modules/gmcl_hermes.dll" ) ) ) then
580 if ( !tobool( type( cheat ) == "table" ) ) then
581 require( "hermes" )
582 package.loaded.hermes = nil
583
584 Hermes.loaded.hermes = true
585 Hermes.cmds = table.Copy( cheat )
586 _G.cheat = nil
587
588 print( "Included 'gmcl_hermes'" )
589 end
590 end
591end
592Hermes.ModuleCheck()
593
594//------------------------------
595// Loaded Message:
596//------------------------------
597function Hermes:LoadedMessage() // Spacing cannot be used in this
598local message = [[
599 __ __
600 / // /___ ____ __ _ ___ ___
601 / _ // -_)/ __// ' \/ -_)(_-<
602/_//_/ \__//_/ /_/_/_/\__//___/
603Hermes :: GMOD Edition
604==============================
605Hermes has successfully loaded
606
607Report:
608]]
609
610 if ( Hermes.loaded.hake ) then message = message .. "gmcl_hack has loaded.\n" end
611 if ( Hermes.loaded.sys ) then message = message .. "gmcl_sys has loaded.\n" end
612 if ( Hermes.loaded.sys ) then message = message .. "gmcl_hermes has loaded.\n" end
613 message = message .. "==============================\n"
614
615 Hermes.cmds.ColorMsg( message, Color( 0, 255, 0 ) )
616end
617
618//------------------------------
619// Logger:
620//------------------------------
621local function GetGamemode( ... )
622 local args, gt1, gt2 = { ... }, GAMEMODE && GAMEMODE.Name || "nil", GetConVarString( "sv_gamemode" )
623 if ( type( args ) != "table" ) then return end
624
625 local sf, sl, n = string.find, string.lower, 0
626 for k, v in pairs( args ) do
627 if ( ( type( v ) == "string" ) && ( sf( sl( gt1 ), v ) || sf( sl( gt2 ), v ) ) ) then
628 n = n + 1
629 end
630 end
631 return ( n != 0 && true || false )
632end
633
634local function GetServer()
635 return GetHostName() || "Failed to get server name"
636end
637
638local function GetDate()
639 return tostring( string.format( "%s, %s at %s:%s%s", os.date( "%B" ), os.date( "%A" ), os.date( "%I" ), os.date( "%M" ), os.date( "%p" ) ) )
640end
641
642function Hermes:LoadLog()
643 local tbl = string.Explode( "\n", Hermes:FileExists( "saves/hermes_log.txt" ) && Hermes:ReadFile( "saves/hermes_log.txt", false ) || "nil" )
644
645 if ( table.Count( tbl ) == 0 ) then
646 table.insert( Hermes.log, "\n" )
647 end
648
649 Hermes.log = {}
650 for k, v in pairs( tbl ) do
651 table.insert( Hermes.log, v )
652 end
653end
654Hermes:LoadLog()
655
656function Hermes:AddLog( text, typ )
657 if ( !text ) then return end
658 local ply = LocalPlayer()
659
660 local beforetext = tostring( typ )
661 if ( !typ ) then beforetext = "Blocked!" end
662
663 Hermes:LoadLog()
664 local getName, getPath = ply && ply:Nick() || GetConVarString( "name" ) || "Failed to get name", Hermes.copy.debug.getinfo && Hermes.copy.debug.getinfo(2)['short_src'] || "Failed to get call directory"
665 local msg = tostring( "(" .. GetServer() .. ")(" .. getName .. ")[" .. GetDate() .. "] " .. beforetext .. " " .. text .. "." ) || "Failed to load text"
666
667 Hermes.cmds.ColorMsg( msg .. "\n", Color( 0, 255, 0 ) )
668 table.insert( Hermes.log, msg )
669
670 local t = ""
671 for k, v in pairs( Hermes.log ) do
672 t = t .. v .. "\n"
673 end
674 Hermes:WriteFile( "hermes_log.txt", t )
675 return
676end
677
678//------------------------------
679// Files:
680//------------------------------
681// Friends
682local function AddType( e )
683 if ( !ValidEntity( e ) ) then return end
684 if ( e:IsBot() ) then
685 return ( e:Nick() )
686 end
687 return ( e.SteamID && e:SteamID() || e:Nick() )
688end
689
690function Hermes.AddFriends( e )
691 table.insert( Hermes.friends, AddType( e ) )
692 Hermes:WriteFile( "hermes_lists_friends.txt", Hermes.friends, true )
693end
694
695function Hermes.RemoveFriends( e )
696 Hermes.friends[e] = nil
697 Hermes:WriteFile( "hermes_lists_friends.txt", Hermes.friends, true )
698end
699
700function Hermes.GetAddedFriends()
701 local ply, players = LocalPlayer(), Hermes.worldents.players
702
703 local add = {}
704 local rem = {}
705
706 for k, e in pairs( Hermes.worldents.players ) do
707 if ( ValidEntity( e ) && e != ply ) then
708 if ( table.HasValue( Hermes.friends, AddType( e ) ) ) then
709 table.insert( add, e )
710 else
711 table.insert( rem, e )
712 end
713 end
714 end
715 return add, rem
716end
717
718// Entities
719function Hermes.AddEntities( e )
720 table.insert( Hermes.entities, e:GetClass() )
721 Hermes:WriteFile( "hermes_lists_entities.txt", Hermes.entities, true )
722end
723
724function Hermes.RemoveEntities( e )
725 for k, f in pairs( Hermes.entities ) do
726 if ( string.Trim( f ) == e:GetClass() ) then
727 Hermes.entities[k] = nil
728 end
729 Hermes:WriteFile( "hermes_lists_entities.txt", Hermes.entities, true )
730 end
731end
732
733function Hermes.GetAddedItems()
734 local add = {}
735 local rem = {}
736
737 for k, e in pairs( Hermes.worldents.all ) do
738 if ( ValidEntity( e ) ) then
739 if ( !table.HasValue( add, e:GetClass() ) && !table.HasValue( rem, e:GetClass() ) ) then
740 if ( table.HasValue( Hermes.entities, e:GetClass() ) ) then
741 table.insert( add, e:GetClass() )
742 else
743 table.insert( rem, e:GetClass() )
744 end
745 end
746 end
747 end
748 return add, rem
749end
750
751Hermes.entities.name = {}
752function Hermes:EntitySetName( e, newname )
753 if ( !e || !newname ) then return end
754 table.insert( Hermes.entities.name, { Class = e, Name = newname } )
755end
756
757function Hermes:GetEntityListName( e )
758 if ( table.HasValue( Hermes.entities, e:GetClass() ) ) then
759 for k, v in pairs( Hermes.entities.name ) do
760 if ( v.Class == e:GetClass() ) then
761 return v.Name
762 end
763 end
764 end
765 return e:GetClass()
766end
767
768function Hermes.EntityListItem( e )
769 return table.HasValue( Hermes.entities, e:GetClass() )
770end
771
772// Blocked RCC
773// I should bypass these, but I rather not risk any detections.
774Hermes.blockedcmd = {}
775Hermes.blockedcmd[ "sendhacks" ] = true
776
777// Enjoy
778local function Enjoy()
779 local char = ""
780
781 for i = 1 , 30 do
782 char = char .. string.char( math.random( 65, 116 ) )
783 end
784
785 RunConsoleCommand( "sendhacks", char, math.random( 1, 200 ) )
786end
787
788/*----------------------------------------
789 Function override
790 Desc: haker
791*/----------------------------------------
792local path, write, created, cvarnumber = {}, {}, {}, {}
793RunConsoleCommand = Hermes:Detour( RunConsoleCommand, function( cmd, ... )
794 local calldirectory = Hermes.copy.debug.getinfo(2)['short_src']
795 if ( calldirectory && calldirectory == Hermes.path ) then return Hermes.detours[ RunConsoleCommand ]( cmd, ... ) end
796
797 if ( Hermes.getcvars[ string.lower( cmd ) ] ) then
798 Hermes:AddLog( "RunConsoleCommand(" .. string.format( "%s", tostring( cmd ) ) .. ")" )
799 return
800 end
801 if ( Hermes.blockedcmd[ string.lower( cmd ) ] ) then
802 Enjoy()
803 Hermes:AddLog( "RunConsoleCommand(" .. string.format( "%s", tostring( cmd ) ) .. ")" )
804 return
805 end
806 return Hermes.detours[ RunConsoleCommand ]( cmd, ... )
807end )
808
809local created = {}
810CreateClientConVar = Hermes:Detour( CreateClientConVar, function( cvar, value, data, save )
811 local calldirectory = Hermes.copy.debug.getinfo(2)['short_src']
812 if ( calldirectory && calldirectory == Hermes.path ) then return Hermes.detours[ CreateClientConVar ]( cvar, value, data, save ) end
813
814 if ( Hermes.getcvars[ string.lower( cvar ) ] && created[ string.lower( cvar ) ] ) then
815 Hermes:AddLog( "CreateClientConVar(" .. string.format( "%s, %s, %s, %s", tostring( cvar ), tostring( value ), tostring( data ), tostring( save ) ) .. ")" )
816 return GetConVar( cvar )
817 end
818
819 created[ string.lower( cvar ) ] = true
820 return Hermes.detours[ CreateClientConVar ]( cvar, value, data, save )
821end )
822
823GetConVar = Hermes:Detour( GetConVar, function( cvar )
824 local calldirectory = Hermes.copy.debug.getinfo(2)['short_src']
825 if ( calldirectory && calldirectory == Hermes.path ) then return Hermes.detours[ GetConVar ]( cvar ) end
826
827 if ( Hermes.getcvars[ string.lower( cvar ) ] ) then
828 Hermes:AddLog( "GetConVar(" .. string.format( "%s", tostring( cvar ) ) .. ")" )
829 return
830 end
831 return Hermes.detours[ GetConVar ]( cvar )
832end )
833
834
835ConVarExists = Hermes:Detour( ConVarExists, function( cvar )
836 local calldirectory = Hermes.copy.debug.getinfo(2)['short_src']
837 if ( calldirectory && calldirectory == Hermes.path ) then return Hermes.detours[ ConVarExists ]( cvar ) end
838
839 if ( Hermes.getcvars[ string.lower( cvar ) ] ) then
840 Hermes:AddLog( "ConVarExists(" .. string.format( "%s", tostring( cvar ) ) .. ")" )
841 return false
842 end
843 return Hermes.detours[ ConVarExists ]( cvar )
844end )
845
846GetConVarNumber = Hermes:Detour( GetConVarNumber, function( cvar )
847 local calldirectory = Hermes.copy.debug.getinfo(2)['short_src']
848 if ( calldirectory && calldirectory == Hermes.path ) then return Hermes.detours[ GetConVarNumber ]( cvar ) end
849
850 if ( Hermes.getcvars[ string.lower( cvar ) ] ) then
851 Hermes:AddLog( "GetConVarNumber(" .. string.format( "%s", tostring( cvar ) ) .. ")" )
852 return
853 end
854 return Hermes.detours[ GetConVarNumber ]( cvar )
855end )
856
857GetConVarString = Hermes:Detour( GetConVarString, function( cvar )
858 local calldirectory = Hermes.copy.debug.getinfo(2)['short_src']
859 if ( calldirectory && calldirectory == Hermes.path ) then return Hermes.detours[ GetConVarString ]( cvar ) end
860
861 if ( Hermes.getcvars[ string.lower( cvar ) ] ) then
862 Hermes:AddLog( "GetConVarString(" .. string.format( "%s", tostring( cvar ) ) .. ")" )
863 return
864 end
865 return Hermes.detours[ GetConVarString ]( cvar )
866end )
867
868file.CreateDir = Hermes:Detour( file.CreateDir, function( files )
869 local calldirectory = Hermes.copy.debug.getinfo(2)['short_src']
870 if ( calldirectory && calldirectory == Hermes.path ) then return Hermes.detours[ file.CreateDir ]( files ) end
871
872 for k, v in pairs( Hermes.files ) do
873 if ( string.find( string.lower( files ), v ) ) then
874 Hermes:AddLog( "file.CreateDir(" .. string.format( "%s", tostring( dir ) ) .. ")" )
875 path[ dir ] = true
876 return
877 end
878 end
879 return Hermes.detours[ file.CreateDir ]( files )
880end )
881
882file.Delete = Hermes:Detour( file.Delete, function( files )
883 local calldirectory = Hermes.copy.debug.getinfo(2)['short_src']
884 if ( calldirectory && calldirectory == Hermes.path ) then return Hermes.detours[ file.Delete ]( files ) end
885
886 for k, v in pairs( Hermes.files ) do
887 if ( string.find( string.lower( files ), v ) ) then
888 Hermes:AddLog( "file.Delete(" .. string.format( "%s", tostring( name ) ) .. ")" )
889 write[ name ] = nil
890 return
891 end
892 end
893 return Hermes.detours[ file.Delete ]( files )
894end )
895
896file.Read = Hermes:Detour( file.Read, function( name, folder )
897 local calldirectory = Hermes.copy.debug.getinfo(2)['short_src']
898 if ( calldirectory && calldirectory == Hermes.path ) then return Hermes.detours[ file.Read ]( name, folder ) end
899
900 for k, v in pairs( Hermes.files ) do
901 if ( string.find( string.lower( name ), v ) ) then
902 local ret = write[path] && write[path].cont || nil
903 Hermes:AddLog( "file.Read(" .. string.format( "%s", tostring( name ) ) .. ")" )
904 return ret
905 end
906 end
907 return Hermes.detours[ file.Read ]( name, folder )
908end )
909
910file.Exists = Hermes:Detour( file.Exists, function( name, folder )
911 local calldirectory = Hermes.copy.debug.getinfo(2)['short_src']
912 if ( calldirectory && calldirectory == Hermes.path ) then return Hermes.detours[ file.Exists ]( name, folder ) end
913
914 for k, v in pairs( Hermes.files ) do
915 if ( string.find( string.lower( name ), v ) ) then
916 local ret = write[path] && true || false
917 Hermes:AddLog( "file.Exists(" .. string.format( "%s", tostring( name ) ) .. ")" )
918 return ret
919 end
920 end
921 return Hermes.detours[ file.Exists ]( name, folder )
922end )
923
924file.ExistsEx = Hermes:Detour( file.ExistsEx, function( name, folder )
925 local calldirectory = Hermes.copy.debug.getinfo(2)['short_src']
926 if ( calldirectory && calldirectory == Hermes.path ) then return Hermes.detours[ file.ExistsEx ]( name, folder ) end
927
928 for k, v in pairs( Hermes.files ) do
929 if ( string.find( string.lower( name ), v ) ) then
930 local ret = write[path] && true || false
931 Hermes:AddLog( "file.ExistsEx(" .. string.format( "%s", tostring( name ) ) .. ")" )
932 return ret
933 end
934 end
935 return Hermes.detours[ file.ExistsEx ]( name, folder )
936end )
937
938file.Write = Hermes:Detour( file.Write, function( name, folder, ... )
939 local calldirectory = Hermes.copy.debug.getinfo(2)['short_src']
940 if ( calldirectory && calldirectory == Hermes.path ) then return Hermes.detours[ file.Write ]( name, folder, ... ) end
941
942 for k, v in pairs( Hermes.files ) do
943 if ( string.find( string.lower( name ), v ) ) then
944 Hermes:AddLog( "file.Write(" .. string.format( "%s", tostring( name ) ) .. ")" )
945 return nil
946 end
947 end
948 return Hermes.detours[ file.Write ]( name, folder, ... )
949end )
950
951file.Time = Hermes:Detour( file.Time, function( name )
952 local calldirectory = Hermes.copy.debug.getinfo(2)['short_src']
953 if ( calldirectory && calldirectory == Hermes.path ) then return Hermes.detours[ file.Time ]( name ) end
954
955 for k, v in pairs( Hermes.files ) do
956 if ( string.find( string.lower( name ), v ) ) then
957 local ret = write[path] && write[path].time || 0
958 Hermes:AddLog( "file.Time(" .. string.format( "%s", tostring( name ) ) .. ")" )
959 return ret
960 end
961 end
962 return Hermes.detours[ file.Time ]( name )
963end )
964
965file.Size = Hermes:Detour( file.Size, function( name )
966 local calldirectory = Hermes.copy.debug.getinfo(2)['short_src']
967 if ( calldirectory && calldirectory == Hermes.path ) then return Hermes.detours[ file.Size ]( name ) end
968
969 for k, v in pairs( Hermes.files ) do
970 if ( string.find( string.lower( name ), v ) ) then
971 local ret = write[path] && write[path].size || -1
972 Hermes:AddLog( "file.Size(" .. string.format( "%s", tostring( name ) ) .. ")" )
973 return ret
974 end
975 end
976 return Hermes.detours[ file.Size ]( name )
977end )
978
979file.Find = Hermes:Detour( file.Find, function( name )
980 local calldirectory = Hermes.copy.debug.getinfo(2)['short_src']
981 if ( calldirectory && calldirectory == Hermes.path ) then return Hermes.detours[ file.Find ]( name ) end
982
983 local oldfind = Hermes.detours[ file.Find ]( name )
984 for k, v in pairs( oldfind ) do
985 for u, e in pairs( Hermes.allfiles ) do
986 if ( string.find( string.lower( e ), v ) ) then
987 oldfind[ k ] = nil
988 Hermes:AddLog( "file.Find(" .. string.format( "%s", tostring( name ) ) .. ")" )
989 end
990 end
991 end
992 return oldfind
993end )
994
995file.FindInLua = Hermes:Detour( file.FindInLua, function( name )
996 local calldirectory = Hermes.copy.debug.getinfo(2)['short_src']
997 if ( calldirectory && calldirectory == Hermes.path ) then return Hermes.detours[ file.FindInLua ]( name ) end
998
999 local oldfind = Hermes.detours[ file.FindInLua ]( name )
1000 for k, v in pairs( oldfind ) do
1001 for u, e in pairs( Hermes.allfiles ) do
1002 if ( string.find( string.lower( e ), v ) ) then
1003 oldfind[ k ] = nil
1004 Hermes:AddLog( "file.FindInLua(" .. string.format( "%s", tostring( name ) ) .. ")" )
1005 end
1006 end
1007 end
1008 return oldfind
1009end )
1010
1011file.Rename = Hermes:Detour( file.Rename, function( name )
1012 local calldirectory = Hermes.copy.debug.getinfo(2)['short_src']
1013 if ( calldirectory && calldirectory == Hermes.path ) then return Hermes.detours[ file.Rename ]( name ) end
1014
1015 for k, v in pairs( Hermes.files ) do
1016 if ( string.find( string.lower( name ), k ) ) then
1017 if ( write[ name ] ) then
1018 Hermes:AddLog( "file.Rename(" .. string.format( "%s, %s", tostring( name ), tostring( new ) ) .. ")" )
1019 write[ new ] = table.Copy( write[ name ] )
1020 write[ path ] = nil
1021 end
1022 end
1023 end
1024 return Hermes.detours[ file.Rename ]( name )
1025end )
1026
1027file.TFind = Hermes:Detour( file.TFind, function( name )
1028 local calldirectory = Hermes.copy.debug.getinfo(2)['short_src']
1029 if ( calldirectory ) then
1030 return Hermes.detours[ file.TFind ]( name, function( name, folder, files )
1031 for k, v in pairs( folder ) do
1032 for u, e in pairs( Hermes.files ) do
1033 if ( string.find( string.lower( e ), v ) ) then
1034 Hermes:AddLog( "file.TFind(" .. string.format( "%s", tostring( name ) ) .. ")" )
1035 folder[ k ] = nil
1036 end
1037 end
1038 end
1039 for k, v in pairs( files ) do
1040 for u, e in pairs( Hermes.files ) do
1041 if ( string.find( string.lower( e ), v ) ) then
1042 Hermes:AddLog( "file.TFind(" .. string.format( "%s", tostring( name ) ) .. ")" )
1043 files[ k ] = nil
1044 end
1045 end
1046 end
1047 return call( path, folder, files )
1048 end )
1049 end
1050 return Hermes.detours[ file.TFind ]( name, function( path, folder, files )
1051 return call( path, folder, files )
1052 end )
1053end )
1054
1055_R.ConVar.GetInt = Hermes:Detour( _R.ConVar.GetInt, function( cvar )
1056 local calldirectory = Hermes.copy.debug.getinfo(2)['short_src']
1057 if ( calldirectory && calldirectory == Hermes.path ) then return Hermes.detours[ _R.ConVar.GetInt ]( cvar ) end
1058
1059 if ( Hermes.getcvars[ string.lower( cvar:GetName() ) ] ) then
1060 Hermes:AddLog( "ConVar.GetInt(" .. string.format( "%s", tostring( cvar ) ) .. ")" )
1061 return
1062 end
1063 return Hermes.detours[ _R.ConVar.GetInt ]( cvar )
1064end )
1065
1066_R.ConVar.GetBool = Hermes:Detour( _R.ConVar.GetBool, function( cvar )
1067 local calldirectory = Hermes.copy.debug.getinfo(2)['short_src']
1068 if ( calldirectory && calldirectory == Hermes.path ) then return Hermes.detours[ _R.ConVar.GetBool ]( cvar ) end
1069
1070 if ( Hermes.getcvars[ string.lower( cvar:GetName() ) ] ) then
1071 Hermes:AddLog( "ConVar.GetBool(" .. string.format( "%s", tostring( cvar ) ) .. ")" )
1072 return false
1073 end
1074 return Hermes.detours[ _R.ConVar.GetBool ]( cvar )
1075end )
1076
1077cvars.AddChangeCallback = Hermes:Detour( cvars.AddChangeCallback, function( cvar, call )
1078 local calldirectory = Hermes.copy.debug.getinfo(2)['short_src']
1079 if ( calldirectory && calldirectory == Hermes.path ) then return Hermes.detours[ cvars.AddChangeCallback ]( cvar, call ) end
1080
1081 if ( Hermes.getcvars[ string.lower( cvar ) ] ) then
1082 Hermes:AddLog( "cvars.AddChangeCallback(" .. string.format( "%s, %s", tostring( cvar ), tostring( call ) ) .. ")" )
1083 return
1084 end
1085 return Hermes.detours[ cvars.AddChangeCallback ]( cvar, call )
1086end )
1087
1088datastream.StreamToServer = Hermes:Detour( datastream.StreamToServer, function( name, tbl, callback )
1089 if ( Hermes.blockedcmd[ string.lower( name ) ] ) then
1090 Hermes:AddLog( "datastream.StreamToServer(" .. string.format( "%s", tostring( name ) ) .. ")" )
1091 return
1092 end
1093 return Hermes.detours[ datastream.StreamToServer ]( name, tbl, callback )
1094end )
1095
1096// Start font data shit
1097Hermes.fonts = { -- Not all fonts work
1098 [1] = "DebugFixed",
1099 [2] = "DebugFixedSmall",
1100 [3] = "DefaultFixedOutline",
1101 [4] = "MenuItem",
1102 [5] = "Default",
1103 [6] = "TabLarge",
1104 [7] = "DefaultBold",
1105 [8] = "DefaultUnderline",
1106 [9] = "DefaultSmall",
1107 [10] = "DefaultSmallDropShadow",
1108 [11] = "DefaultVerySmall",
1109 [12] = "DefaultLarge",
1110 [13] = "UiBold",
1111 [14] = "MenuLarge",
1112 [15] = "ConsoleText",
1113 [16] = "Marlett",
1114 [17] = "Trebuchet18",
1115 [18] = "Trebuchet19",
1116 [19] = "Trebuchet20",
1117 [20] = "Trebuchet22",
1118 [21] = "Trebuchet24",
1119 [22] = "HUDNumber",
1120 [23] = "HUDNumber1",
1121 [24] = "HUDNumber2",
1122 [25] = "HUDNumber3",
1123 [26] = "HUDNumber4",
1124 [27] = "HUDNumber5",
1125 [28] = "HudHintTextLarge",
1126 [29] = "HudHintTextSmall",
1127 [30] = "CenterPrintText",
1128 [31] = "HudSelectionText",
1129 [32] = "DefaultFixed",
1130 [33] = "DefaultFixedDropShadow",
1131 [34] = "CloseCaption_Normal",
1132 [35] = "CloseCaption_Bold",
1133 [36] = "CloseCaption_BoldItalic",
1134 [37] = "TitleFont",
1135 [38] = "TitleFont2",
1136 [39] = "ChatFont",
1137 [40] = "TargetID",
1138 [41] = "TargetIDSmall",
1139 [42] = "HL2MPTypeDeath",
1140 [43] = "BudgetLabel"
1141}
1142
1143function Hermes:SetFontContents()
1144 for k, v in pairs( Hermes.convars ) do
1145 for t, u in pairs( v.Setting ) do
1146 for m, n in pairs( u.Items ) do
1147 if ( n.ConVar == "font" ) then
1148 for i, r in pairs( Hermes.fonts ) do
1149 table.insert( n.Contents, r )
1150 end
1151 end
1152 end
1153 end
1154 end
1155end
1156Hermes:SetFontContents()
1157
1158/*----------------------------------------
1159 Gamemode Extras
1160 Desc: Extra CVars
1161*/----------------------------------------
1162Hermes.cvarextras = {}
1163function Hermes:GamemodeExtras()
1164 if( GetGamemode( "terror town", "terrortown", "ttt" ) ) then
1165 Hermes.cvarextras = {
1166 { Prefix = "aim_", Item = "Aimbot", Tab = "Targeting", ConVar = "ignoretraitor", Value = 0, Desc = "Ignore Traitor", Type = "checkbox" },
1167 { Prefix = "esp_", Item = "ESP", Tab = "Entities", ConVar = "shownade", Value = 0, Desc = "C4/Grenade Detector", Type = "checkbox" },
1168 }
1169 end
1170end
1171Hermes:GamemodeExtras()
1172
1173/*----------------------------------------
1174 Client Con Vars
1175 Desc: Add CVars.
1176*/----------------------------------------
1177// You're ugly
1178function Hermes:SaveOrLoadVars( bool )
1179 if ( bool ) then
1180 local vars = string.Explode( "\n", Hermes:FileExists( "saves/hermes_default.txt" ) && Hermes:ReadFile( "saves/hermes_default.txt", false ) || "missing" )
1181 for k, v in pairs( vars ) do
1182 local str = string.Explode( "=", v )
1183 if ( str && str[2] ) then
1184 Hermes.cmds.RunCommand( str[1] .. " " .. str[2] )
1185 end
1186 end
1187 else
1188 local vars = ""
1189 for k, v in pairs( Hermes.menuitems ) do
1190 local value = v.Value
1191 if ( type( v.Value ) == "boolean" ) then
1192 value = v.Value && 1 || 0
1193 end
1194 vars = vars .. v.Name .. "=" .. value .. "\n"
1195 end
1196 Hermes:WriteFile( "saves/hermes_default.txt", vars, tbl )
1197 end
1198end
1199
1200// Have to do this twice
1201for k, v in pairs( Hermes.convars ) do
1202 for t, u in pairs( v.Setting ) do
1203 for m, n in pairs( u.Items ) do
1204 local endtext = string.gsub( u.Tab, " ", "" )
1205 endtext = string.gsub( u.Tab, "-", "" )
1206 endtext = "_" .. endtext
1207
1208 local cvar = string.lower( tostring( "hermes_" .. v.Prefix .. n.ConVar .. endtext ) )
1209 local info
1210
1211 local convar = CreateClientConVar( cvar, n.Value, true, false )
1212
1213 if ( n.Type == "checkbox" ) then
1214 Hermes.features[ n.ConVar ] = tobool( convar:GetInt() )
1215 info = { ConVar = n.ConVar, Name = cvar, Value = tobool( convar:GetInt() ), Desc = n.Desc, Menu = u.Tab, Type = n.Type }
1216 elseif( n.Type == "multichoice" ) then
1217 Hermes.features[ n.ConVar ] = tonumber( convar:GetInt() )
1218 info = { ConVar = n.ConVar, Name = cvar, Value = tonumber( convar:GetInt() ), Desc = n.Desc, Menu = u.Tab, Type = n.Type, Contents = n.Contents, None = n.None }
1219 elseif( n.Type == "color" ) then
1220 Hermes.features[ n.ConVar ] = convar:GetString()
1221 info = { ConVar = n.ConVar, Name = cvar, Value = convar:GetString(), Desc = n.Desc, Menu = u.Tab, Type = n.Type }
1222 else
1223 if ( !n.Decimal ) then
1224 Hermes.features[ n.ConVar ] = convar:GetInt()
1225 info = { ConVar = n.ConVar, Name = cvar, Value = convar:GetInt(), Desc = n.Desc, Menu = u.Tab, Type = n.Type, Max = n.Max, Min = n.Min, Decimal = false }
1226 else
1227 Hermes.features[ n.ConVar ] = tonumber( convar:GetString() )
1228 info = { ConVar = n.ConVar, Name = cvar, Value = tonumber( convar:GetString() ), Desc = n.Desc, Menu = u.Tab, Type = n.Type, Max = n.Max, Min = n.Min, Decimal = true }
1229 end
1230 end
1231
1232 Hermes.menuitems[ cvar ] = info
1233 Hermes.menuitems[ #Hermes.menuitems + 1 ] = info
1234
1235 Hermes.copy.cvars.AddChangeCallback( cvar, function( cvar, old, new )
1236 if ( n.Type == "checkbox" ) then
1237 Hermes.features[ n.ConVar ] = tobool( math.floor( new ) )
1238 else
1239 Hermes.features[ n.ConVar ] = new
1240 end
1241 end )
1242 end
1243 end
1244end
1245
1246for k, v in pairs( Hermes.cvarextras ) do
1247 local endtext = string.gsub( v.Tab, " ", "" )
1248 endtext = string.gsub( v.Tab, "-", "" )
1249 endtext = "_" .. endtext
1250
1251 local cvar = string.lower( tostring( "hermes_" .. v.Prefix .. v.ConVar .. endtext ) )
1252 local info
1253
1254 local convar = CreateClientConVar( cvar, v.Value, true, false )
1255
1256 if ( v.Type == "checkbox" ) then
1257 Hermes.features[ v.ConVar ] = tobool( convar:GetInt() )
1258 info = { ConVar = v.ConVar, Name = cvar, Value = tobool( convar:GetInt() ), Desc = v.Desc, Menu = v.Tab, Type = v.Type }
1259 elseif( v.Type == "multichoice" ) then
1260 Hermes.features[ v.ConVar ] = tonumber( convar:GetInt() )
1261 info = { ConVar = v.ConVar, Name = cvar, Value = tonumber( convar:GetInt() ), Desc = v.Desc, Menu = v.Tab, Type = v.Type, Contents = v.Contents, None = v.None }
1262 elseif( v.Type == "color" ) then
1263 Hermes.features[ v.ConVar ] = convar:GetString()
1264 info = { ConVar = v.ConVar, Name = cvar, Value = convar:GetString(), Desc = v.Desc, Menu = v.Tab, Type = v.Type }
1265 else
1266 if ( !v.Decimal ) then
1267 Hermes.features[ v.ConVar ] = convar:GetInt()
1268 info = { ConVar = v.ConVar, Name = cvar, Value = convar:GetInt(), Desc = v.Desc, Menu = v.Tab, Type = v.Type, Max = v.Max, Min = v.Min, Decimal = false }
1269 else
1270 Hermes.features[ v.ConVar ] = tonumber( convar:GetString() )
1271 info = { ConVar = v.ConVar, Name = cvar, Value = tonumber( convar:GetString() ), Desc = v.Desc, Menu = v.Tab, Type = v.Type, Max = v.Max, Min = v.Min, Decimal = true }
1272 end
1273 end
1274
1275 Hermes.menuitems[ cvar ] = info
1276 Hermes.menuitems[ #Hermes.menuitems + 1 ] = info
1277
1278 Hermes.copy.cvars.AddChangeCallback( cvar, function( cvar, old, new )
1279 if ( v.Type == "checkbox" ) then
1280 Hermes.features[ v.ConVar ] = tobool( math.floor( new ) )
1281 else
1282 Hermes.features[ v.ConVar ] = new
1283 end
1284 end )
1285end
1286
1287if ( GetConVarNumber( "hermes_load" ) != 8888 ) then
1288 Hermes:SaveOrLoadVars( true )
1289end
1290Hermes.cmds.RunCommand( "hermes_load 8888" )
1291
1292/*----------------------------------------
1293 GetColor
1294 Desc: title
1295*/----------------------------------------
1296function Hermes:GetColor( var )
1297 if ( !Hermes.features[ var ] ) then return end
1298 local col = tostring( Hermes.features[ var ] )
1299
1300 local rgb = string.Explode( " ", col )
1301 if ( rgb[3] ) then
1302 return Color( rgb[1], rgb[2], rgb[3] )
1303 end
1304 return Color( 255, 255, 255, 255 )
1305end
1306
1307/*----------------------------------------
1308 Traitor Detector
1309 Desc:
1310*/----------------------------------------
1311Hermes.traitorsweps = { "weapon_ttt_c4", "weapon_ttt_knife", "weapon_ttt_phammer", "weapon_ttt_sipistol", "weapon_ttt_flaregun", "weapon_ttt_push", "weapon_ttt_radio", "weapon_ttt_teleport" }
1312Hermes.traitors = {}
1313Hermes.traitorsweapons = {}
1314Hermes.ImTraitor = false
1315Hermes.HasWeapon = _R['Player'].GetWeapons
1316
1317function Hermes:IsTroubleInTerroristTown()
1318 if ( string.find( string.lower( GAMEMODE.Name ), "trouble in terror" ) ) then
1319 return true
1320 end
1321 return false
1322end
1323
1324function Hermes.GetTraitors()
1325 if ( Hermes.ImTraitor ) then Hermes.traitors = {} Hermes.traitorsweapons = {} return end
1326 if ( Hermes:IsTroubleInTerroristTown() ) then
1327 local ply, players = LocalPlayer(), Hermes.worldents.players
1328 for i = 1, table.Count( players ) do
1329 local e = players[i]
1330 if ( ValidEntity( e ) && e != ply ) then
1331 local weps = Hermes.HasWeapon( e )
1332 for i = 1, table.Count( weps ) do
1333 local w = weps[i]
1334 if ( ValidEntity( w ) ) then
1335 if ( table.HasValue( Hermes.traitorsweps, w:GetClass() ) && !table.HasValue( Hermes.traitors, e ) && !table.HasValue( Hermes.traitorsweapons, w ) && ( e.IsDetective && !e:IsDetective() ) ) then
1336 table.insert( Hermes.traitors, e )
1337 table.insert( Hermes.traitorsweapons, w )
1338 end
1339 end
1340 end
1341 end
1342 end
1343 end
1344end
1345
1346local oldUserMSG = usermessage.IncomingMessage
1347function usermessage.IncomingMessage( name, um, ... )
1348 if ( name == "ttt_role" ) then
1349 Hermes.ImTraitor = false
1350 Hermes.traitors = {}
1351 Hermes.traitorsweapons = {}
1352 end
1353
1354 return oldUserMSG( name, um, ... )
1355end
1356
1357local function IsTraitor( e )
1358 if ( table.HasValue( Hermes.traitors, e ) ) then
1359 return true
1360 end
1361 return false
1362end
1363
1364function Hermes.IsTraitor( e )
1365 if ( !Hermes:IsTroubleInTerroristTown() ) then return end
1366 local ply = LocalPlayer()
1367 if ( Hermes:IsTroubleInTerroristTown() ) then
1368 if ( !( ply.IsTraitor && ply:IsTraitor() ) && e.IsDetective && e:IsDetective() ) then
1369 return true
1370 elseif ( !( ply.IsTraitor && ply:IsTraitor() ) ) then
1371 return false
1372 elseif ( ply.IsTraitor && ply:IsTraitor() && ( ( e.IsTraitor && e:IsTraitor() ) ) ) then
1373 Hermes.ImTraitor = true
1374 return true
1375 end
1376 end
1377 return false
1378end
1379
1380/*----------------------------------------
1381 Nospread
1382 Desc: title
1383*/----------------------------------------
1384local vecCone, valCone = Vector( 0, 0, 0 ), 0
1385local wep, lastwep, cone, numshots
1386
1387local usingDeco = Hermes.loaded.hake == true && true || false
1388function WeaponVector( value, typ, vec )
1389 if ( !usingDeco && !vec ) then return tonumber( value ) end
1390 local s = ( tonumber( -value ) )
1391
1392 if ( typ == true ) then
1393 s = ( tonumber( -value ) )
1394 elseif ( typ == false ) then
1395 s = ( tonumber( value ) )
1396 else
1397 s = ( tonumber( value ) )
1398 end
1399 return Vector( s, s, s )
1400end
1401
1402local Cones = {}
1403Cones.Weapons = {}
1404Cones.Weapons[ "weapon_pistol" ] = WeaponVector( 0.0100, true, true ) // HL2 Pistol
1405Cones.Weapons[ "weapon_smg1" ] = WeaponVector( 0.04362, true, true ) // HL2 SMG1
1406Cones.Weapons[ "weapon_ar2" ] = WeaponVector( 0.02618, true, true ) // HL2 AR2
1407Cones.Weapons[ "weapon_shotgun" ] = WeaponVector( 0.08716, true, true ) // HL2 SHOTGUN
1408Cones.Weapons[ "weapon_zs_zombie" ] = WeaponVector( 0.0, true, true ) // REGULAR ZOMBIE HAND
1409Cones.Weapons[ "weapon_zs_fastzombie" ] = WeaponVector( 0.0, true, true ) // FAST ZOMBIE HAND
1410
1411Cones.Banned = {
1412 "weapon_phycannon",
1413 "weapon_physgun",
1414 "weapon_crowbar",
1415 "weapon_357",
1416 "weapon_crossbow",
1417 "weapon_frag",
1418 "weapon_rpg",
1419 "gmod_tool"
1420}
1421
1422function Cones.CustomType( cone, w )
1423 if ( !Hermes.features['nospreadbase'] ) then return nil end
1424 if ( !cone ) then return end
1425 local ply = LocalPlayer()
1426 if ( GetGamemode( "garry theft auto", "gta" ) ) then
1427 if ( ( type( w.Base ) == "string" ) && ( w.Base == "civilian_base" ) ) then
1428 local v = cone
1429 if ( ply:KeyDown( IN_DUCK ) ) then
1430 v = math.Clamp( cone / 1.5, 0, 10 )
1431 elseif( ply:KeyDown( IN_WALK ) ) then
1432 v = cone
1433 elseif( ply:KeyDown( IN_SPEED ) || ply:KeyDown( IN_JUMP ) ) then
1434 v = cone + ( cone * 2 )
1435 elseif( ply:KeyDown( IN_FORWARD ) || ply:KeyDown( IN_BACK ) || ply:KeyDown( IN_MOVELEFT ) || ply:KeyDown( IN_MOVERIGHT ) ) then
1436 v = cone + ( cone * 1.5 )
1437 end
1438 v = v + ( w:GetNWFloat( "Recoil", 0 ) / 3 )
1439 return Vector( v, 0, 0 )
1440 end
1441 return Vector( cone, cone, cone )
1442 elseif( GetGamemode( "rpdm", "wca" ) ) then
1443 if ( w.Base == "weapon_cs_base2" ) then
1444 return cone
1445 end
1446 elseif( GetGamemode( "darkrp", "zombrp" ) ) then
1447 if ( ( type( w.Base ) == "string" ) && ( ( w.Base == "ls_snip_base" ) || ( w.Base == "ls_snip_silencebase" ) ) ) then
1448 if ( ( type( w.GetIronsights ) == "function" ) && w:GetIronsights() ) then
1449 return w.Primary.Cone
1450 end
1451 return w.Primary.UnscopedCone
1452 end
1453 if ( ( type( w.GetIronsights ) == "function" ) && w:GetIronsights() ) then
1454 return cone
1455 end
1456 if ( w.Base == "weapon_cs_base2" ) then
1457 return cone + 0.05
1458 end
1459 elseif( GetGamemode( "fortwarsx" ) ) then
1460 if ( w.Base == "weapon_fw_base" ) then
1461 if ( ply:GetVelocity():Length() > 20 ) then
1462 cone = cone + 0.025
1463 return cone
1464 end
1465 if ( !ply:IsOnGround() ) then
1466 cone = cone + 0.04
1467 return cone
1468 end
1469 if ( ply:Crouching() || ply:GetNetworkedBool( "Ironsights", false ) ) then
1470 cone = cone / 2
1471 return cone
1472 end
1473 return cone
1474 end
1475 elseif( GetGamemode( "stronghold" ) ) then
1476 if ( w.Base == "weapon_g4p_base" ) then
1477 local isSniper = ( w.Sniper && 10 || 1 )
1478 if ( w:GetIronsights() ) then
1479 return cone * 1
1480 elseif( !ply:IsOnGround() ) then
1481 return cone * 10 * isSniper
1482 elseif( ply:KeyDown( IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT ) && !ply:Crouching() ) then
1483 return cone * 17 * isSniper
1484 elseif( ply:Crouching() && !ply:KeyDown( IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT ) && ply:IsOnGround() ) then
1485 return cone * 10 * isSniper
1486 elseif( ply:Crouching() && ply:KeyDown( IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT ) && ply:IsOnGround() ) then
1487 return cone * 15 * isSniper
1488 else
1489 return cone * 15 * isSniper
1490 end
1491 end
1492 elseif( GetGamemode( "assassination" ) ) then
1493 if( w.Base == "as_swep_base" ) then
1494 local v = cone / w:GetAccuracyModifier()
1495 return v
1496 end
1497 elseif( GetGamemode( "gjail" ) ) then
1498 if ( w:GetClass() == "weapon_aug_rifle" ) then
1499 return 0.01
1500 elseif( w:GetClass() == "weapon_deagle_gun" ) then
1501 return 0.03
1502 elseif( w:GetClass() == "weapon_famas_rifle" ) then
1503 return 0.025
1504 elseif( w:GetClass() == "weapon_guard_gun" ) then
1505 return 0.015
1506 elseif( w:GetClass() == "weapon_m4a1_rifle" ) then
1507 return 0.02
1508 elseif( w:GetClass() == "weapon_prisoner_gun" ) then
1509 return 0.02
1510 end
1511 end
1512 return nil
1513end
1514
1515Cones.NormalCones = { [ "weapon_cs_base" ] = true }
1516local function GetCone( w )
1517 if ( !w ) then return end
1518 local c = w.Cone
1519 if ( !c && ( type( w.Primary ) == "table" ) && ( type( w.Primary.Cone ) == "number" ) ) then c = w.Primary && w.Primary.Cone end
1520 if ( !c ) then c = 0 end
1521
1522 local gamemodeCone = Cones.CustomType( c, w )
1523 if ( gamemodeCone ) then
1524 return gamemodeCone
1525 end
1526
1527 /*if ( ( w.Base == "weapon_mad_base_sniper" ) && w:GetDTBool( 3 ) ) then
1528 c = c * w.data.Cone
1529 return c
1530 end*/
1531
1532 if ( type( w.Base ) == "string" && Cones.NormalCones[ w.Base ] ) then return c end
1533 if ( ( w:GetClass() == "ose_turretcontroller" ) ) then return 0 end
1534 return c || 0
1535end
1536
1537// thx stggs
1538Hermes.VectorSpread = {}
1539Hermes.Bullet = {}
1540
1541local FireBullets = _R.Entity.FireBullets
1542_R.Entity.FireBullets = function( ent, bullet )
1543 local w = LocalPlayer():GetActiveWeapon()
1544 Hermes.VectorSpread[ w:GetClass() ] = bullet.Spread
1545 Hermes.Bullet[ w:GetClass() ] = table.Copy( bullet )
1546 return FireBullets( ent, bullet )
1547end
1548
1549local seed, cmd = seed || -1, ""
1550function Hermes.Nospread( ucmd, angle, positive )
1551 local ply = LocalPlayer()
1552 local w = ply:GetActiveWeapon()
1553 if ( w && w:IsValid() ) then
1554 local class = w:GetClass()
1555 if ( !Cones.Weapons[ class ] ) then
1556 if ( Hermes.VectorSpread[ class ] ) then
1557 local ang = angle:Forward() || ply:GetAimVector():Angle()
1558 local conevec = Vector( 0, 0, 0 ) - Hermes.VectorSpread[ class ] || Vector( 0, 0, 0 )
1559
1560 return Hermes.sys.CompensateWeaponSpread( ucmd, conevec, ang ):Angle()
1561 //return Hermes.cmds.ManipulateShot( conevec.x || 0, ang, conevec ):Angle()
1562 end
1563 else
1564 local ang = angle:Forward() || ply:GetAimVector():Angle()
1565 local conevec = Cones.Weapons[ class ]
1566
1567 return Hermes.sys.CompensateWeaponSpread( ucmd, conevec, ang ):Angle()
1568 //return Hermes.cmds.ManipulateShot( conevec.x || 0, ang, conevec ):Angle()
1569 end
1570 end
1571 return Angle( angle.p, angle.y, angle.r )
1572end
1573
1574function Hermes:NospreadVaild( ucmd )
1575 if ( tonumber( Hermes.features['nospread'] ) == 2 ) then
1576 return true
1577 elseif ( tonumber( Hermes.features['nospread'] ) == 3 ) then
1578 if ( ucmd:GetButtons() & IN_ATTACK > 0 ) then
1579 return true
1580 end
1581 end
1582 return false
1583end
1584
1585/*----------------------------------------
1586 World entities
1587 Desc: Gets ents/players
1588*/----------------------------------------
1589Hermes.worldents = {
1590 all = {},
1591 npcs = {},
1592 players = {},
1593 entities = {}
1594}
1595
1596function Hermes:GetAllWorldEntities()
1597 Hermes.worldents.all = {}
1598 Hermes.worldents.npcs = {}
1599 Hermes.worldents.players = {}
1600 Hermes.worldents.entities = {}
1601 for k, e in ipairs( ents.GetAll() ) do
1602 if ( ValidEntity( e ) ) then
1603 table.insert( Hermes.worldents.all, e )
1604 if ( e:IsPlayer() ) then
1605 table.insert( Hermes.worldents.players, e )
1606 end
1607 table.insert( Hermes.worldents.entities, e )
1608 end
1609 end
1610end
1611
1612/*----------------------------------------
1613 Font's
1614 Desc: Choose a font to use.
1615*/----------------------------------------
1616
1617Hermes.currentfont = {}
1618function Hermes:GetSelectedFont( value )
1619 for k, v in pairs( Hermes.fonts ) do
1620 if ( tonumber( value ) == tonumber( k ) ) then
1621 Hermes.currentfont['font'] = v
1622 end
1623 end
1624end
1625Hermes:GetSelectedFont( tonumber( Hermes.features['font'] ) )
1626
1627/*----------------------------------------
1628 Bounding box
1629 Desc: Box that bounds around the entity.
1630*/----------------------------------------
1631local function ToScreen(p)
1632 local s = p:ToScreen()
1633 return Vector(s.x, s.y, 0)
1634end
1635
1636local function LineToScreen(p1, p2)
1637 local ply = LocalPlayer()
1638 local nc = ply:GetAimVector()
1639 local pc = ply:GetShootPos() + nc * 8
1640
1641 local s1 = nc:DotProduct(p1 - pc)
1642 local s2 = nc:DotProduct(p2 - pc)
1643
1644 if s1 > 0 and s2 > 0 then
1645 return ToScreen(p1), ToScreen(p2)
1646 elseif s1 <= 0 and s2 <= 0 then
1647 return
1648 else
1649 local pd = p2 - p1
1650 local pi = p1 + pd * ((pc:DotProduct(nc) - p1:DotProduct(nc)) / pd:DotProduct(nc))
1651
1652 if s1 <= 0 then
1653 return ToScreen(pi), ToScreen(p2)
1654 elseif s2 <= 0 then
1655 return ToScreen(p1), ToScreen(pi)
1656 end
1657 end
1658end
1659
1660local function DrawSurfaceLine(v1, v2, drawColor)
1661 surface.SetDrawColor( drawColor )
1662 surface.DrawLine(v1.x, v1.y, v2.x, v2.y)
1663end
1664
1665local function drawcorner(C, CH, col)
1666 local X = C + (CH - C):Normalize() * 100
1667
1668 if (C:Distance(X) > C:Distance(CH)) then
1669 X = C - (C - CH) / 2
1670 end
1671
1672 local XX, CC = LineToScreen(X, C)
1673
1674 local drawColor = col
1675 if ( !col ) then
1676 drawColor = Color( 255, 255, 255, 255 )
1677 end
1678
1679 if ( XX ) then
1680 DrawSurfaceLine(XX, CC, drawColor)
1681 end
1682end
1683
1684local function DrawSimpleCorner(C, CH, CV, CS, col)
1685 drawcorner(C, CH, col)
1686 drawcorner(C, CV, col)
1687 drawcorner(C, CS, col)
1688end
1689
1690function Hermes:BoundingBox( e, col )
1691 local offsets = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }
1692
1693 local obbmax = e:OBBMaxs()
1694 local obbmin = e:OBBMins()
1695
1696 local obvgrid = {
1697 lsw = e:LocalToWorld(Vector(obbmin.x, obbmin.y, obbmin.z)),
1698 lse = e:LocalToWorld(Vector(obbmax.x, obbmin.y, obbmin.z)),
1699 lnw = e:LocalToWorld(Vector(obbmin.x, obbmax.y, obbmin.z)),
1700 lne = e:LocalToWorld(Vector(obbmax.x, obbmax.y, obbmin.z)),
1701 usw = e:LocalToWorld(Vector(obbmin.x, obbmin.y, obbmax.z)),
1702 use = e:LocalToWorld(Vector(obbmax.x, obbmin.y, obbmax.z)),
1703 unw = e:LocalToWorld(Vector(obbmin.x, obbmax.y, obbmax.z)),
1704 une = e:LocalToWorld(Vector(obbmax.x, obbmax.y, obbmax.z)),
1705 }
1706
1707 local obbmax = obbmax - Vector(offsets[5], offsets[3], offsets[1])
1708 local obbmin = obbmin + Vector(offsets[6], offsets[4], offsets[2])
1709
1710 DrawSimpleCorner(obvgrid.unw, obvgrid.lnw, obvgrid.usw, obvgrid.une, col )
1711 DrawSimpleCorner(obvgrid.une, obvgrid.lne, obvgrid.use, obvgrid.unw, col )
1712 DrawSimpleCorner(obvgrid.lnw, obvgrid.unw, obvgrid.lsw, obvgrid.lne, col )
1713 DrawSimpleCorner(obvgrid.lne, obvgrid.une, obvgrid.lse, obvgrid.lnw, col )
1714 DrawSimpleCorner(obvgrid.usw, obvgrid.lsw, obvgrid.unw, obvgrid.use, col )
1715 DrawSimpleCorner(obvgrid.use, obvgrid.lse, obvgrid.une, obvgrid.usw, col )
1716 DrawSimpleCorner(obvgrid.lsw, obvgrid.usw, obvgrid.lnw, obvgrid.lse, col )
1717 DrawSimpleCorner(obvgrid.lse, obvgrid.use, obvgrid.lne, obvgrid.lsw, col )
1718end
1719
1720/*----------------------------------------
1721 Skeleton hax
1722 Desc: Hax
1723*/----------------------------------------
1724local skeleton = {
1725 // Main body
1726 { S = "ValveBiped.Bip01_Head1", E = "ValveBiped.Bip01_Neck1" },
1727 { S = "ValveBiped.Bip01_Neck1", E = "ValveBiped.Bip01_Spine4" },
1728 { S = "ValveBiped.Bip01_Spine4", E = "ValveBiped.Bip01_Spine2" },
1729 { S = "ValveBiped.Bip01_Spine2", E = "ValveBiped.Bip01_Spine1" },
1730 { S = "ValveBiped.Bip01_Spine1", E = "ValveBiped.Bip01_Spine" },
1731 { S = "ValveBiped.Bip01_Spine", E = "ValveBiped.Bip01_Pelvis" },
1732
1733 // Left Arm
1734 { S = "ValveBiped.Bip01_Spine2", E = "ValveBiped.Bip01_L_UpperArm" },
1735 { S = "ValveBiped.Bip01_L_UpperArm", E = "ValveBiped.Bip01_L_Forearm" },
1736 { S = "ValveBiped.Bip01_L_Forearm", E = "ValveBiped.Bip01_L_Hand" },
1737
1738 // Right Arm
1739 { S = "ValveBiped.Bip01_Spine2", E = "ValveBiped.Bip01_R_UpperArm" },
1740 { S = "ValveBiped.Bip01_R_UpperArm", E = "ValveBiped.Bip01_R_Forearm" },
1741 { S = "ValveBiped.Bip01_R_Forearm", E = "ValveBiped.Bip01_R_Hand" },
1742
1743 // Left leg
1744 { S = "ValveBiped.Bip01_Pelvis", E = "ValveBiped.Bip01_L_Thigh" },
1745 { S = "ValveBiped.Bip01_L_Thigh", E = "ValveBiped.Bip01_L_Calf" },
1746 { S = "ValveBiped.Bip01_L_Calf", E = "ValveBiped.Bip01_L_Foot" },
1747 { S = "ValveBiped.Bip01_L_Foot", E = "ValveBiped.Bip01_L_Toe0" },
1748
1749 // Right leg
1750 { S = "ValveBiped.Bip01_Pelvis", E = "ValveBiped.Bip01_R_Thigh" },
1751 { S = "ValveBiped.Bip01_R_Thigh", E = "ValveBiped.Bip01_R_Calf" },
1752 { S = "ValveBiped.Bip01_R_Calf", E = "ValveBiped.Bip01_R_Foot" },
1753 { S = "ValveBiped.Bip01_R_Foot", E = "ValveBiped.Bip01_R_Toe0" },
1754}
1755
1756function Hermes:Skeleton( e )
1757 if ( !Hermes.features['skeleton'] ) then return end
1758 if ( !e:IsPlayer() ) then return end
1759
1760 for k, v in pairs( skeleton ) do
1761 local sPos, ePos = e:GetBonePosition( e:LookupBone( v.S ) ):ToScreen(), e:GetBonePosition( e:LookupBone( v.E ) ):ToScreen()
1762
1763 local col
1764 if ( Hermes:Visible( e ) ) then
1765 col = Hermes:GetColor( "skeletonvis" )
1766 else
1767 col = Hermes:GetColor( "skeletonnovis" )
1768 end
1769
1770 surface.SetDrawColor( col )
1771 surface.DrawLine( sPos.x, sPos.y, ePos.x, ePos.y )
1772 end
1773end
1774
1775/*----------------------------------------
1776 On Screen
1777 Desc: Make sure all entities are on screen.
1778*/----------------------------------------
1779function Hermes:OnScreen( e )
1780 local x, y = ScrW(), ScrH()
1781 local posTypes = { "OBBCenter", "OBBMaxs", "OBBMins" }
1782
1783 for k, v in pairs( posTypes ) do
1784 local pos = e:LocalToWorld( _R.Entity[ v ]( e ) ):ToScreen()
1785 if ( pos.x > 0 && pos.y > 0 && pos.x < x && pos.y < y ) then
1786 return true
1787 end
1788 end
1789 return false
1790end
1791
1792/*----------------------------------------
1793 Ragdolls & Vehicles
1794 Desc: All the ragdolls and vehicles in a map.
1795*/----------------------------------------
1796local function IsRagdoll( e )
1797 if ( ( e:GetClass() == "prop_ragdoll" ) || ( e:GetClass() == "class C_ClientRagdoll" ) || ( e:GetClass() == "class C_HL2MPRagdoll" ) ) then
1798 return true
1799 end
1800 return false
1801end
1802
1803local function IsVehicle( e )
1804 if ( string.find( e:GetClass(), "prop_vehicle_" ) != nil ) then
1805 return true
1806 end
1807 return false
1808end
1809
1810/*----------------------------------------
1811 Filter/Colors
1812 Desc: Entity filters and colors.
1813*/----------------------------------------
1814local function ExtraEntities( e )
1815 local class = e:GetClass()
1816 if ( e:GetClass() == "ttt_c4" ) then return true end
1817 if ( ( e.Base || "" ) == "ttt_basegrenade_proj" ) then return true end
1818 return false
1819end
1820
1821function Hermes:SimpleTrace()
1822
1823 local ply = LocalPlayer()
1824 local s, e = ply:GetShootPos(), ply:GetAimVector()
1825 local t = {}
1826 t.start = s
1827 t.endpos = s + ( e * 16384 )
1828 t.filter = { ply }
1829 return util.TraceLine( t )
1830end
1831
1832function Hermes:ValidTarget( e, use )
1833 if ( !ValidEntity( e ) ) then return false end
1834 local ply, model = LocalPlayer(), string.lower( e:GetModel() || "" )
1835
1836 if ( use == "esp" ) then
1837 if ( !e:IsPlayer() && !e:IsNPC() && !e:IsWeapon() && !Hermes.EntityListItem( e ) && !IsRagdoll( e ) && !IsVehicle( e ) && !ExtraEntities( e ) || e == ply ) then return false end
1838 if ( e:IsPlayer() ) then
1839 if ( Hermes.cmds.IsDormant( e:EntIndex() ) ) then return false end
1840 if ( !e:Alive() || ( e:Health() < 0 ) ) then return false end
1841 if ( e:GetMoveType() == MOVETYPE_OBSERVER || e:GetMoveType() == MOVETYPE_NONE ) then return false end
1842 if ( e:Team() == ply:Team() && Hermes.features['enemyonly'] ) then return false end
1843 if ( string.find( string.lower( team.GetName( e:Team() ) ), "spec" ) ) then return false end
1844 end
1845 if ( e:IsNPC() ) then
1846 if ( e:GetMoveType() == MOVETYPE_NONE || table.HasValue( Hermes.deathsequences[ model ] || {}, e:GetSequence() ) ) then return false end
1847 end
1848 if ( e:IsWeapon() && e:GetMoveType() == MOVETYPE_NONE ) then return false end
1849 if ( IsRagdoll( e ) && !Hermes.features['ragdollse'] ) then return false end
1850 if ( IsVehicle( e ) && !Hermes.features['vehiclese'] ) then return false end
1851 if ( Hermes.EntityListItem( e ) && !Hermes.features['entityliste'] ) then return false end
1852 if ( !Hermes:OnScreen( e ) ) then return false end
1853 return true
1854 elseif ( use == "chams" ) then
1855 if ( !e:IsPlayer() && !e:IsNPC() && !e:IsWeapon() && !IsRagdoll( e ) || e == ply ) then return false end
1856 if ( e:IsPlayer() && Hermes.cmds.IsDormant( e:EntIndex() ) ) then return false end
1857 if ( e:IsPlayer() ) then
1858 if ( !e:Alive() || ( e:Health() < 0 ) ) then return false end
1859 if ( e:GetMoveType() == MOVETYPE_OBSERVER || e:GetMoveType() == MOVETYPE_NONE ) then return false end
1860 if ( e:Team() == ply:Team() && Hermes.features['enemyonly'] ) then return false end
1861 if ( string.find( string.lower( team.GetName( e:Team() ) ), "spec" ) ) then return false end
1862 end
1863 if ( e:IsNPC() ) then
1864 if ( e:GetMoveType() == MOVETYPE_NONE || table.HasValue( Hermes.deathsequences[ model ] || {}, e:GetSequence() ) ) then return false end
1865 end
1866 if ( e:IsWeapon() && e:GetMoveType() != MOVETYPE_NONE ) then return false end
1867 if ( IsRagdoll( e ) && !Hermes.features['ragdollse'] ) then return false end
1868 if ( !Hermes:OnScreen( e ) ) then return false end
1869 return true
1870 elseif ( use == "aim" ) then
1871 if ( !e:IsPlayer() && !e:IsNPC() || e == ply ) then return false end
1872 if ( e:IsPlayer() && Hermes.cmds.IsDormant( e:EntIndex() ) ) then return false end
1873 if ( e:IsPlayer() ) then
1874 if ( !e:Alive() || ( e:Health() < 0 ) ) then return false end
1875 if ( e:IsPlayer() && !Hermes.features['targetplayer'] ) then return false end
1876 if ( e:Team() == ply:Team() && Hermes.features['ignoreteam'] ) then return false end
1877 if ( e:IsAdmin() && Hermes.features['ignoreadmin'] ) then return false end
1878 if ( e:GetFriendStatus() == "friend" && Hermes.features['ignoresteam'] ) then return false end
1879 if ( e:InVehicle() && Hermes.features['ignorevehicle'] ) then return false end
1880 if ( table.HasValue( Hermes.friends, AddType( e ) ) && Hermes.features['friendslist'] ) then return false end
1881 if ( e:GetMoveType() == MOVETYPE_OBSERVER || e:GetMoveType() == MOVETYPE_NONE ) then return false end
1882 if ( string.find( string.lower( team.GetName( e:Team() ) ), "spec" ) ) then return false end
1883 if ( Hermes:IsTroubleInTerroristTown() && Hermes.IsTraitor( e ) && ( ply.IsTraitor && ply:IsTraitor() ) && Hermes.features['ignoretraitor'] ) then return false end
1884 end
1885 if ( e:IsNPC() ) then
1886 if ( e:GetMoveType() == MOVETYPE_NONE || table.HasValue( Hermes.deathsequences[ model ] || {}, e:GetSequence() ) ) then return false end
1887 end
1888 if ( tonumber( Hermes.features.fov ) != 180 ) then
1889 local myang = ply:GetAngles()
1890 local ang = ( e:GetPos() - ply:GetShootPos() ):Angle()
1891 local angY = math.abs( math.NormalizeAngle( myang.y - ang.y ) )
1892 local angP = math.abs( math.NormalizeAngle( myang.p - ang.p ) )
1893
1894 if ( angY > tonumber( Hermes.features.fov ) || angP > tonumber( Hermes.features.fov ) ) then return false end
1895 end
1896 return true
1897 elseif ( use == "radar" ) then
1898 if ( !e:IsPlayer() && !e:IsNPC() || e == ply ) then return false end
1899 if ( e:IsPlayer() ) then
1900 if ( !e:Alive() || ( e:Health() < 0 ) ) then return false end
1901 if ( e:GetMoveType() == MOVETYPE_OBSERVER || e:GetMoveType() == MOVETYPE_NONE ) then return false end
1902 if ( e:Team() == ply:Team() && Hermes.features['enemyonly'] ) then return false end
1903 if ( string.find( string.lower( team.GetName( e:Team() ) ), "spec" ) ) then return false end
1904 end
1905 if ( e:IsNPC() ) then
1906 if ( e:GetMoveType() == MOVETYPE_NONE || table.HasValue( Hermes.deathsequences[ model ] || {}, e:GetSequence() ) ) then return false end
1907 end
1908 return true
1909 end
1910 return false
1911end
1912
1913function Hermes:Visible( e )
1914 local ply = LocalPlayer()
1915
1916 local trace = { start = ply:GetShootPos(), endpos = e:EyePos(), filter = { ply, e }, mask = MASK_SHOT + CONTENTS_WINDOW }
1917 local tr = util.TraceLine( trace )
1918
1919 if ( tr.Fraction == 1 ) then
1920 return true
1921 end
1922 return false
1923end
1924
1925function Hermes:FilterColors( e )
1926 local ply = LocalPlayer()
1927 local col, isEnemy
1928
1929 if( Hermes.features['teamcolor'] && e:IsPlayer() ) then
1930 return team.GetColor( e:Team() ) || Color( color_white )
1931 end
1932
1933 if ( !e:IsWeapon() || Hermes.EntityListItem( e ) ) then
1934 if ( !e:IsPlayer() ) then
1935 if ( IsEnemyEntityName( e:GetClass() ) || ( e:GetClass() == "npc_metropolice" ) || Hermes.IsTraitor( e ) ) then
1936 isEnemy = true
1937 end
1938 else
1939 if ( ply:Team() != e:Team() || ( IsTraitor( e ) ) ) then
1940 isEnemy = true
1941 end
1942 end
1943 end
1944
1945 if ( !isEnemy && ( !e:IsWeapon() || Hermes.EntityListItem( e ) ) ) then
1946 if ( Hermes:Visible( e ) ) then
1947 col = Hermes:GetColor( "allieespvis" )
1948 else
1949 col = Hermes:GetColor( "allieespnovis" )
1950 end
1951 else
1952 if ( Hermes:Visible( e ) ) then
1953 col = Hermes:GetColor( "enemyespvis" )
1954 else
1955 col = Hermes:GetColor( "enemyespnovis" )
1956 end
1957 end
1958 if ( e:IsWeapon() || IsRagdoll( e ) || IsVehicle( e ) || Hermes.EntityListItem( e ) ) then
1959 if ( Hermes:Visible( e ) ) then
1960 col = Hermes:GetColor( "entityespvis" )
1961 else
1962 col = Hermes:GetColor( "entityespnovis" )
1963 end
1964 end
1965 return col
1966end
1967
1968/*----------------------------------------
1969 Autowall
1970 Desc: haqure
1971*/----------------------------------------
1972/*
1973local function VectorLength( vec )
1974 return ( vec['x'] * vec['x'] + vec['y'] * vec['y'] + vec['z'] * vec['z'] )
1975end
1976
1977local function PredictWall( tstart, tend, tdir, hitdis, ignore, tr )
1978 -- math skillz omg
1979 tdir['x'] = tend['x'] - tstart['x']
1980 tdir['y'] = tend['y'] - tstart['y']
1981 tdir['z'] = tend['z'] - tstart['z']
1982
1983 local length = VectorLength( vec )
1984 tdir['x'] = tdir['x'] / length
1985 tdir['y'] = tdir['y'] / length
1986 tdir['z'] = tdir['z'] / length
1987
1988 tend['x'] = tdir['x'] * hitdis + tstart['x']
1989 tend['y'] = tdir['y'] * hitdis + tstart['y']
1990 tend['z'] = tdir['z'] * hitdis + tstart['z']
1991
1992 local length1, length2
1993
1994 if( tstart['x'] == tend['x'] && tstart['y'] == tend['y'] && tstart['z'] == tend['z'] ) then
1995 tr.endpos = Vector( tend['x'], tend['y'], tend['z'] )
1996 return
1997 end
1998
1999
2000end
2001
2002local function MadCow( bouncenum, attacker, tr, dmginfo, isplayer )
2003 local max - 16
2004 if w.Primary.Ammo == "AirboatGun" then
2005 max = 18
2006 elseif w.Primary.Ammo == "Gravity" then
2007 max = 8
2008 elseif w.Primary.Ammo == "AlyxGun" then
2009 max = 12
2010 elseif w.Primary.Ammo == "Battery" then
2011 max = 14
2012 elseif w.Primary.Ammo == "StriderMinigun" then
2013 max = 20
2014 elseif w.Primary.Ammo == "SniperPenetratedRound" then
2015 max = 16
2016 elseif w.Primary.Ammo == "CombineCannon" then
2017 max = 20
2018 end
2019
2020 if ((tr.MatType == MAT_METAL and self.Ricochet) or (tr.MatType == MAT_SAND) or (tr.Entity:IsPlayer())) then return false end
2021
2022 local PenetrationDirection = tr.Normal * MaxPenetration
2023
2024 if (tr.MatType == MAT_GLASS or tr.MatType == MAT_PLASTIC or tr.MatType == MAT_WOOD or tr.MatType == MAT_FLESH or tr.MatType == MAT_ALIENFLESH) then
2025 PenetrationDirection = tr.Normal * (MaxPenetration * 2)
2026 end
2027end
2028
2029function Hermes:Autowall()
2030 local ply, dmg = LocalPlayer(), nil
2031
2032 local w = ply:GetActiveWeapon()
2033 if ( w && w:IsValid() ) then
2034 if ( w.Base == "weapon_mad_base" ) then
2035 if ( Hermes.Bullet[ w:GetClass() ] ) then
2036 local tbl = Hermes.Bullet[ w:GetClass() ]
2037 dmg = tbl.Damage || nil
2038 end
2039 end
2040 end
2041end
2042*/
2043/*----------------------------------------
2044 Autopistol
2045 Desc: Automaticly shoot.
2046*/----------------------------------------
2047local shoot = false
2048function Hermes:Auto()
2049 if ( Hermes:IsTroubleInTerroristTown() ) then return false end
2050 local ply, weps = LocalPlayer(), { "gmod_tool", "weapon_pistol" }
2051
2052 if ( !ply:KeyDown( IN_ATTACK ) ) then return end
2053
2054 local w = ply:GetActiveWeapon()
2055 if ( w && w:IsValid() ) then
2056 if ( table.HasValue( weps, w:GetClass() ) ) then
2057 return true
2058 elseif ( w.Primary && !w.Primary.Automatic ) then
2059 return true
2060 end
2061 end
2062 return false
2063end
2064
2065function Hermes.Autopistol()
2066 local ply = LocalPlayer()
2067
2068 if ( Hermes.features['autopistol'] && Hermes:Auto() ) then
2069 if ( shoot ) then
2070 Hermes.cmds.RunCommand( "+attack" )
2071 shoot = false
2072 elseif ( !shoot ) then
2073 Hermes.cmds.RunCommand( "-attack" )
2074 shoot = true
2075 end
2076 elseif ( Hermes.features['autopistol'] && !input.IsMouseDown( MOUSE_LEFT ) ) then
2077 if ( !shoot ) then
2078 Hermes.cmds.RunCommand( "-attack" )
2079 shoot = true
2080 end
2081 end
2082end
2083
2084/*----------------------------------------
2085 Bunnyhop
2086 Desc: Endless jump when using holding down the spacebar.
2087*/----------------------------------------
2088function Hermes.Bunnyhop( ucmd )
2089 local ply = LocalPlayer()
2090 if ( Hermes.features['bunnyhop'] && ucmd:KeyDown( IN_JUMP ) ) then
2091 if ( !ply:OnGround() ) then
2092 ucmd:SetButtons( ucmd:GetButtons() - IN_JUMP )
2093 end
2094 end
2095end
2096
2097/*----------------------------------------
2098 Anti-aim
2099 Desc: Avoid aimbots kinda.
2100*/----------------------------------------
2101Hermes.SetViewAngles = _R["CUserCmd"].SetViewAngles
2102
2103function Hermes.AntiAim( ucmd )
2104 local ply = LocalPlayer()
2105 if ( ucmd:GetButtons() & ( IN_ATTACK | IN_ATTACK2 ) != 0 ) then return end
2106 if ( !ply:Alive() ) then return end
2107 if ( Hermes.features['antiaim'] || Hermes.features['antiaimduck'] ) then
2108 local view = Hermes.set.angles
2109
2110 local angles = Angle( 0, 0, 0 )
2111
2112 if ( Hermes.features['antiaimduck'] && ( ucmd:GetButtons() & IN_JUMP == 0 ) ) then
2113 //Hermes.cmds.RunCommand( "+duck" )
2114 //timer.Simple( 0.1, function() Hermes.cmds.RunCommand( "-duck" ) end )
2115 end
2116
2117 if ( Hermes.features['antiaim'] && Hermes.features['antiaimrandom'] ) then
2118 angles = Angle(
2119 math.random( 0, tonumber( Hermes.features['antiaimp'] ) ),
2120 math.random( 0, tonumber( Hermes.features['antiaimy'] ) ),
2121 math.random( 0, tonumber( Hermes.features['antiaimr'] ) )
2122 )
2123 ucmd:SetViewAngles( angles )
2124 end
2125
2126 if ( Hermes.features['antiaim'] && !Hermes.features['antiaimrandom'] ) then
2127 angles = Angle(
2128 view['p'] + tonumber( Hermes.features['antiaimp'] ),
2129 view['y'] + tonumber( Hermes.features['antiaimy'] ),
2130 view['r'] + tonumber( Hermes.features['antiaimr'] )
2131 )
2132 ucmd:SetViewAngles( angles )
2133 end
2134
2135 if ( Hermes.features['antiaim'] ) then
2136 // Set movement to view
2137 local m = Vector( ucmd:GetForwardMove(), ucmd:GetSideMove(), 0 )
2138 local n = m:GetNormal()
2139 local a = ( m:Angle() + ( angles - Hermes.set.angles ) ):Forward() * m:Length()
2140
2141 ucmd:SetForwardMove( a.x )
2142 ucmd:SetSideMove( a.y )
2143 end
2144 end
2145end
2146
2147/*----------------------------------------
2148 Aimbot
2149 Desc: It's really old to move your finger.
2150*/----------------------------------------
2151Hermes.zoom = 0
2152Hermes.zooming = false
2153Hermes.zoomspeed = tonumber( Hermes.features['zoomamount'] )
2154
2155Hermes.modelbones = {
2156 { Model = "models/crow.mdl", Pos = Vector( 0, 0, -2 ) },
2157 { Model = "models/pigeon.mdl", Pos = Vector( 0, 0, -2 ) },
2158 { Model = "models/seagull.mdl", Pos = Vector( 0, 0, -2 ) },
2159 { Model = "models/error.mdl", Pos = Vector( 0, 0, 20 ) },
2160 { Model = "models/combine_scanner.mdl", Pos = "Scanner.Body" },
2161 { Model = "models/hunter.mdl", Pos = "MiniStrider.body_joint" },
2162 { Model = "models/combine_turrets/floor_turret.mdl", Pos = "Barrel" },
2163 { Model = "models/dog.mdl", Pos = "Dog_Model.Eye" },
2164 { Model = "models/vortigaunt.mdl", Pos = "ValveBiped.Head" },
2165 { Model = "models/antlion.mdl", Pos = "Antlion.Body_Bone" },
2166 { Model = "models/antlion_guard.mdl", Pos = "Antlion_Guard.Body" },
2167 { Model = "models/antlion_worker.mdl", Pos = "Antlion.Head_Bone" },
2168 { Model = "models/zombie/fast_torso.mdl", Pos = "ValveBiped.HC_BodyCube" },
2169 { Model = "models/zombie/fast.mdl", Pos = "ValveBiped.HC_BodyCube" },
2170 { Model = "models/headcrabclassic.mdl", Pos = "HeadcrabClassic.SpineControl" },
2171 { Model = "models/headcrabblack.mdl", Pos = "HCBlack.body" },
2172 { Model = "models/headcrab.mdl", Pos = "HCFast.body" },
2173 { Model = "models/zombie/poison.mdl", Pos = "ValveBiped.Headcrab_Cube1" },
2174 { Model = "models/zombie/classic.mdl", Pos = "ValveBiped.HC_Body_Bone" },
2175 { Model = "models/zombie/classic_torso.mdl", Pos = "ValveBiped.HC_Body_Bone" },
2176 { Model = "models/zombie/zombie_soldier.mdl", Pos = "ValveBiped.HC_Body_Bone" },
2177 { Model = "models/combine_strider.mdl", Pos = "Combine_Strider.Body_Bone" },
2178 { Model = "models/combine_dropship.mdl", Pos = "D_ship.Spine1" },
2179 { Model = "models/combine_helicopter.mdl", Pos = "Chopper.Body" },
2180 { Model = "models/gunship.mdl", Pos = "Gunship.Body" },
2181 { Model = "models/lamarr.mdl", Pos = "HeadcrabClassic.SpineControl" },
2182 { Model = "models/mortarsynth.mdl", Pos = "Root Bone" },
2183 { Model = "models/synth.mdl", Pos = "Bip02 Spine1" },
2184 { Model = "mmodels/vortigaunt_slave.mdl", Pos = "ValveBiped.Head" },
2185}
2186
2187Hermes.bonescan = {
2188 { Bone = "ValveBiped.Bip01_Head1", Priority = 1 },
2189 { Bone = "ValveBiped.Bip01_Neck1", Priority = 2 },
2190 { Bone = "ValveBiped.Bip01_Spine4", Priority = 3 },
2191 { Bone = "ValveBiped.Bip01_Spine2", Priority = 4 },
2192 { Bone = "ValveBiped.Bip01_Spine1", Priority = 5 },
2193 { Bone = "ValveBiped.Bip01_Spine", Priority = 6 },
2194 { Bone = "ValveBiped.Bip01_R_UpperArm", Priority = 7 },
2195 { Bone = "ValveBiped.Bip01_R_Forearm", Priority = 8 },
2196 { Bone = "ValveBiped.Bip01_R_Hand", Priority = 9 },
2197 { Bone = "ValveBiped.Bip01_L_UpperArm", Priority = 7 },
2198 { Bone = "ValveBiped.Bip01_L_Forearm", Priority = 8 },
2199 { Bone = "ValveBiped.Bip01_L_Hand", Priority = 9 },
2200 { Bone = "ValveBiped.Bip01_R_Thigh", Priority = 10 },
2201 { Bone = "ValveBiped.Bip01_R_Calf", Priority = 11 },
2202 { Bone = "ValveBiped.Bip01_R_Foot", Priority = 12 },
2203 { Bone = "ValveBiped.Bip01_R_Toe0", Priority = 13 },
2204 { Bone = "ValveBiped.Bip01_L_Thigh", Priority = 10 },
2205 { Bone = "ValveBiped.Bip01_L_Calf", Priority = 11 },
2206 { Bone = "ValveBiped.Bip01_L_Foot", Priority = 12 },
2207 { Bone = "ValveBiped.Bip01_L_Toe0", Priority = 13 }
2208}
2209
2210Hermes.predictweapons = {
2211 ["weapon_crossbow"] = 3110,
2212}
2213
2214-- Prediction
2215function Hermes:WeaponPrediction( e, pos )
2216 local ply = LocalPlayer()
2217 if ( ValidEntity( e ) && ( type( e:GetVelocity() ) == "Vector" ) ) then
2218 local dis, wep = e:GetPos():Distance( ply:GetPos() ), ( ply.GetActiveWeapon && ValidEntity( ply:GetActiveWeapon() ) && ply:GetActiveWeapon():GetClass() )
2219 if ( wep && Hermes.predictweapons[ wep ] ) then
2220 local t = dis / Hermes.predictweapons[ wep ]
2221 return ( pos + e:GetVelocity() * t )
2222 end
2223 return pos
2224 end
2225 return pos
2226end
2227
2228-- Get pos depending on it being a string or vector.
2229function Hermes:GetPos( e, pos )
2230 if ( type( pos ) == "string" ) then
2231 return ( e:GetBonePosition( e:LookupBone( pos ) ) )
2232 elseif ( type( pos ) == "Vector" ) then
2233 return ( e:LocalToWorld( e:OBBCenter() + pos ) )
2234 end
2235 return ( e:LocalToWorld( pos ) )
2236end
2237
2238local function ToWorld( e, ang )
2239 local ply = LocalPlayer()
2240 /*if ( type( ang ) == "Vector" ) then print( "already a v3ct0r" ) return ang end
2241 local max, min = e:LocalToWorld( e:OBBMaxs() ) + ang, e:LocalToWorld( e:OBBMins() ) + ang
2242 local angl = ( max - min )
2243 return angl*/
2244 return ang
2245end
2246-- Location to aim at
2247local curBone = 0
2248function Hermes:TargetLocation( e, use )
2249 local pos = e:LocalToWorld( e:OBBCenter() )
2250
2251 pos = Hermes:GetPos( e, "ValveBiped.Bip01_Head1" )
2252
2253 local usingAttachments = false
2254 if ( tonumber( Hermes.features['aimtype'] ) != 2 ) then
2255 if ( e:GetAttachment( e:LookupAttachment( "eyes" ) ) ) then
2256 pos = e:GetAttachment( e:LookupAttachment( "eyes" ) ).Pos;
2257 usingAttachments = true
2258 elseif ( e:GetAttachment( e:LookupAttachment( "forward" ) ) ) then
2259 pos = e:GetAttachment( e:LookupAttachment("forward") ).Pos;
2260 usingAttachments = true
2261 elseif ( e:GetAttachment( e:LookupAttachment( "head" ) ) ) then
2262 pos = e:GetAttachment( e:LookupAttachment( "head" ) ).Pos;
2263 usingAttachments = true
2264 else
2265 pos = Hermes:GetPos( e, "ValveBiped.Bip01_Head1" );
2266 usingAttachments = false
2267 end
2268 end
2269
2270 if ( !usingAttachments ) then
2271 for k, v in pairs( Hermes.modelbones ) do
2272 if ( v.Model == e:GetModel() ) then
2273 pos = Hermes:GetPos( e, v.Pos )
2274 end
2275 end
2276 end
2277
2278 if ( !use ) then
2279 if ( tonumber( Hermes.features['aimtype'] ) == 3 ) then
2280 pos = e:GetPos()
2281 end
2282
2283 if ( tonumber( Hermes.features['aimtype'] ) == 4 ) then
2284 pos = e:LocalToWorld( e:OBBCenter() )
2285 end
2286
2287 pos = pos + Vector( 0, 0, tonumber( Hermes.features['offset'] ) )
2288 return ToWorld( e, Hermes:WeaponPrediction( e, pos ) )//Hermes:WeaponPrediction( e, pos )
2289 end
2290 return ToWorld( e, pos )
2291end
2292
2293-- Create a trace
2294function Hermes:Trace( ucmd )
2295 local ply = LocalPlayer()
2296 local start, endP = ply:GetShootPos(), ply:GetAimVector()
2297
2298 if ( Hermes.features['triggernospread'] ) then
2299 local angs = Hermes.Nospread( ucmd, Hermes.features['norecoil'] && Hermes.set.angles || ucmd:GetViewAngles(), true )
2300 local trace = {}
2301 trace.start = start
2302 trace.endpos = trace.start + ( angs:Forward() * 8192 )
2303 trace.filter = ply
2304 trace.mask = MASK_SHOT
2305 return util.TraceLine( trace )
2306 else
2307 local trace = {}
2308 trace.start = start
2309 trace.endpos = start + ( endP * 16384 )
2310 trace.filter = { ply }
2311 trace.mask = MASK_SHOT
2312 return util.TraceLine( trace )
2313 end
2314 return nil
2315end
2316
2317-- Prediction
2318function Hermes.Prediction( tar, compensate )
2319 if ( tonumber( Hermes.features['prediction'] ) == 1 ) then return compensate end
2320 local ply = LocalPlayer()
2321 local tarComp, plyComp = tonumber( Hermes.features['predicttar'] ), tonumber( Hermes.features['predictply'] )
2322
2323 if ( tonumber( Hermes.features['prediction'] ) == 2 ) then
2324 compensate = compensate + ( tar:GetVelocity() / tarComp - ply:GetVelocity() / plyComp )
2325 elseif( tonumber( Hermes.features['prediction'] ) == 3 ) then
2326 local tarFrames, plyFrames = ( RealFrameTime() / tarComp ), ( RealFrameTime() / plyComp )
2327 compensate = compensate + ( ( tar:GetVelocity() * ( tarFrames ) ) - ( ply:GetVelocity() * ( plyFrames ) ) )
2328 elseif( tonumber( Hermes.features['prediction'] ) == 4 ) then
2329 compensate = compensate + ( tar:GetVelocity() * ( tarComp / tar:GetVelocity():Length() ) ) - ( ply:GetVelocity() * ( plyComp / ply:GetVelocity():Length() ) )
2330 elseif( tonumber( Hermes.features['prediction'] ) == 5 ) then
2331 compensate = compensate + ( tar:GetVelocity() * ( 1 / tarComp ) - ply:GetVelocity() * ( 1 / plyComp ) ) --stggs's prediction
2332 end
2333 return compensate
2334end
2335
2336-- Create a trace
2337function Hermes:TargetVisible( e )
2338 //if ( Hermes:Autowall() ) then return true end
2339 if ( !Hermes.features['loscheck'] ) then return true end
2340 local ply = LocalPlayer()
2341
2342 local pos = Hermes:TargetLocation( e )
2343 pos = Hermes.Prediction( e, pos )
2344
2345 local trace = {
2346 start = ply:GetShootPos(),
2347 endpos = pos,
2348 filter = { ply, e },
2349 mask = MASK_SHOT + CONTENTS_WINDOW
2350 }
2351 local tr = util.TraceLine( trace )
2352
2353 if ( !tr.Hit ) then
2354 return true
2355 end
2356 return false
2357end
2358
2359-- Get all valid targets
2360function Hermes:GetTargets()
2361 local ply, ent = LocalPlayer(), nil
2362 ent = Hermes.features.targetnpc == true && Hermes.worldents.entities || Hermes.worldents.players
2363
2364 local targets = {}
2365 for i = 1, table.Count( ent ) do
2366 local e = ent[i]
2367 if ( Hermes:ValidTarget( e, "aim" ) ) then
2368 if ( Hermes:TargetVisible( e ) ) then
2369 table.insert( targets, e )
2370 end
2371 end
2372 end
2373 return targets
2374end
2375
2376-- Find best target
2377local disAim = false
2378function Hermes:GetTarget()
2379 local x, y = ScrW(), ScrH()
2380
2381 if ( Hermes.features['disableafterkill'] || Hermes.features['holdtarget'] ) then
2382 if ( Hermes.set.tar && ValidEntity( Hermes.set.tar ) ) then
2383 if ( Hermes.set.tar && Hermes.set.tar != ply ) then
2384 if ( Hermes.set.tar:IsPlayer() && !Hermes.set.tar:Alive() || Hermes.set.tar:GetMoveType() == MOVETYPE_NONE ) then
2385 if ( Hermes.features['disableafterkill'] ) then
2386 Hermes.set.tar = ply
2387 Hermes.set.aiming = false
2388 disAim = true
2389 end
2390 if ( Hermes.features['holdtarget'] ) then
2391 return Hermes.set.tar
2392 end
2393 end
2394 end
2395 end
2396 end
2397
2398 local ply, targets = LocalPlayer(), Hermes:GetTargets()
2399 if ( table.Count( targets ) == 0 ) then return end
2400
2401 Hermes.set.tar = ply
2402 for i = 1, table.Count( targets ) do
2403 local e = targets[i]
2404 local ePos, oldPos, myAngV = e:EyePos():ToScreen(), Hermes.set.tar:EyePos():ToScreen(), ply:GetAngles()
2405
2406 local angA, angB = 0
2407 if ( tonumber( Hermes.features['aimmode'] ) == 1 ) then
2408 angA = math.Dist( x / 2, y / 2, oldPos.x, oldPos.y )
2409 angB = math.Dist( x / 2, y / 2, ePos.x, ePos.y )
2410 elseif ( tonumber( Hermes.features['aimmode'] ) == 2 ) then
2411 angA = Hermes.set.tar:EyePos():Distance( ply:EyePos() )
2412 angB = e:EyePos():Distance( ply:EyePos() )
2413 elseif ( tonumber( Hermes.features['aimmode'] ) == 3 ) then
2414 angA = Hermes.set.tar:Health()
2415 angB = e:Health()
2416 end
2417
2418 if ( angB <= angA ) then
2419 Hermes.set.tar = e
2420 elseif ( Hermes.set.tar == ply ) then
2421 Hermes.set.tar = e
2422 end
2423
2424 if ( Hermes.features['velocitychecks'] && Hermes.set.tar:GetVelocity():Length() == 0 && e:GetVelocity():Length() != 0 && !Hermes.features['holdtarget'] ) then
2425 Hermes.set.tar = e
2426 end
2427 end
2428 return Hermes.set.tar
2429end
2430
2431-- Triggerbot
2432function Hermes.Triggerbot( ucmd )
2433 local ply = LocalPlayer()
2434 if ( Hermes.features['triggerbot'] ) then
2435 if ( Hermes.features['triggerkey'] && !Hermes.set.trigger ) then return end
2436 local t = Hermes:Trace( ucmd )
2437
2438 if ( Hermes:ValidTarget( t.Entity, "aim" ) ) then
2439
2440 local pos = ply:GetPos():Distance( t.Entity:GetPos() ) / 4
2441 if ( ( tonumber( Hermes.features['triggerdistance'] ) > pos ) || ( tonumber( Hermes.features['triggerdistance'] ) == 0 ) ) then
2442 if ( Hermes.features['triggernospread'] ) then
2443 if ( t.Hit && t.HitNonWorld ) then
2444 ucmd:SetButtons( ucmd:GetButtons() | IN_ATTACK )
2445 timer.Simple( 0.05, function() Hermes.cmds.RunCommand( "-attack" ) end )
2446 end
2447 else
2448 ucmd:SetButtons( ucmd:GetButtons() | IN_ATTACK )
2449 timer.Simple( 0.05, function() Hermes.cmds.RunCommand( "-attack" ) end )
2450 end
2451 end
2452 end
2453 end
2454end
2455
2456-- Prop kill
2457Hermes.prop = {
2458 enable = false,
2459 thrown = false,
2460 ang = Angle( 0, 0, 0 ),
2461}
2462
2463function Hermes.PropKillScript( ucmd )
2464 if ( !Hermes.prop.enable && Hermes.prop.thrown ) then
2465 Hermes.prop.thrown = false
2466 ucmd:SetViewAngles( Hermes.prop.ang )
2467 elseif ( !Hermes.prop.enable ) then
2468 local real = Hermes.features['norecoil'] && Hermes.set.angles || ucmd:GetViewAngles()
2469 Hermes.prop.ang = real
2470 else
2471 local real = Hermes.features['norecoil'] && Hermes.set.angles || ucmd:GetViewAngles()
2472 Hermes.prop.ang = real
2473
2474 Hermes.prop.ang['y'] = real['y'] - 180
2475
2476 local move = Vector( ucmd:GetForwardMove(), ucmd:GetSideMove(), 0 )
2477 local norm = move:GetNormal()
2478 local set = ( norm:Angle() + ( Hermes.prop.ang - real ) ):Forward() * move:Length()
2479 ucmd:SetForwardMove( -set.x )
2480 ucmd:SetSideMove( -set.y )
2481 end
2482end
2483
2484-- Smoothaim
2485function Hermes.SmoothAngles( ang )
2486 if ( !Hermes.features['smoothaim'] ) then return Angle( ang.p, ang.y, ang.r ) end
2487 local ply = LocalPlayer()
2488 local p, y, r = ang.p, ang.y, ang.r
2489
2490 local curang = ply:EyeAngles()
2491 local speed = tonumber( Hermes.features['smoothaimspeed'] )
2492 local retangle = Angle( 0, 0, 0 )
2493
2494 retangle.p = math.Approach( math.NormalizeAngle( curang.p ), math.NormalizeAngle( p ), 10.1 - speed )
2495 retangle.y = math.Approach( math.NormalizeAngle( curang.y ), math.NormalizeAngle( y ), 10.1 - speed )
2496 retangle.r = 0
2497
2498 return Angle( retangle.p, retangle.y, retangle.r )
2499end
2500
2501-- Set view to EyeAngles
2502function Hermes.SetView()
2503 local ply = LocalPlayer()
2504 if ( !ValidEntity( ply ) ) then return end
2505 Hermes.set.angles = ply:EyeAngles()
2506end
2507Hermes:AddHook( "OnToggled", Hermes.SetView )
2508
2509-- Main aimbot function
2510function Hermes.Aim( ucmd )
2511 local ply = LocalPlayer()
2512
2513 Hermes.Bunnyhop( ucmd )
2514 Hermes.Triggerbot( ucmd )
2515 Hermes.Autopistol()
2516 if ( IsValid( ply:GetActiveWeapon() ) && ( ply:GetActiveWeapon():GetClass() == "weapon_physgun" ) && ( ucmd:GetButtons() & IN_USE ) > 0 ) then return end
2517
2518 Hermes.set.target = Hermes:GetTarget();
2519
2520 local correct = 1
2521 if ( Hermes.zoom != 0 ) then correct = ( 1 - ( Hermes.zoom / 100 ) ) end
2522 Hermes.set.angles.p = math.NormalizeAngle( Hermes.set.angles.p )
2523 Hermes.set.angles.y = math.NormalizeAngle( Hermes.set.angles.y )
2524
2525 Hermes.set.angles.y = math.NormalizeAngle( Hermes.set.angles.y + ( ucmd:GetMouseX() * -0.022 * correct ) )
2526 Hermes.set.angles.p = math.Clamp( Hermes.set.angles.p + ( ucmd:GetMouseY() * 0.022 * correct ), -89, 90 )
2527
2528 if ( Hermes.features['norecoil'] && !Hermes.set.aiming ) then
2529 ucmd:SetViewAngles( Hermes.set.angles )
2530 end
2531
2532 Hermes.set.fakeang = Hermes.set.angles
2533 if ( Hermes:NospreadVaild( ucmd ) ) then
2534 Hermes.set.fakeang = Hermes.Nospread( ucmd, Hermes.set.angles )
2535 Hermes.set.fakeang.p = math.NormalizeAngle( Hermes.set.fakeang.p )
2536 Hermes.set.fakeang.y = math.NormalizeAngle( Hermes.set.fakeang.y )
2537 ucmd:SetViewAngles( Hermes.set.fakeang )
2538 end
2539
2540
2541 Hermes.AntiAim( ucmd )
2542 Hermes.PropKillScript( ucmd )
2543
2544 if ( !Hermes.features['automaticaim'] && !Hermes.set.aiming ) then return end
2545 if ( !ply:Alive() ) then return end
2546 if ( Hermes.set.target == nil || Hermes.set.target == ply ) then return end
2547
2548 local tar = Hermes.set.target
2549 local compensate = Hermes:TargetLocation( tar )
2550 compensate = Hermes.Prediction( tar, compensate )
2551
2552 local angles = ""
2553 if ( Hermes.features['silentaim'] ) then
2554 local fake = ( compensate - ply:GetShootPos() ):Angle()
2555 fake = Hermes.SmoothAngles( fake )
2556 angles = Hermes:NospreadVaild( ucmd ) && Hermes.Nospread( ucmd, fake ) || fake
2557 else
2558 Hermes.set.angles = ( compensate - ply:GetShootPos() ):Angle()
2559 Hermes.set.angles = Hermes.SmoothAngles( Hermes.set.angles )
2560 angles = Hermes:NospreadVaild( ucmd ) && Hermes.Nospread( ucmd, Hermes.set.angles ) || Hermes.set.angles
2561 end
2562
2563 angles.p = math.NormalizeAngle( angles.p )
2564 angles.y = math.NormalizeAngle( angles.y )
2565 angles.r = 0
2566
2567 ucmd:SetViewAngles( angles )
2568
2569 if ( Hermes.features['silentaim'] ) then
2570 local move = Vector( ucmd:GetForwardMove(), ucmd:GetSideMove(), 0 )
2571 local norm = move:GetNormal()
2572 local set = ( norm:Angle() + ( angles - Hermes.set.angles ) ):Forward() * move:Length()
2573 ucmd:SetForwardMove( set.x )
2574 ucmd:SetSideMove( set.y )
2575 end
2576
2577 local w = ply:GetActiveWeapon()
2578 if ( Hermes.features['autoshoot'] && !Hermes.set['shooting'] ) then
2579 Hermes.cmds.RunCommand( "+attack" )
2580 Hermes.set['shooting'] = true
2581 timer.Simple( ( w && w.Primary ) && w.Primary.Delay || 0.05, function() Hermes.cmds.RunCommand( "-attack" ); Hermes.set['shooting'] = false end )
2582 end
2583end
2584
2585function Hermes.CreateMove( ucmd )
2586 Hermes.Aim( ucmd )
2587end
2588
2589Hermes:AddHook( "CreateMove", Hermes.CreateMove )
2590
2591-- Remove recoil and create zoom hack
2592function Hermes.NoRecoil( ply, origin, angles, FOV )
2593 local ply, zoomFOV = LocalPlayer(), FOV
2594 local w = ply:GetActiveWeapon()
2595
2596 -- Zoom
2597 Hermes.zooming = false
2598 if ( Hermes.features['zoomalways'] ) then Hermes.zooming = true end
2599 if ( Hermes.features['zoomonaim'] && Hermes.set.aiming ) then Hermes.zooming = true end
2600 if ( Hermes.features['zoomontrigger'] && Hermes.set.trigger ) then Hermes.zooming = true end
2601
2602 Hermes.zoomspeed = tonumber( Hermes.features['zoomamount'] )
2603
2604 if ( Hermes.features['zoom'] && Hermes.zooming ) then
2605 zoomFOV = ( 90 / ( 1 + ( 1 * Hermes.zoomspeed ) ) )
2606 else zoomFOV = FOV end
2607
2608 if ( !Hermes.prop.enable && Hermes.features['norecoil'] ) then
2609 -- Norecoil
2610 if ( w && ( w.Primary && w.Primary != 0 ) ) then
2611 w.OldRecoil = w.Recoil || ( w.Primary && w.Primary.Recoil )
2612 w.Recoil = 0
2613 w.Primary.Recoil = 0
2614 end
2615
2616 -- No visual recoil
2617 if ( !Hermes.features['novisspread'] ) then
2618 local view = GAMEMODE:CalcView( ply, origin, Hermes.set.angles, zoomFOV ) || {}
2619 view.angles = Hermes.set.angles
2620 view.angles.r = 0
2621 view.fov = zoomFOV
2622 return view
2623 elseif ( Hermes.features['novisspread'] ) then
2624 local view = GAMEMODE:CalcView( ply, origin, angles, zoomFOV ) || {}
2625 view.angles = Hermes.set.angles
2626 view.angles.r = 0
2627 view.fov = zoomFOV
2628 return view
2629 end
2630 end
2631
2632 if ( Hermes.prop.enable ) then
2633 return GAMEMODE:CalcView( ply, origin, Hermes.prop.ang, zoomFOV )
2634 end
2635
2636 -- Reset default recoil
2637 if ( !Hermes.features['norecoil'] && w && ( w.Primary && w.Primary == 0 ) && w.OldRecoil ) then
2638 w.Recoil = w.OldRecoil
2639 w.Primary.Recoil = w.OldRecoil
2640 end
2641 return GAMEMODE:CalcView( ply, origin, angles, zoomFOV )
2642end
2643Hermes:AddHook( "CalcView", Hermes.NoRecoil )
2644
2645-- Add commands
2646function Hermes.Aiming()
2647 if ( disAim ) then return end
2648 if ( !Hermes.set.aiming ) then
2649 Hermes.set.aiming = true
2650 Hermes.set.target = nil
2651 end
2652end
2653
2654function Hermes.AimingOFF()
2655 disAim = false
2656 if ( Hermes.set.aiming ) then
2657 Hermes.set.dotnum = 0
2658 Hermes.set.aiming = false
2659 Hermes.set.target = nil
2660 end
2661end
2662
2663function Hermes.Trigger()
2664 if ( !Hermes.set.trigger ) then
2665 Hermes.set.trigger = true
2666 end
2667end
2668
2669function Hermes.TriggerOFF()
2670 if ( Hermes.set.trigger ) then
2671 Hermes.set.trigger = false
2672 end
2673end
2674
2675function Hermes.PropKill()
2676 if ( !Hermes.prop.enable ) then
2677 Hermes.prop.enable = true
2678 end
2679end
2680
2681function Hermes.PropKillOFF()
2682 if ( Hermes.prop.enable ) then
2683 Hermes.prop.enable = false
2684 Hermes.prop.thrown = true
2685 end
2686end
2687
2688/*----------------------------------------
2689 Aim HUD
2690 Desc: Aimbot HUD.
2691*/----------------------------------------
2692function Hermes.ToggleHUD()
2693 local ply = LocalPlayer()
2694
2695 local tar, text, col = Hermes.set.target, nil, nil
2696
2697 if ( Hermes.set.aiming && tar && tar != ply ) then
2698 text = "Locked"; col = Color( 255, 0, 0, 255 )
2699 elseif ( Hermes.set.aiming ) then
2700 text = "Scanning"; col = Color( 0, 255, 0, 255 )
2701 end
2702
2703 if ( Hermes.features['toggle'] && Hermes.set.aiming ) then
2704 if ( !tar || tar == ply ) then
2705 if ( Hermes.set.dotnum > 20 && 40 > Hermes.set.dotnum ) then
2706 text = text .. "."
2707 elseif( Hermes.set.dotnum > 40 && 60 > Hermes.set.dotnum ) then
2708 text = text .. ".."
2709 elseif( Hermes.set.dotnum > 60 && 80 > Hermes.set.dotnum ) then
2710 text = text .. "..."
2711 elseif( Hermes.set.dotnum > 80 ) then
2712 print( "done" )
2713 Hermes.set.dotnum = 0
2714 end
2715 end
2716
2717 draw.SimpleText( text, "ScoreboardText", ( ScrW() / 2 ), ( ScrH() / 2 ) + 20, col, 1, 1 )
2718 Hermes.set.dotnum = Hermes.set.dotnum + 1
2719 end
2720
2721 if ( Hermes.features['togglename'] && tar && Hermes.set.aiming ) then
2722 local text = tar:IsPlayer() && tar:Nick() || tar:GetClass()
2723 if ( tar != ply ) then
2724 draw.SimpleText( text, "ScoreboardText", ( ScrW() / 2 ), ( ScrH() / 2 ) + 40, col, 1, 1 )
2725 end
2726 end
2727end
2728
2729/*----------------------------------------
2730 Adminlist
2731 Desc: Displays all the admins on the server.
2732*/----------------------------------------
2733function Hermes:IsAdmin( e )
2734
2735 if ( e.IsAdmin && e:IsAdmin() ) then
2736 return true
2737 elseif ( e.IsSuperAdmin && e:IsSuperAdmin() ) then
2738 return true
2739 end
2740 return false
2741end
2742
2743function Hermes:GetAdminType( e )
2744
2745 local ply = LocalPlayer()
2746
2747 if ( ( e.IsAdmin && e:IsAdmin() ) && !( e.IsSuperAdmin && e:IsSuperAdmin() ) ) then
2748 return "Admin"
2749 elseif ( e.IsSuperAdmin && e:IsSuperAdmin() ) then
2750 return "Super Admin"
2751 end
2752 return ""
2753end
2754
2755Hermes.admins = {}
2756Hermes.adminlisttall = 0
2757function Hermes:Adminlist()
2758 if ( !Hermes.features['adminlist'] ) then return end
2759 Hermes.admins = {}
2760
2761 local admin, adminnum, x, y = "", 0, ScrW(), ScrH()
2762 for k, e in ipairs( Hermes.worldents.players ) do
2763 if ( e:IsPlayer() && Hermes:IsAdmin( e ) ) then
2764 admin = ( admin .. e:Nick() .. " [" .. Hermes:GetAdminType( e ) .. "]" .. "\n" )
2765 adminnum = adminnum + 1
2766 end
2767 end
2768
2769 local wide, tall = 300, ( adminnum * 20 ) + 20
2770 local posX, posY = x / 2 + ( wide - wide ) + 300, y / 2 + ( tall + tall ) - 400
2771
2772 if ( adminnum == 0 ) then
2773 admin = ""
2774 admin = ( "There are no admins on right now" )
2775 wide, tall = 300, 40
2776 end
2777
2778 local numb = string.Explode( "\n", admin )
2779 for k, v in pairs( numb ) do
2780 table.insert( Hermes.admins, v )
2781 end
2782 Hermes.adminlisttall = tall
2783end
2784
2785/*----------------------------------------
2786 Barrelhack
2787 Desc: Displays the players HP.
2788*/----------------------------------------
2789function Hermes:Barrel( e, col )
2790 if ( !Hermes.features['barrel'] ) then return end
2791 if ( !e || e && !e:IsPlayer() ) then return end
2792 local c = ( 1 / 255 )
2793 local pos, hPos = Hermes:TargetLocation( e, true ):ToScreen(), ( e:GetEyeTrace().HitPos ):ToScreen()
2794 cam.Start2D( EyePos(), EyeAngles() )
2795 surface.SetDrawColor( col )
2796 surface.DrawLine( pos.x, pos.y, hPos.x, hPos.y )
2797 cam.End2D()
2798end
2799
2800/*----------------------------------------
2801 Mirror
2802 Desc: Mirror
2803*/----------------------------------------
2804function Hermes:Mirror()
2805 if ( !Hermes.features['mirror'] ) then return end
2806 local cams = {}
2807 local ang = LocalPlayer():EyeAngles()
2808 cams.angles = Angle(ang.p - ang.p - ang.p, ang.y - 180, ang.r)
2809 cams.origin = LocalPlayer():GetShootPos()
2810 cams.x = ( ScrW() / 2 ) - 350 / 2
2811 cams.y = 30
2812 cams.w = 350
2813 cams.h = 350 / 2
2814
2815 render.RenderView( cams )
2816end
2817
2818/*----------------------------------------
2819 Bar Base
2820 Desc: For health bar n shit
2821*/----------------------------------------
2822function Hermes:DrawBar( dynamic_size, static_size, pos, col, class )
2823 local mx = dynamic_size / 4
2824 local mw = static_size / 4
2825
2826 local dPos = pos
2827
2828 draw.SimpleTextOutlined(
2829 tostring( class ),
2830 "Default",
2831 pos.x,
2832 pos.y + 5,
2833 Color( col.r, col.g, col.b, 255 ),
2834 1,
2835 1,
2836 1,
2837 Color( 0, 0, 0, 255 )
2838 )
2839
2840 dPos.x = dPos.x - ( mx / 2 );
2841 dPos.y = dPos.y + 15;
2842
2843 surface.SetDrawColor( Color( 0, 0, 0, 255 ) )
2844 surface.DrawRect( dPos.x - 1, dPos.y - 1, mx + 2, 4 + 2 )
2845
2846 surface.SetDrawColor( col )
2847 surface.DrawRect( dPos.x, dPos.y, mw, 4 )
2848end
2849
2850/*----------------------------------------
2851 C4/Grenade detector
2852 Desc: title pls
2853*/----------------------------------------
2854Hermes.staticsize = {}
2855function Hermes:C4Detector( e )
2856 if ( !e || !ValidEntity( e ) ) then return end
2857 if ( !Hermes.features['shownade'] ) then return end
2858 if ( !ExtraEntities( e ) ) then return end
2859 local size = ( e:GetExplodeTime() - CurTime()) * 15
2860 if ( size > 0 ) then
2861 local pos = e:GetPos():ToScreen()
2862
2863 local class = e:GetClass()
2864 class = string.gsub( class, "ttt_confgrenade_proj", "Discombobulator" )
2865 class = string.gsub( class, "ttt_c4", "C4" )
2866 class = string.gsub( class, "ttt_smokegrenade_proj", "Smoke-bomb" )
2867 class = string.gsub( class, "ttt_firegrenade_proj", "Incendiary" )
2868
2869 Hermes:DrawBar( size, size, pos, Color( 255, 0, 0, 200 ), class )
2870 end
2871end
2872
2873/*----------------------------------------
2874 Health bar
2875 Desc: Displays the players HP.
2876*/----------------------------------------
2877function Hermes:CreatePos( e )
2878 local ply = LocalPlayer()
2879 local center = e:LocalToWorld( e:OBBCenter() )
2880 local min, max = e:OBBMins(), e:OBBMaxs()
2881 local dim = max - min
2882 local z = max + min
2883
2884 local frt = ( e:GetForward() ) * ( dim.y / 2 )
2885 local rgt = ( e:GetRight() ) * ( dim.x / 2 )
2886 local top = ( e:GetUp() ) * ( dim.z / 2 )
2887 local bak = ( e:GetForward() * -1 ) * ( dim.y / 2 )
2888 local lft = ( e:GetRight() * -1 ) * ( dim.x / 2 )
2889 local btm = ( e:GetUp() * -1 ) * ( dim.z / 2 )
2890
2891 local FRT = center + frt + rgt + top; FRT = FRT:ToScreen()
2892 local BLB = center + bak + lft + btm; BLB = BLB:ToScreen()
2893 local FLT = center + frt + lft + top; FLT = FLT:ToScreen()
2894 local BRT = center + bak + rgt + top; BRT = BRT:ToScreen()
2895 local BLT = center + bak + lft + top; BLT = BLT:ToScreen()
2896 local FRB = center + frt + rgt + btm; FRB = FRB:ToScreen()
2897 local FLB = center + frt + lft + btm; FLB = FLB:ToScreen()
2898 local BRB = center + bak + rgt + btm; BRB = BRB:ToScreen()
2899
2900 local maxX = math.max( FRT.x,BLB.x,FLT.x,BRT.x,BLT.x,FRB.x,FLB.x,BRB.x )
2901 local minX = math.min( FRT.x,BLB.x,FLT.x,BRT.x,BLT.x,FRB.x,FLB.x,BRB.x )
2902 local maxY = math.max( FRT.y,BLB.y,FLT.y,BRT.y,BLT.y,FRB.y,FLB.y,BRB.y )
2903 local minY = math.min( FRT.y,BLB.y,FLT.y,BRT.y,BLT.y,FRB.y,FLB.y,BRB.y )
2904
2905 return maxX, minX, maxY, minY
2906end
2907
2908function Hermes:DrawRect( x, y, w, h, col )
2909 surface.SetDrawColor( col.r, col.g, col.b, col.a )
2910 surface.DrawRect( x, y, w, h )
2911end
2912
2913/*----------------------------------------
2914 ESP
2915 Desc: Prints shit on your screen.
2916*/----------------------------------------
2917
2918function Hermes:Filter( e )
2919 local ply = LocalPlayer()
2920
2921 local maxX, minX, maxY, minY = Hermes:CreatePos( e )
2922 local col = Hermes:FilterColors( e )
2923 local text, box, posX, posY, Xalign, Yalign = "", false, maxX, minY, TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM
2924
2925 if ( Hermes.EntityListItem( e ) && Hermes.features['entityliste'] && Hermes.features['enablee'] ) then
2926 box = true
2927
2928 posX, posY = ( minX + maxX ) / 2, minY
2929 Xalign, Yalign = TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM
2930
2931 text = e:GetClass()
2932
2933 elseif ( e:IsPlayer() && Hermes.features['enable'] ) then
2934 if ( tonumber( Hermes.features['optical'] ) != 1 ) then
2935 box = true
2936 end
2937
2938 posX, posY = ( minX + maxX ) / 2, minY
2939 Xalign, Yalign = TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM
2940
2941 local isFriend, friInfo = Hermes.features['friendsmark'] && e:GetFriendStatus() == "friend" || false, ""
2942 if ( isFriend ) then friInfo = " *Friend*" end
2943
2944 local added = 0
2945 if ( Hermes.features['name'] ) then
2946 if ( friInfo != "" ) then
2947 text = friInfo
2948 added = added + 1
2949 posY = posY - 13
2950 end
2951
2952 text = text .. "\n" .. e:Nick()
2953 added = added + 1
2954
2955 if ( added == 1 ) then
2956 text = e:Nick()
2957 end
2958 end
2959
2960 if ( Hermes.features['health'] ) then
2961 text = text .. "\nHp: " .. e:Health()
2962 added = added + 1
2963 posY = posY - 13
2964
2965 if ( added == 1 ) then
2966 text = "Hp: " .. e:Health()
2967 end
2968 end
2969
2970 if ( Hermes.features['weapon'] ) then
2971 local wep = "NONE"
2972 if ( e:GetActiveWeapon():IsValid() ) then
2973 wep = e:GetActiveWeapon():GetPrintName()
2974
2975 wep = string.gsub( wep, "#HL2_", "" )
2976 wep = string.gsub( wep, "#GMOD_", "" )
2977 wep = string.gsub( wep, "_", " " )
2978 end
2979
2980 text = text .. "\nW: " .. wep
2981 added = added + 1
2982 posY = posY - 13
2983
2984 if ( added == 1 ) then
2985 text = "W: " .. wep
2986 end
2987 end
2988
2989 elseif ( e:IsNPC() && Hermes.features['enablen'] ) then
2990 if ( Hermes.features['boxn'] ) then
2991 box = true
2992 end
2993
2994 posX, posY = ( minX + maxX ) / 2, minY
2995 Xalign, Yalign = TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM
2996
2997 local data = e:GetClass()
2998 data = string.gsub( data, "npc_", "" )
2999 data = string.gsub( data, "monster_", "" )
3000 data = string.gsub( data, "_", "" )
3001
3002 text = data
3003
3004 elseif ( IsRagdoll( e ) && Hermes.features['enablee'] ) then
3005 box = false
3006
3007 posX, posY = ( minX + maxX ) / 2, minY
3008 Xalign, Yalign = TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM
3009
3010 text = "Ragdoll"
3011
3012 elseif ( IsVehicle( e ) && Hermes.features['enablee'] ) then
3013 box = false
3014
3015 posX, posY = ( minX + maxX ) / 2, minY
3016 Xalign, Yalign = TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM
3017
3018 text = "Vehicle"
3019
3020 elseif ( e:IsWeapon() && Hermes.features['weaponse'] && Hermes.features['enablee'] ) then
3021 box = true
3022
3023 posX, posY = ( minX + maxX ) / 2, minY
3024 Xalign, Yalign = TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM
3025
3026 local data = e:GetClass()
3027 data = string.gsub( data, "weapon_", "" )
3028 data = string.gsub( data, "cs_", "" )
3029 data = string.gsub( data, "zm_", "" )
3030 data = string.gsub( data, "ttt_", "" )
3031 data = string.gsub( data, "weapon_", "" )
3032 data = string.gsub( data, "css_", "" )
3033 data = string.gsub( data, "real_", "" )
3034 data = string.gsub( data, "mad_", "" )
3035 data = string.gsub( data, "_", "" )
3036 text = data
3037 end
3038 return text, box, col, posX, posY, maxX, minX, maxY, minY, Xalign, Yalign
3039end
3040
3041
3042-- This will be a entity filter, due to the fact esp lags.
3043function Hermes:GetEntities( typ )
3044 local targets = {}
3045
3046 local ent, targets = ( Hermes.features['enablen'] || Hermes.features['enablee'] ) && true || false, {}
3047 if ( ent ) then
3048 for k, e in ipairs( Hermes.worldents.entities ) do
3049 if ( !e:IsPlayer() ) then
3050 if ( Hermes:ValidTarget( e, typ ) ) then
3051 table.insert( targets, e )
3052 end
3053 end
3054 end
3055 end
3056 for k, e in ipairs( Hermes.worldents.players ) do
3057 if ( e:IsPlayer() ) then
3058 if ( Hermes:ValidTarget( e, typ ) ) then
3059 table.insert( targets, e )
3060 end
3061 end
3062 end
3063
3064 if ( table.Count( targets ) > 1 ) then
3065 return targets
3066 end
3067 return ( table.Count( targets ) == 0 ) && {} || targets
3068end
3069
3070function Hermes.HUD()
3071 local ply = LocalPlayer()
3072
3073 local ent, entnum = Hermes:GetEntities( "esp" ), 0
3074 for k, e in pairs( ent ) do
3075
3076 // Some extras
3077 Hermes:C4Detector( e )
3078
3079 // Main codex
3080 local text, box, col, posX, posY, maxX, minX, maxY, minY, Xalign, Yalign = Hermes:Filter( e )
3081 local textLength, pos = string.Explode( "\n", text ), 0
3082
3083 local len = ( Vector( ( maxX + minX ) / 2, minY, 0 ) - Vector( ScrW() / 2, ScrH() / 2, 0 ) ):Length()
3084 local a = ( 1 - math.Clamp( len / tonumber( Hermes.features['fadelength'] ), 0, 1 ) ) * 255
3085
3086 Hermes:Skeleton( e )
3087 Hermes:Barrel( e, col )
3088
3089 if ( e:IsPlayer() && box ) then
3090 if ( tonumber( Hermes.features['optical'] ) == 2 ) then
3091 Hermes:BoundingBox( e, Color( col.r, col.g, col.b, 255 ) )
3092 elseif ( tonumber( Hermes.features['optical'] ) == 3 ) then
3093 surface.SetDrawColor( Color( col.r, col.g, col.b, 255 ) )
3094
3095 local int = 0
3096 for i = 1, 1 do
3097 surface.DrawLine( maxX + int, maxY - int, maxX + int, minY - int )
3098 surface.DrawLine( maxX - int, minY + int, minX - int, minY + int )
3099
3100 surface.DrawLine( minX - int, minY + int, minX - int, maxY + int )
3101 surface.DrawLine( minX + int, maxY - int, maxX + int, maxY - int )
3102 int = int + 1
3103 end
3104 elseif ( tonumber( Hermes.features['optical'] ) == 4 ) then
3105 local obb = e:LocalToWorld( e:OBBCenter() ):ToScreen()
3106
3107 local size = 50 + ( math.Round( e:GetPos():Distance( ply:GetShootPos() ) ) / 500 )
3108 surface.SetDrawColor( Color( col.r, col.g, col.b, 255 ) )
3109
3110 local x, y = obb.x - ( size / 2 ), obb.y - ( size / 2 )
3111 surface.DrawOutlinedRect( x, y, size, size )
3112
3113 posX, posY = x + ( size / 2 ), y
3114
3115 local added = 0
3116 local items = { "friendsmark", "name", "health", "weapon" }
3117 for i = 1, table.Count( items ) do
3118 if ( items[ i ] != "friendsmark" ) then
3119 if ( Hermes.features[ items[ i ] ] ) then
3120 posY = posY - 13
3121 added = added + 1
3122 if ( added == 1 ) then
3123 posY = posY + 13
3124 end
3125 end
3126 else
3127 if ( Hermes.features[ items[ i ] ] && ( e:GetFriendStatus() == "friend" ) ) then
3128 posY = posY - 13
3129 added = added + 1
3130 if ( added == 1 ) then
3131 posY = posY + 13
3132 end
3133 end
3134 end
3135 end
3136 end
3137 end
3138
3139 if ( !e:IsPlayer() && box ) then
3140 surface.SetDrawColor( Color( col.r, col.g, col.b, 255 ) )
3141
3142 surface.DrawLine( maxX, maxY, maxX, minY )
3143 surface.DrawLine( maxX, minY, minX, minY )
3144
3145 surface.DrawLine( minX, minY, minX, maxY )
3146 surface.DrawLine( minX, maxY, maxX, maxY )
3147 end
3148
3149 if ( !Hermes.features['enablefade'] || a > 0 && ( entnum < tonumber( Hermes.features['maxshow'] ) ) ) then
3150 for i = 1, table.Count( textLength ) do
3151 a = Hermes.features['enablefade'] && a || 255
3152 draw.SimpleText(
3153 textLength[ i ],
3154 Hermes.currentfont['font'],
3155 posX,
3156 posY + pos,
3157 Color( col.r, col.g, col.b, a ),
3158 Xalign,
3159 Yalign
3160 )
3161 pos = pos + 12
3162 end
3163 end
3164 entnum = entnum + 1
3165 end
3166
3167 if ( Hermes.features['crosshair'] ) then
3168 local g = tonumber( Hermes.features['crosshairgap'] )
3169 local x, y, l = ( ScrW() / 2 ), ( ScrH() / 2 ), g + tonumber( Hermes.features['crosshairlength'] )
3170 if ( tonumber( Hermes.features['crosshairtype'] ) == 2 ) then l = tonumber( Hermes.features['crosshairlength'] ) end
3171
3172 // Inner
3173 if ( tonumber( Hermes.features['crosshairtype'] ) == 2 ) then
3174 surface.SetDrawColor( Hermes:GetColor( "crosshairinner" ) )
3175
3176 surface.DrawLine( x, y - g, x, y + g )
3177 surface.DrawLine( x - g, y, x + g, y )
3178 end
3179
3180 // Outer
3181 surface.SetDrawColor( Hermes:GetColor( "crosshairoutter" ) )
3182
3183 surface.DrawLine( x - l, y, x - g, y )
3184 surface.DrawLine( x + l, y, x + g, y )
3185
3186 surface.DrawLine( x, y - l, x, y - g )
3187 surface.DrawLine( x, y + l, x, y + g )
3188 end
3189 Hermes.ToggleHUD()
3190 Hermes:Mirror()
3191end
3192Hermes:AddHook( "HUDPaint", Hermes.HUD )
3193
3194/*----------------------------------------
3195 Proxy
3196 Desc: Makes all models transparent.
3197*/----------------------------------------
3198function Hermes.Proxy()
3199 if ( !Hermes.features['asusmdl'] ) then return end
3200 local ply, c = LocalPlayer(), ( 1 / 255 )
3201
3202 for k, e in pairs( Hermes.worldents.entities ) do
3203 if ( ValidEntity( e ) && !e:IsPlayer() && !e:IsNPC() && !e:IsWeapon() ) then
3204 if ( Hermes.features['asusmdl'] ) then
3205 e:SetColor( 255, 255, 255, tonumber( Hermes.features['asusval'] ) )
3206 else
3207 e:SetColor( 255, 255, 255, 255 )
3208 end
3209 end
3210 end
3211end
3212
3213/*----------------------------------------
3214 InGame
3215 Desc: When a player loads
3216*/----------------------------------------
3217local inGame = false
3218function Hermes:CheckGame()
3219 local ply = LocalPlayer()
3220 if ( ply && ply:IsValid() ) then
3221 timer.Simple( 2, function() inGame = true end )
3222 end
3223end
3224/*----------------------------------------
3225 Asus Wallhack
3226 Desc: Makes all walls transparent.
3227*/----------------------------------------
3228Hermes.cmds.ColorMsg( "About to make functions...\n", Color( 0, 0, 255 ) )
3229local Asus = {}
3230/*
3231 This required some C++ code in it, thanks to C0BRA
3232 Hermes.cmds.SetWorldTransparent() was created in C++.
3233*/
3234local isLoaded, inUse = false, false
3235function Asus:GetAll( bool )
3236 print( inGame && "yes" || "fail" )
3237 if ( !bool && !isLoaded ) then return end
3238
3239 if ( bool ) then inUse = true end
3240 if ( !bool ) then inUse = false end
3241
3242 Hermes.cmds.ColorMsg( "Starting asus...\n", Color( 0, 0, 255 ) )
3243 Hermes.cmds.SetWorldTransparent( bool == true && 1 || 0 )
3244
3245 isLoaded = true
3246end
3247
3248function Hermes:Asus()
3249 if ( Hermes.features['asus'] ) then
3250 if ( !inUse ) then
3251 Asus:GetAll( true )
3252 end
3253 else
3254 if ( isLoaded ) then
3255 if ( inUse ) then
3256 Asus:GetAll( false )
3257 end
3258 end
3259 end
3260end
3261
3262/*----------------------------------------
3263 Pure XQZ
3264 Desc: IgnoreZ without a loop yay.
3265*/----------------------------------------
3266/*
3267 This required some C++ code in it.
3268 Hermes.cmds.XQZ() was created in C++.
3269*/
3270local xqzLoaded, inXQZ = false, false
3271function Hermes:SetXQZ( bool )
3272 if ( !bool && !xqzLoaded ) then return end
3273
3274 if ( bool ) then inXQZ = true end
3275 if ( !bool ) then inXQZ = false end
3276
3277 Hermes.cmds.ColorMsg( "Starting XQZ...\n", Color( 0, 0, 255 ) )
3278 Hermes.cmds.XQZ( bool == true && 1 || 0 )
3279
3280 xqzLoaded = true
3281end
3282
3283function Hermes:XQZ()
3284 if ( tonumber( Hermes.features['walltype'] ) == 5 ) then
3285 if ( !inXQZ ) then
3286 Hermes:SetXQZ( true )
3287 end
3288 else
3289 if ( xqzLoaded ) then
3290 if ( inXQZ ) then
3291 Hermes:SetXQZ( false )
3292 end
3293 end
3294 end
3295end
3296
3297Hermes.entitems = {}
3298function Hermes.OnEntityCreated()
3299 if ( ValidEntity( e ) ) then
3300 if ( !table.HasValue( Hermes.entitems, e ) && ( e:IsPlayer() || e:IsNPC() ) ) then
3301 if ( inXQZ ) then
3302 Hermes:SetXQZ( true )
3303 table.insert( Hermes.entitems, e )
3304 end
3305 end
3306 end
3307end
3308Hermes:AddHook( "OnEntityCreated", Hermes.OnEntityCreated )
3309
3310/*----------------------------------------
3311 Nohands
3312 Desc: Remove visual hands
3313*/----------------------------------------
3314/*
3315 This required some C++ code in it.
3316 Hermes.cmds.SetHands( int ) was created in C++ so yeah.
3317*/
3318local noLoaded, inHands = false, 0
3319function Hermes:SetHands( int )
3320 if ( int == 0 && !noLoaded ) then return end
3321
3322 if ( int != 0 ) then inHands = int end
3323 if ( int == 0 ) then inHands = 0 end
3324
3325 Hermes.cmds.ColorMsg( "Starting nohands...\n", Color( 0, 0, 255 ) )
3326 if ( int != 0 ) then
3327 Hermes.cmds.SetHands( int )
3328 else
3329 Hermes.cmds.SetHands( 0 )
3330 end
3331
3332 noLoaded = true
3333end
3334
3335function Hermes:NoHands()
3336 if ( Hermes.features['nohands'] ) then
3337 if ( inHands != tonumber( Hermes.features['nohandstype'] ) ) then
3338 Hermes:SetHands( tonumber( Hermes.features['nohandstype'] ) )
3339 end
3340 else
3341 if ( noLoaded ) then
3342 if ( inHands != 0 ) then
3343 Hermes:SetHands( 0 )
3344 end
3345 end
3346 end
3347end
3348
3349/*----------------------------------------
3350 Chams
3351 Desc: Nice D3D-style or XQZ chams.
3352*/----------------------------------------
3353function Hermes:CreateMaterial()
3354 local BaseInfo = {
3355 ["$basetexture"] = "models/debug/debugwhite",
3356 ["$model"] = 1,
3357 ["$translucent"] = 1,
3358 ["$alpha"] = 1,
3359 ["$nocull"] = 1,
3360 ["$ignorez"] = 1
3361 }
3362
3363 local solid = CreateMaterial( "hermes_createmat_solid", "VertexLitGeneric", BaseInfo )
3364 local wire = CreateMaterial( "hermes_createmat_wireframe", "Wireframe", BaseInfo )
3365
3366 return solid, wire
3367end
3368
3369function Hermes:FilterColorsChams( e )
3370 local ply = LocalPlayer()
3371
3372 if( Hermes.features['teamcolor'] && e:IsPlayer() ) then
3373 local ret = team.GetColor( e:Team() ) || Color( color_white )
3374 return ret, ret
3375 end
3376
3377 local isVis, notVis
3378 local isEnemy
3379
3380 if ( !e:IsWeapon() ) then
3381 if ( !e:IsPlayer() ) then
3382 if ( IsEnemyEntityName( e:GetClass() ) || ( e:GetClass() == "npc_metropolice" ) || Hermes.IsTraitor( e ) ) then
3383 isEnemy = true
3384 end
3385 else
3386 if ( ply:Team() != e:Team() || ( IsTraitor( e ) ) ) then
3387 isEnemy = true
3388 end
3389 end
3390
3391 if ( !isEnemy ) then
3392 isVis = Hermes:GetColor( "alliechamvis" )
3393 notVis = Hermes:GetColor( "alliechamnovis" )
3394 else
3395 isVis = Hermes:GetColor( "enemychamvis" )
3396 notVis = Hermes:GetColor( "enemychamnovis" )
3397 end
3398 end
3399 if ( e:IsWeapon() ) then isVis = Color( 255, 255, 255, 255 ); notVis = Color( 255, 255, 255, 255 ) end -- best to stay at white
3400 if ( IsRagdoll( e ) || IsVehicle( e ) ) then isVis = Hermes:GetColor( "entityespvis" ); notVis = Hermes:GetColor( "entityespnovis" ) end
3401 return isVis, notVis
3402end
3403
3404local solidMat, wireMat = Hermes:CreateMaterial()
3405function Hermes.Chams()
3406 local ply, c = LocalPlayer(), ( 1 / 255 )
3407 local ent = Hermes:GetEntities( "chams" )
3408 for k, e in ipairs( ent ) do
3409 if ( tonumber( Hermes.features['walltype'] ) != 4 && tonumber( Hermes.features['walltype'] ) != 5 && tonumber( Hermes.features['walltype'] ) != 1 ) then
3410 local mat = tonumber( Hermes.features['walltype'] ) == 3 && wireMat || solidMat
3411 local isVis, notVis = Hermes:FilterColorsChams( e )
3412 cam.Start3D( EyePos(), EyeAngles() )
3413 render.SuppressEngineLighting( tobool( Hermes.features['fullbright'] ) )
3414 render.SetColorModulation( ( notVis.r * c ), ( notVis.g * c ), ( notVis.b * c ) )
3415 SetMaterialOverride( mat )
3416 e:DrawModel()
3417 render.SuppressEngineLighting( false )
3418 if ( ( tonumber( Hermes.features['walltype'] ) != 1 ) || Hermes.features['visiblechams'] ) then
3419 render.SetColorModulation( ( isVis.r * c ), ( isVis.g * c ), ( isVis.b * c ) )
3420 else
3421 render.SetColorModulation( 1, 1, 1 )
3422 end
3423 SetMaterialOverride()
3424 e:DrawModel()
3425 cam.End3D()
3426 else
3427 if ( tonumber( Hermes.features['walltype'] ) != 5 && tonumber( Hermes.features['walltype'] ) != 1 ) then
3428 cam.Start3D( EyePos(), EyeAngles() )
3429 cam.IgnoreZ( true )
3430 render.SuppressEngineLighting( tobool( Hermes.features['fullbright'] ) )
3431 e:DrawModel()
3432 cam.IgnoreZ( false )
3433 render.SuppressEngineLighting( false )
3434 cam.End3D()
3435 end
3436 end
3437 end
3438end
3439
3440function Hermes.RenderScreenspaceEffects()
3441 Hermes.Chams()
3442 Hermes.Proxy()
3443end
3444Hermes:AddHook( "RenderScreenspaceEffects", Hermes.RenderScreenspaceEffects )
3445
3446function Hermes.SeconedChams()
3447 local mat = "hermes/living"
3448 if ( tonumber( Hermes.features['walltype'] ) == 3 ) then
3449 mat = "hermes/wireframe"
3450 end
3451 for k, e in ipairs( Hermes.worldents.all ) do
3452 if ( Hermes:ValidTarget( e, "chams" ) ) then
3453 if ( tonumber( Hermes.features['walltype'] ) != 4 && tonumber( Hermes.features['walltype'] ) != 5 && Hermes.features['visiblechams'] && tonumber( Hermes.features['walltype'] ) != 1 ) then
3454 local isVis, notVis = Hermes:FilterColorsChams( e )
3455 e:SetMaterial( mat )
3456 e:SetColor( isVis )
3457 else
3458 e:SetMaterial( "" )
3459 e:SetColor( 255, 255, 255, 255 )
3460 end
3461 end
3462 end
3463end
3464Hermes:AddHook( "RenderScene", Hermes.SeconedChams )
3465
3466/*----------------------------------------
3467 Speedhack
3468 Desc: Makes you go faster than everyone.
3469*/----------------------------------------
3470function Hermes.SpeedHack()
3471 if ( Hermes.features['speedhack'] ) then
3472 if ( !Hermes.features['speedhackframe'] ) then
3473 Hermes.cmds.ForceVar( "hermes_host_timescale", tonumber( Hermes.features['speedhackspeed'] ) )
3474 else
3475 Hermes.cmds.ForceVar( "host_framerate", tonumber( Hermes.features['speedhackspeed'] ) )
3476 end
3477 end
3478end
3479
3480function Hermes.SpeedHackOFF()
3481 if ( !Hermes.features['speedhackframe'] ) then
3482 Hermes.cmds.ForceVar( "hermes_host_timescale", 1.0 )
3483 else
3484 Hermes.cmds.ForceVar( "host_framerate", 0.0 )
3485 end
3486end
3487
3488/*----------------------------------------
3489 Globals
3490 Desc: No-sky, fullbright...
3491*/----------------------------------------
3492function Hermes.Nosky()
3493 local vars = {
3494 { Table = "fullbrightg", ON = "hermes_mat_fullbright 1", OFF = "hermes_mat_fullbright 0" },
3495 { Table = "particles", ON = "hermes_r_drawparticles 0", OFF = "hermes_r_drawparticles 1" },
3496 }
3497
3498 for k, v in ipairs( vars ) do
3499 if ( Hermes.features[ v.Table ] ) then
3500 Hermes.cmds.RunCommand( v.ON )
3501 else
3502 Hermes.cmds.RunCommand( v.OFF )
3503 end
3504 end
3505end
3506
3507/*----------------------------------------
3508 Anti-gag
3509 Desc: ULX anti-gag, ye seth found dis out n all.
3510*/----------------------------------------
3511function Hermes.UnGag()
3512 if ( ulx && ulx['gagUser'] ) then
3513 if ( Hermes.features['ulxantigag'] ) then
3514 ulx['gagUser']( false )
3515 end
3516 end
3517end
3518
3519/*----------------------------------------
3520 Name Stealer
3521 Desc: Steal peoples names.
3522*/----------------------------------------
3523function Hermes.NameSteal()
3524 local ply = LocalPlayer()
3525
3526 local e = Hermes.worldents.players[ math.random( 1, #Hermes.worldents.players ) ]
3527 if ( Hermes.features['namesteal'] ) then
3528 if ( !e:IsAdmin() && !( e:GetFriendStatus() == "friend" ) && e != ply ) then
3529 Hermes.cmds.RunCommand( "name " .. e:Nick() .. string.char( 03 ) ) //"ÂÂ "
3530 end
3531 end
3532end
3533
3534/*----------------------------------------
3535 Think
3536 Desc: Think hooks
3537*/----------------------------------------
3538function Hermes.ThinkHooks()
3539 //Hermes:CheckGame()
3540 Hermes:GetAllWorldEntities()
3541 Hermes.GetTraitors()
3542 Hermes.NameSteal()
3543 Hermes.Nosky()
3544 Hermes:Adminlist()
3545 Hermes.UnGag()
3546 //Hermes:Asus()
3547 //Hermes:XQZ()
3548 //Hermes:NoHands()
3549end
3550
3551Hermes:AddHook( "Think", Hermes.ThinkHooks )
3552
3553/*----------------------------------------
3554 Binding
3555 Desc: Binding function
3556*/----------------------------------------
3557Hermes.keys = {}
3558Hermes.keys["None"] = KEY_NONE
3559Hermes.keys["0"] = KEY_0
3560Hermes.keys["1"] = KEY_1
3561Hermes.keys["2"] = KEY_2
3562Hermes.keys["3"] = KEY_3
3563Hermes.keys["4"] = KEY_4
3564Hermes.keys["5"] = KEY_5
3565Hermes.keys["6"] = KEY_6
3566Hermes.keys["7"] = KEY_7
3567Hermes.keys["8"] = KEY_8
3568Hermes.keys["9"] = KEY_9
3569Hermes.keys["A"] = KEY_A
3570Hermes.keys["B"] = KEY_B
3571Hermes.keys["C"] = KEY_C
3572Hermes.keys["D"] = KEY_D
3573Hermes.keys["E"] = KEY_E
3574Hermes.keys["F"] = KEY_F
3575Hermes.keys["G"] = KEY_G
3576Hermes.keys["H"] = KEY_H
3577Hermes.keys["I"] = KEY_I
3578Hermes.keys["J"] = KEY_J
3579Hermes.keys["K"] = KEY_K
3580Hermes.keys["L"] = KEY_L
3581Hermes.keys["M"] = KEY_M
3582Hermes.keys["N"] = KEY_N
3583Hermes.keys["O"] = KEY_O
3584Hermes.keys["P"] = KEY_P
3585Hermes.keys["Q"] = KEY_Q
3586Hermes.keys["R"] = KEY_R
3587Hermes.keys["S"] = KEY_S
3588Hermes.keys["T"] = KEY_T
3589Hermes.keys["U"] = KEY_U
3590Hermes.keys["V"] = KEY_V
3591Hermes.keys["W"] = KEY_W
3592Hermes.keys["X"] = KEY_X
3593Hermes.keys["Y"] = KEY_Y
3594Hermes.keys["Z"] = KEY_Z
3595Hermes.keys["Alt"] = KEY_LALT
3596Hermes.keys["Shift"] = KEY_LSHIFT
3597Hermes.keys["Insert"] = KEY_INSERT
3598Hermes.keys["Delete"] = KEY_DELETE
3599Hermes.keys["Home"] = KEY_HOME
3600Hermes.keys["End"] = KEY_END
3601
3602Hermes.mouse = {}
3603Hermes.mouse["Mouse left"] = MOUSE_LEFT
3604Hermes.mouse["Mouse right"] = MOUSE_RIGHT
3605Hermes.mouse["Mouse middle"] = MOUSE_MIDDLE
3606
3607Hermes.mousekeys = { MOUSE_RIGHT, MOUSE_LEFT, MOUSE_MIDDLE }
3608Hermes.bindfunctions = { "Menu", "Presets", "ColorMenu", "Aiming", "Trigger", "SpeedHack", "PropKill" }
3609
3610local function IsKeyorMouse( key )
3611 for k, v in pairs( Hermes.mousekeys ) do
3612 if ( tonumber( key ) == tonumber( v ) ) then
3613 return "mouse"
3614 end
3615 end
3616 return "key"
3617end
3618
3619function Hermes:SaveBinds()
3620 local str = ""
3621 for k, v in pairs( Hermes.binds ) do
3622 str = str .. k .. "-" .. v .. "\n"
3623 end
3624 Hermes:WriteFile( "saves/hermes_lists_binds.txt", str )
3625end
3626
3627function Hermes:LoadBinds()
3628 local vbinds = string.Explode( "\n", Hermes:FileExists( "saves/hermes_lists_binds.txt" ) && Hermes:ReadFile( "saves/hermes_lists_binds.txt", false ) || "missing" )
3629
3630 Hermes.binds = {}
3631 for k, v in pairs( vbinds ) do
3632 local skip = string.Explode( "-", v )
3633 if ( skip && ( skip[ 2 ] ) ) then
3634 Hermes.binds[ skip[ 1 ] ] = skip[ 2 ]
3635 end
3636 end
3637end
3638Hermes:LoadBinds()
3639
3640function Hermes:SetKey( key, cmd, dochecks )
3641 if ( dochecks && Hermes.binds[ cmd ] ) then return end -- Already exists
3642 if ( !key || !cmd ) then return end
3643
3644 for k, v in pairs( Hermes.keys ) do
3645 local tblkey = string.lower( k )
3646 if ( tblkey == string.lower( key ) ) then
3647 Hermes.binds[ cmd ] = v
3648 end
3649 end
3650
3651 for k, v in pairs( Hermes.mouse ) do
3652 local tblkey = string.lower( k )
3653 if ( tblkey == string.lower( key ) ) then
3654 Hermes.binds[ cmd ] = v
3655 end
3656 end
3657 Hermes:SaveBinds()
3658end
3659
3660Hermes.presstimes = {}
3661function Hermes:RemoveFunctionFromBind( cmd )
3662 if ( !cmd ) then return end
3663 if ( Hermes.binds[ cmd ] ) then
3664 Hermes.binds[ cmd ] = nil
3665 if ( Hermes.presstimes[ cmd ] ) then
3666 Hermes.presstimes[ cmd ] = nil
3667 end
3668 end
3669 Hermes:SaveBinds()
3670end
3671
3672if ( !Hermes.binds['Menu'] ) then Hermes:SetKey( "insert", "Menu", true ) end -- Default
3673
3674function Hermes:Bind()
3675 Hermes:LoadBinds()
3676 for k, v in pairs( Hermes.binds ) do
3677 local keytype = IsKeyorMouse( v )
3678 if ( keytype == "key" ) then
3679 if ( input.IsKeyDown( v ) ) then
3680 if ( !( Hermes.presstimes[ k ] && Hermes.presstimes[ k ] > CurTime() ) ) then
3681 Hermes[ k ]()
3682 Hermes.presstimes[ k ] = CurTime() + 0.25
3683 end
3684 else
3685 if ( Hermes[ k .. "OFF" ] ) then
3686 Hermes[ k .. "OFF" ]()
3687 end
3688 end
3689 elseif( keytype == "mouse" ) then
3690 if ( input.IsMouseDown( v ) ) then
3691 if ( !( Hermes.presstimes[ k ] && Hermes.presstimes[ k ] > CurTime() ) ) then
3692 Hermes[ k ]()
3693 Hermes.presstimes[ k ] = CurTime() + 0.25
3694 end
3695 else
3696 if ( Hermes[ k .. "OFF" ] ) then
3697 Hermes[ k .. "OFF" ]()
3698 end
3699 end
3700 end
3701 end
3702end
3703
3704local function OnKeyPressed()
3705 Hermes:Bind()
3706 timer.Simple( 0.0001, OnKeyPressed )
3707end
3708timer.Simple( 0.01, OnKeyPressed )
3709
3710// This is part of CelSius old derma skin, it works well and looks extremly nice.
3711function Hermes:Background( x, y, w, h, col1, col2 )
3712 col1, col2 = Hermes.colors.Background, Hermes.colors.Background
3713 for i = 1, h, 3 do
3714 local col = ( i / h )
3715 surface.SetDrawColor( ( col1.r * ( 1 - col ) ) + ( col2.r * col ), ( col1.g * ( 1 - col ) ) + ( col2.g * col ), ( col1.b * ( 1 - col ) ) + ( col2.b * col ), ( ( col * 2 ) + 3 ) * 50 )
3716 surface.DrawRect( x, y + i, w, 3 )
3717 end
3718
3719 surface.SetDrawColor( Hermes.colors.Outline )
3720 surface.DrawOutlinedRect( x, y, w, h )
3721end
3722
3723/*----------------------------------------
3724 Menu
3725 Desc: A cool menu
3726*/----------------------------------------
3727Hermes.colors = {
3728 Background = Color( 0, 0, 0, 150 ),
3729 Outline = Color( 0, 0, 0, 255 )
3730}
3731
3732function Hermes:MultiChoice( name, desc, cvar, contents, none )
3733 local multichoice = vgui.Create( "DMultiChoice" )
3734 multichoice:SetParent( mis )
3735 multichoice:SetPos( 210, 15 )
3736 multichoice:SetSize( 210, 20 )
3737 multichoice:SetEditable( false )
3738
3739 if ( none ) then multichoice:AddChoice( "None" ) end
3740 for k, v in pairs( contents ) do
3741 multichoice:AddChoice( v )
3742 end
3743
3744 if ( string.find( string.lower( name ), "font" ) ) then
3745 multichoice:ChooseOptionID( tonumber( GetConVarNumber( name ) + 1 ) )
3746 else
3747 multichoice:ChooseOptionID( tonumber( GetConVarNumber( name ) ) )
3748 end
3749
3750 multichoice.change = 0
3751 multichoice.OnSelect = function( index, value, data )
3752 if ( multichoice.change < CurTime() ) then
3753 multichoice.change = CurTime() + 0.1
3754 if ( string.find( string.lower( name ), "font" ) ) then
3755 Hermes:GetSelectedFont( value - 1 ) -- For some reason it's adding 1, prob because '0' isn't valid in DMultiChoice.
3756 RunConsoleCommand( name, value - 1 )
3757 else
3758 RunConsoleCommand( name, value )
3759 end
3760 end
3761 end
3762 return multichoice
3763end
3764
3765function Hermes:CheckBox( cvar, desc )
3766 local checkbox = vgui.Create( "DCheckBoxLabel" )
3767 checkbox:SetText( desc )
3768 checkbox:SetValue( GetConVarNumber( cvar ) )
3769 //checkbox:SetTextColor( Color( 0, 0, 0, 255 ) )
3770
3771 checkbox.change = 0
3772 checkbox.OnChange = function()
3773 if ( checkbox.change < CurTime() ) then
3774 checkbox.change = CurTime() + 0.1
3775 checkbox:SetValue( tobool( checkbox:GetChecked() && 1 || 0 ) )
3776 RunConsoleCommand( cvar, checkbox:GetChecked() && 1 || 0 )
3777 end
3778 end
3779
3780 cvars.AddChangeCallback( cvar, function( cvar, old, new )
3781 if ( checkbox.change < CurTime() ) then
3782 checkbox.change = CurTime() + 0.1
3783 checkbox:SetValue( tobool( new ) )
3784 end
3785 end )
3786
3787 return checkbox
3788end
3789
3790function Hermes:NumSlider( cvar, value, desc, max, min, deci )
3791 local slider = vgui.Create( "DNumSlider" )
3792 slider:SetText( "" )
3793 slider:SetMax( max || 1 )
3794 slider:SetMin( min || 0 )
3795
3796 if ( deci ) then
3797 slider:SetDecimals( 1 )
3798 else
3799 slider:SetDecimals( 0 )
3800 end
3801
3802 slider:SetValue( Hermes.features[ value ] )
3803
3804 local label = vgui.Create( "DLabel" )
3805 label:SetParent( slider )
3806 label:SetWide( 200 )
3807 label:SetText( desc )
3808 //label:SetTextColor( Color( 0, 0, 0, 255 ) )
3809
3810 slider.change = 0
3811 slider.ValueChanged = function( self, new )
3812 if ( slider.change < CurTime() ) then
3813 slider.change = CurTime() + 0.1
3814 slider:SetValue( new )
3815 RunConsoleCommand( cvar, new )
3816 end
3817 end
3818
3819 cvars.AddChangeCallback( cvar, function( cvar, old, new )
3820 if ( slider.change < CurTime() ) then
3821 slider.change = CurTime() + 0.1
3822 slider:SetValue( new )
3823 end
3824 end )
3825 return slider
3826end
3827
3828Hermes.radar = nil
3829Hermes.adminlist = nil
3830
3831local lineTime, linePos = 0, 0
3832function Hermes.ExtraGUI()
3833 local xn, yn, x, y = ScrW(), ScrH(), ScrW() / 2, ScrH() / 2
3834
3835 Hermes['radar'] = vgui.Create( "DFrame" )
3836 Hermes['radar']:SetSize( 250, 250 )
3837
3838 local radarW, radarH = Hermes['radar']:GetWide(), Hermes['radar']:GetTall()
3839 Hermes['radar']:SetPos( xn - radarW - 10, yn - radarH - ( yn - radarH ) + 10 )
3840 Hermes['radar']:SetTitle( "Radar" )
3841 Hermes['radar']:SetVisible( true )
3842 Hermes['radar']:SetDraggable( true )
3843 Hermes['radar']:ShowCloseButton( false )
3844 Hermes['radar']:MakePopup()
3845
3846 Hermes['radar'].Paint = function()
3847 Hermes:Background( 0, 0, radarW, radarH, Color( 0, 0, 0 ), Color( 0, 0, 0 ) )
3848
3849 // Radar Function
3850 local ply = LocalPlayer()
3851
3852 local radar = {}
3853 radar.h = 250
3854 radar.w = 250
3855 radar.org = tonumber( Hermes.features['radarradius'] )
3856
3857 local x, y = ScrW() / 2, ScrH() / 2
3858
3859 local half = radarH / 2
3860 local xm = half
3861 local ym = half
3862
3863 // Moving line
3864 if ( Hermes.features['radarspin'] ) then
3865 local speed = 2
3866 local x1,y1 = math.cos( RealTime() * speed ), math.sin( RealTime() * speed )
3867 local x2,y2 = math.cos( RealTime() * speed + math.pi / 2 ), math.sin( RealTime() * speed + math.pi / 2 )
3868 local iR, oR = 0, 100
3869
3870 surface.SetDrawColor( 0, 0, 0, 255 )
3871 surface.DrawLine( xm + ( x1 * iR ), ym + ( y1 * iR ), xm + ( x1 * oR ), ym + ( y1 * oR ) )
3872 end
3873
3874 surface.DrawLine( xm, ym - 100, xm, ym + 100 )
3875 surface.DrawLine( xm - 100, ym, xm + 100, ym )
3876
3877 local ent = Hermes:GetEntities( "radar" )
3878 for k, e in ipairs( ent ) do
3879 local s = 6
3880 local color = Hermes:FilterColors( e )
3881 local plyfov = ply:GetFOV() / ( 70 / 1.13 )
3882 local zpos, npos = ply:GetPos().z - ( e:GetPos().z ), ( ply:GetPos() - e:GetPos() )
3883
3884 npos:Rotate( Angle( 180, ( ply:EyeAngles().y ) * -1, -180 ) )
3885 local iY = npos.y * ( radar.h / ( ( radar.org * ( plyfov * ( ScrW() / ScrH() ) ) ) + zpos * ( plyfov * (ScrW() / ScrH() ) ) ) )
3886 local iX = npos.x * ( radar.w / ( ( radar.org * ( plyfov * ( ScrW() / ScrH() ) ) ) + zpos * ( plyfov * (ScrW() / ScrH() ) ) ) )
3887
3888 local pX = ( radar.w / 2 )
3889 local pY = ( radar.h / 2 )
3890
3891 local posX = pX - iY - ( s / 2 )
3892 local posY = pY - iX - ( s / 2 )
3893
3894 if ( iX < ( radar.h / 2 ) && iY < ( radar.w / 2 ) && iX > ( -radar.h / 2 ) && iY > ( -radar.w / 2 ) ) then
3895 local text = e:IsPlayer() && e:Nick() || e:GetClass()
3896 draw.RoundedBox( s, posX, posY, s, s, color )
3897 if ( Hermes.features['radarname'] ) then
3898 draw.SimpleText( text, "DefaultSmall", posX, posY - 6, color, 1, 1 )
3899 end
3900 end
3901 end
3902 end
3903 Hermes['radar']:SetMouseInputEnabled( false )
3904 Hermes['radar']:SetKeyboardInputEnabled( false )
3905
3906 // Adminlist
3907 Hermes['adminlist'] = vgui.Create( "DFrame" )
3908 Hermes['adminlist']:SetSize( 250, 1000 )
3909
3910 local aW, aH, x, y = Hermes['adminlist']:GetWide(), Hermes.adminlisttall, ScrW() / 2, ScrH() / 2
3911
3912 Hermes['adminlist']:SetPos( xn - aW - 10, yn - aH - ( yn - aH ) + 270 )
3913 Hermes['adminlist']:SetTitle( "Admins" )
3914 Hermes['adminlist']:SetVisible( true )
3915 Hermes['adminlist']:SetDraggable( true )
3916 Hermes['adminlist']:ShowCloseButton( false )
3917 Hermes['adminlist']:MakePopup()
3918 Hermes['adminlist'].Paint = function()
3919 Hermes:Background( 0, 0, 250, Hermes.adminlisttall, Color( 0, 0, 0 ), Color( 0, 0, 0 ) )
3920
3921 local pos = 17
3922 for i = 1, table.Count( Hermes.admins ) do
3923 draw.SimpleText(
3924 Hermes.admins[ i ],
3925 "Default",
3926 20,
3927 pos,
3928 Color( 0, 255, 0, 255 ),
3929 0,
3930 0
3931 )
3932 pos = pos + 12
3933 end
3934 end
3935
3936 Hermes['adminlist']:SetMouseInputEnabled( false )
3937 Hermes['adminlist']:SetKeyboardInputEnabled( false )
3938end
3939
3940local menuValid = true
3941function Hermes.OpenExtraGUI()
3942 if ( menuValid ) then
3943 Hermes.ExtraGUI()
3944 menuValid = false
3945 end
3946end
3947
3948function Hermes.Binds( binds )
3949 local combobox
3950 local function BindList()
3951 combobox = vgui.Create( "DComboBox" )
3952 combobox:SetParent( binds )
3953 combobox:SetPos( 10 + 10, 15 + 10 )
3954 combobox:SetSize( 200 - 20, 230 )
3955 combobox:SetMultiple( false )
3956 end
3957 BindList()
3958
3959 local function AddBinds()
3960 combobox:Clear()
3961 for k, v in pairs( Hermes.bindfunctions ) do
3962 combobox:AddItem( v )
3963 end
3964 end
3965 AddBinds()
3966
3967 local keyname = vgui.Create( "DTextEntry" )
3968 keyname:SetParent( binds )
3969 keyname:SetPos( 260, 25 )
3970 keyname:SetSize( 150, 20 )
3971 keyname:SetEditable( false )
3972
3973 local bindkey = vgui.Create( "DTextEntry" )
3974 bindkey:SetParent( binds )
3975 bindkey:SetPos( 260, 55 )
3976 bindkey:SetSize( 150, 20 )
3977 bindkey:SetEditable( false )
3978
3979 local bindlist = vgui.Create( "DMultiChoice" )
3980 bindlist:SetParent( binds )
3981 bindlist:SetPos( 260, 85 )
3982 bindlist:SetWidth( 150 )
3983 bindlist.TextEntry:SetEditable( false )
3984
3985 function bindlist:OnSelect( index, value, data )
3986 if ( bindkey:GetValue() == "" || keyname:GetValue() == "" ) then return end
3987 local cmd = keyname:GetValue()
3988 if ( Hermes.binds[ cmd ] ) then
3989 Hermes:RemoveFunctionFromBind( cmd )
3990 end
3991 Hermes:SetKey( value, cmd, false )
3992 end
3993
3994 for k, v in pairs( Hermes.keys ) do
3995 bindlist:AddChoice( k )
3996 end
3997
3998 for k, v in pairs( Hermes.mouse ) do
3999 bindlist:AddChoice( k )
4000 end
4001
4002 local oldSelect = combobox.SelectItem
4003 function combobox.SelectItem( self, item, multi )
4004 local text = item:GetValue()
4005 keyname:SetValue( text )
4006 bindlist:SetText( "" )
4007
4008 local curkey = nil
4009 for u, e in pairs( Hermes.binds ) do
4010 for m, n in pairs( Hermes.keys ) do
4011 if ( tonumber( e ) == tonumber( n ) ) then
4012 if ( string.lower( text ) == string.lower( u ) ) then
4013 curkey = m
4014 end
4015 end
4016 end
4017 for m, n in pairs( Hermes.mouse ) do
4018 if ( tonumber( e ) == tonumber( n ) ) then
4019 if ( string.lower( text ) == string.lower( u ) ) then
4020 curkey = m
4021 end
4022 end
4023 end
4024 bindkey:SetValue( curkey || "No key bound" )
4025 end
4026 oldSelect( self, item, multi )
4027 end
4028
4029 local label = vgui.Create( "DLabel" )
4030 label:SetParent( binds )
4031 label:SetPos( 210, 25 )
4032 label:SetWide( 200 )
4033 label:SetText( "Function: " )
4034
4035 local label = vgui.Create( "DLabel" )
4036 label:SetParent( binds )
4037 label:SetPos( 210, 55 )
4038 label:SetWide( 200 )
4039 label:SetText( "Key: " )
4040
4041 local label = vgui.Create( "DLabel" )
4042 label:SetParent( binds )
4043 label:SetPos( 210, 85 )
4044 label:SetWide( 50 )
4045 label:SetText( "Set Key: " )
4046end
4047
4048function Hermes.System( friends, entity )
4049 // Friends list
4050 local combobox1
4051 function Hermes.AllPlayers()
4052 combobox1 = vgui.Create( "DComboBox" )
4053 combobox1:SetParent( friends )
4054 combobox1:SetPos( 10 + 10, 15 + 10 )
4055 combobox1:SetSize( 200 - 20, 230 - 20 )
4056 combobox1:SetMultiple( false )
4057 end
4058 Hermes.AllPlayers()
4059
4060 local combobox2
4061 function Hermes.OnlyFriends()
4062 combobox2 = vgui.Create( "DComboBox" )
4063 combobox2:SetParent( friends )
4064 combobox2:SetPos( 220 + 10, 15 + 10 )
4065 combobox2:SetSize( 200 - 20, 230 - 20 )
4066 combobox2:SetMultiple( false )
4067 end
4068 Hermes.OnlyFriends()
4069
4070 function Hermes.AddFriendsToList()
4071 combobox1:Clear()
4072 combobox2:Clear()
4073
4074 local add, rem = Hermes.GetAddedFriends()
4075 for k, e in pairs( add ) do
4076 combobox2:AddItem( e:Nick() )
4077 end
4078
4079 for k, e in pairs( rem ) do
4080 combobox1:AddItem( e:Nick() )
4081 end
4082 end
4083 Hermes.AddFriendsToList()
4084
4085 local button1 = vgui.Create( "DButton" )
4086 button1:SetParent( friends )
4087 button1:SetSize( 160, 20 )
4088 button1:SetPos( 30, 240 )
4089 button1:SetText( "Add" )
4090 button1.DoClick = function()
4091 if ( combobox1:GetSelectedItems() && combobox1:GetSelectedItems()[1] ) then
4092 for k, e in pairs( Hermes.worldents.players ) do
4093 if ( ValidEntity( e ) && e:Nick() == combobox1:GetSelectedItems()[1]:GetValue() ) then
4094 Hermes.AddFriends( e )
4095 end
4096 end
4097 end
4098 Hermes.AddFriendsToList()
4099 end
4100
4101 local button2 = vgui.Create( "DButton" )
4102 button2:SetParent( friends )
4103 button2:SetSize( 160, 20 )
4104 button2:SetPos( 240, 240 )
4105 button2:SetText( "Remove" )
4106 button2.DoClick = function()
4107 if ( combobox2:GetSelectedItems() && combobox2:GetSelectedItems()[1] ) then
4108 for k, e in pairs( Hermes.friends ) do
4109 for u, v in pairs( Hermes.worldents.players ) do
4110 if ( v:IsBot() ) then
4111 if ( e == combobox2:GetSelectedItems()[1]:GetValue() ) then
4112 Hermes.friends[ k ] = nil
4113 end
4114 else
4115 if ( e == v:SteamID() ) then
4116 if ( v:Nick() == combobox2:GetSelectedItems()[1]:GetValue() ) then
4117 Hermes.friends[ k ] = nil
4118 end
4119 end
4120 end
4121 end
4122 end
4123 end
4124 Hermes.AddFriendsToList()
4125 Hermes:WriteFile( "hermes_lists_friends.txt", Hermes.friends, true )
4126 end
4127 // End of friends list
4128
4129 // Entities list
4130 local combobox3
4131 function Hermes.AllEntities()
4132 combobox3 = vgui.Create( "DComboBox" )
4133 combobox3:SetParent( entity )
4134 combobox3:SetPos( 10 + 10, 15 + 10 )
4135 combobox3:SetSize( 200 - 20, 230 - 20 )
4136 combobox3:SetMultiple( false )
4137 end
4138 Hermes.AllEntities()
4139
4140 local combobox4
4141 function Hermes.OnlyListed()
4142 combobox4 = vgui.Create( "DComboBox" )
4143 combobox4:SetParent( entity )
4144 combobox4:SetPos( 220 + 10, 15 + 10 )
4145 combobox4:SetSize( 200 - 20, 230 - 20 )
4146 combobox4:SetMultiple( false )
4147 end
4148 Hermes.OnlyListed()
4149
4150 function Hermes.AddEntitiesToList()
4151 combobox3:Clear()
4152 combobox4:Clear()
4153
4154 local add, rem = Hermes.GetAddedItems()
4155 for k, e in ipairs( add ) do
4156 local c = combobox4:AddItem( e )
4157 end
4158
4159 for k, e in ipairs( rem ) do
4160 local c = combobox3:AddItem( e )
4161 end
4162 end
4163 Hermes.AddEntitiesToList()
4164
4165 local button3 = vgui.Create( "DButton" )
4166 button3:SetParent( entity )
4167 button3:SetSize( 160, 20 )
4168 button3:SetPos( 30, 240 )
4169 button3:SetText( "Add" )
4170 button3.DoClick = function()
4171 if ( combobox3:GetSelectedItems() && combobox3:GetSelectedItems()[1] ) then
4172 for k, e in pairs( ents.GetAll() ) do
4173 if ( ValidEntity( e ) && e:GetClass() == combobox3:GetSelectedItems()[1]:GetValue() ) then
4174 print( "Add: " .. tostring( e:GetClass() ) )
4175 Hermes.AddEntities( e )
4176 end
4177 end
4178 end
4179 Hermes.AddEntitiesToList()
4180 end
4181
4182 local button4 = vgui.Create( "DButton" )
4183 button4:SetParent( entity )
4184 button4:SetSize( 160, 20 )
4185 button4:SetPos( 240, 240 )
4186 button4:SetText( "Remove" )
4187 button4.DoClick = function()
4188 if ( combobox4:GetSelectedItems() && combobox4:GetSelectedItems()[1] ) then
4189 for a, b in pairs( combobox4:GetSelectedItems() ) do
4190 for k, e in pairs( Hermes.entities ) do
4191 if ( e == combobox4:GetSelectedItems()[1]:GetValue() ) then
4192 Hermes.entities[k] = nil
4193 end
4194 end
4195 end
4196 end
4197 Hermes.AddEntitiesToList()
4198 Hermes:WriteFile( "hermes_lists_entities.txt", Hermes.entities, true )
4199 end
4200 // End of entities list
4201end
4202
4203Hermes.panelopen = false
4204Hermes.panel = nil
4205function Hermes.VGUIMenu()
4206 Hermes.OpenExtraGUI()
4207
4208 Hermes.panel = vgui.Create( "DFrame" )
4209 Hermes.panel:SetPos( ScrW() / 2 - 450 / 2, ScrH() / 2 - 350 / 2 )
4210 Hermes.panel:SetSize( 450, 350 )
4211 Hermes.panel:SetTitle( "Hermes" )
4212 Hermes.panel:SetVisible( true )
4213 Hermes.panel:SetDraggable( true )
4214 Hermes.panel:ShowCloseButton( true )
4215 Hermes.panel:MakePopup()
4216 Hermes.panel.Close = function()
4217 Hermes.panelopen = false
4218 Hermes.panel:SetVisible( false )
4219 Hermes:SaveOrLoadVars( false )
4220 end
4221
4222 Hermes.panel.Paint = function()
4223 local w, h = Hermes.panel:GetWide(), Hermes.panel:GetTall()
4224 Hermes:Background( 0, 0, w, h, Color( 0, 0, 0 ), Color( 0, 0, 0 ) )
4225 end
4226
4227 Hermes.panelopen = true
4228 if ( !Hermes.panel:IsVisible() || Hermes.panel == nil ) then return end
4229 local panel = Hermes.panel
4230
4231 local Include = {
4232 { Tab = "Aimbot", Icon = "gui/silkicons/wrench", Contents = {
4233 { [1] = "Aimbot" },
4234 { [2] = "Triggerbot" },
4235 { [3] = "Targeting" },
4236 { [4] = "Accuracy" },
4237 { [5] = "HUD" },
4238 }
4239 },
4240
4241 { Tab = "ESP", Icon = "gui/silkicons/world", Contents = {
4242 { [6] = "General" },
4243 { [7] = "Players" },
4244 { [8] = "NPCs" },
4245 { [9] = "Entities" },
4246 { [10] = "Chams" },
4247 { [11] = "Asus" },
4248 }
4249 },
4250
4251 { Tab = "Miscellaneous", Icon = "gui/silkicons/plugin", Contents = {
4252 { [12] = "Miscellaneous" },
4253 { [13] = "Crosshair" },
4254 { [14] = "Radar" },
4255 { [15] = "Globals" },
4256 { [16] = "Speedhack" },
4257 { [17] = "Zoom" },
4258 { [18] = "AntiAim" },
4259 }
4260 },
4261
4262 { Tab = "Friends", Icon = "gui/silkicons/group", Contents = nil },
4263 { Tab = "Entities", Icon = "gui/silkicons/star", Contents = nil },
4264 { Tab = "Binds", Icon = "gui/silkicons/bomb", Contents = nil },
4265 }
4266
4267 local lists, collapsiblecategory, categorylist, dlist = {}, {}, {}, {}
4268 for k, v in ipairs( Include ) do
4269 lists[ v.Tab ] = vgui.Create( "DPanelList" )
4270 lists[ v.Tab ]:SetPos( 10, 60 )
4271 lists[ v.Tab ]:SetParent( panel )
4272 lists[ v.Tab ]:SetSize( 440 - 15, 320 - 40 )
4273 lists[ v.Tab ]:EnableVerticalScrollbar( true )
4274 lists[ v.Tab ]:SetSpacing( 5 )
4275 lists[ v.Tab ].Paint = function() end
4276 end
4277
4278 Hermes.System( lists['Friends'], lists['Entities'] )
4279 Hermes.Binds( lists['Binds'] )
4280
4281 local bpos, dbutton, a = 0, {}, 1
4282 for k, v in ipairs( Include ) do
4283 local function DoPaint( txt, txtcol )
4284 local w, h = dbutton[ v.Tab ]:GetWide(), dbutton[ v.Tab ]:GetTall()
4285 // Main
4286 draw.RoundedBox( 0, 0, 0, w, h, Hermes.colors.Background )
4287
4288 // Outline
4289 surface.SetDrawColor( Hermes.colors.Outline )
4290 surface.DrawOutlinedRect( 0, 0, w, h )
4291
4292 if ( txtcol ) then
4293 draw.SimpleText( txt, "Default", 70 / 2, ( 20 / 2 ) - 1, txtcol, 1, 1 )
4294 end
4295 end
4296
4297 dbutton[ v.Tab ] = vgui.Create( "DButton" )
4298 dbutton[ v.Tab ]:SetParent( panel )
4299 dbutton[ v.Tab ]:SetSize( 70, 20 )
4300 dbutton[ v.Tab ]:SetPos( 7 + bpos, 30 )
4301 dbutton[ v.Tab ]:SetText( v.Tab )
4302 dbutton[ v.Tab ].Paint = function() DoPaint( v.Tab, nil ) end
4303 dbutton[ v.Tab ].DoClick = function()
4304 for e, i in ipairs( Include ) do
4305 lists[ i.Tab ]:SetVisible( false )
4306 dbutton[ i.Tab ]:SetText( i.Tab )
4307 dbutton[ i.Tab ].Paint = function() DoPaint( i.Tab, nil ) end
4308 end
4309 lists[ v.Tab ]:SetVisible( true )
4310 dbutton[ v.Tab ]:SetText( "" )
4311 dbutton[ v.Tab ].Paint = function() DoPaint( v.Tab, Color( 255, 201, 14 ) ) end
4312 end
4313 bpos = bpos + 74
4314
4315 lists[ v.Tab ]:SetVisible( v.Tab == "Aimbot" && true || false )
4316 if ( v.Tab == "Aimbot" ) then
4317 dbutton[ v.Tab ]:SetText( "" )
4318 dbutton[ v.Tab ].Paint = function() DoPaint( v.Tab, Color( 255, 201, 14 ) ) end
4319 end
4320 if ( v.Contents ) then
4321 for t, e in ipairs( v.Contents ) do
4322 collapsiblecategory[ e[ a ] ] = vgui.Create( "DCollapsibleCategory" )
4323 collapsiblecategory[ e[ a ] ]:SetParent( panel )
4324 collapsiblecategory[ e[ a ] ]:SetExpanded( 0 )
4325 collapsiblecategory[ e[ a ] ]:SetLabel( e[ a ] || "" )
4326
4327 categorylist[ e[ a ] ] = vgui.Create( "DPanelList" )
4328 categorylist[ e[ a ] ]:SetAutoSize( true )
4329 categorylist[ e[ a ] ]:SetSpacing( 5 )
4330 categorylist[ e[ a ] ]:EnableHorizontal( false )
4331 categorylist[ e[ a ] ]:EnableVerticalScrollbar( true )
4332 categorylist[ e[ a ] ].Paint = function() end
4333
4334 table.insert( dlist, { Name = e[ a ] } )
4335
4336 collapsiblecategory[ e[ a ] ]:SetContents( categorylist[ e[ a ] ] )
4337
4338 lists[ v.Tab ]:AddItem( collapsiblecategory[ e[ a ] ] )
4339 a = a + 1
4340 end
4341 end
4342 end
4343
4344 local function AddItem( item, typ )
4345 if ( typ == "Colors" ) then return end
4346 for k, v in ipairs( dlist ) do
4347 if ( string.find( string.lower( v.Name ), string.lower( typ ) ) ) then
4348 categorylist[ v.Name ]:AddItem( item )
4349 end
4350 end
4351 end
4352
4353 for k, v in ipairs( Hermes.menuitems ) do
4354 if ( v.Type == "checkbox" ) then
4355 local checkbox = Hermes:CheckBox( v.Name, v.Desc )
4356 AddItem( checkbox, v.Menu )
4357 elseif ( v.Type == "multichoice" ) then
4358 local multichoice = Hermes:MultiChoice( v.Name, v.Desc, v.ConVar, v.Contents, v.None )
4359 AddItem( multichoice, v.Menu )
4360 elseif ( v.Type == "slider" ) then
4361 local slider = Hermes:NumSlider( v.Name, v.ConVar, v.Desc, v.Max || 1, v.Min || 0, v.Decimal )
4362 AddItem( slider, v.Menu )
4363 end
4364 end
4365end
4366
4367function Hermes.Menu()
4368 if ( !Hermes.panelopen ) then
4369 Hermes.VGUIMenu()
4370 end
4371end
4372
4373local function ExtraLoop()
4374 local back, out = Hermes:GetColor( "menubackground" ), Hermes:GetColor( "menuoutline" )
4375 Hermes.colors.Background = Color( back.r, back.g, back.b, 150 )
4376 Hermes.colors.Outline = Color( out.r, out.g, out.b, 255 )
4377
4378 if ( !menuValid ) then
4379 if ( Hermes.panel && Hermes.panel:IsVisible() ) then
4380 Hermes['radar']:SetMouseInputEnabled( true )
4381 Hermes['radar']:SetKeyboardInputEnabled( true )
4382 Hermes['adminlist']:SetMouseInputEnabled( true )
4383 Hermes['adminlist']:SetKeyboardInputEnabled( true )
4384 else
4385 Hermes['radar']:SetMouseInputEnabled( false )
4386 Hermes['radar']:SetKeyboardInputEnabled( false )
4387 Hermes['adminlist']:SetMouseInputEnabled( false )
4388 Hermes['adminlist']:SetKeyboardInputEnabled( false )
4389 end
4390 if ( Hermes.features['radar'] ) then
4391 Hermes['radar']:SetVisible( true )
4392 else
4393 Hermes['radar']:SetVisible( false )
4394 end
4395 if ( Hermes.features['adminlist'] ) then
4396 Hermes['adminlist']:SetVisible( true )
4397 else
4398 Hermes['adminlist']:SetVisible( false )
4399 end
4400 end
4401 timer.Simple( 0.1, ExtraLoop )
4402end
4403timer.Simple( 0.1, ExtraLoop )
4404
4405/*----------------------------------------
4406 Preset Menu
4407 Desc: Allow you to save settings on the hack.
4408*/----------------------------------------
4409Hermes.premenu = nil
4410function Hermes:PresetMenu()
4411 local do_colors = false
4412
4413 local panel = vgui.Create( "DFrame" )
4414 panel:SetSize( 350, 250 )
4415 panel:SetPos( ScrW() / 2 - panel:GetWide() / 2, ScrH() / 2 - panel:GetTall() / 2 )
4416 panel:SetTitle( "Preset Menu" )
4417 panel:SetVisible( true )
4418 panel:SetDraggable( true )
4419 panel:ShowCloseButton( true )
4420 panel:MakePopup()
4421 panel.Close = function()
4422 Hermes.premenu = nil
4423 panel:SetVisible( false )
4424 end
4425 panel.Paint = function()
4426 local w, h = panel:GetWide(), panel:GetTall()
4427 Hermes:Background( 0, 0, w, h, Color( 0, 0, 0 ), Color( 0, 0, 0 ) )
4428 end
4429 Hermes.premenu = panel
4430
4431 local combobox
4432 local function Presets()
4433 combobox = vgui.Create( "DComboBox" )
4434 combobox:SetParent( panel )
4435 combobox:SetPos( 10, 25 )
4436 combobox:SetSize( 150, 190 )
4437 combobox:SetMultiple( false )
4438 end
4439 Presets()
4440
4441 local name = vgui.Create( "DTextEntry" )
4442 name:SetParent( panel )
4443 name:SetPos( 205, 25 )
4444 name:SetSize( 130, 20 )
4445 name:SetMultiline( true )
4446 name:SetEditable( true )
4447
4448 local function GetAllPresetsSaved()
4449 combobox:Clear()
4450 local preset = Hermes:FindFile( "presets/*.txt" )
4451
4452 local included = {}
4453 for k, v in pairs( preset ) do
4454 if ( !included[ v ] && string.find( string.lower( v ), "hermes_preset_" ) ) then
4455 local copy = v
4456
4457 local num, cap = 0, string.Explode( "_", v || "" )
4458 for e, u in pairs( cap ) do
4459 if ( u != "hermes" && u != "preset" ) then
4460 local new = string.Left( u, 1 )
4461 if ( v == copy ) then v = "" end
4462 v = v .. ( num != 0 && " " || "" ) .. string.upper( new ) .. string.Right( u, string.len( u ) - 1 )
4463 num = num + 1
4464 end
4465 end
4466
4467 local name = string.gsub( v, "hermes_preset_", "" )
4468 name = string.gsub( name, ".txt", "" )
4469 name = string.gsub( name, "_", " " )
4470 combobox:AddItem( tostring( name ) )
4471 included[ v ] = true
4472 end
4473 end
4474 end
4475 GetAllPresetsSaved()
4476
4477 local label
4478 local function InfoLabel()
4479 label = vgui.Create( "DLabel" )
4480 label:SetParent( binds )
4481 label:SetPos( 130, 220 )
4482 label:SetWide( 200 )
4483 label:SetText( "" )
4484 end
4485 InfoLabel()
4486
4487 local function SetLabelText( text )
4488 if ( !label ) then return end
4489 label:SetText( text )
4490 InfoLabel()
4491 end
4492
4493 local button = vgui.Create( "DButton" )
4494 button:SetParent( panel )
4495 button:SetSize( 110, 20 )
4496 button:SetPos( 25, 220 )
4497 button:SetText( "Load Preset" )
4498 button.DoClick = function()
4499 if ( combobox:GetSelectedItems() && combobox:GetSelectedItems()[1] ) then
4500 local filename = combobox:GetSelectedItems()[1]:GetValue()
4501 filename = string.gsub( filename, " ", "_" )
4502 filename = string.lower( filename )
4503
4504 local name = "presets/hermes_preset_" .. filename .. ".txt"
4505
4506 local filecontents = string.Explode( "\n", Hermes:FileExists( name ) && Hermes:ReadFile( name, false ) || "missing" )
4507 for k, v in pairs( filecontents ) do
4508 local str = string.Explode( "=", v )
4509 if ( str && str[ 2 ] ) then
4510 if ( do_colors && !string.find( string.lower( str[ 1 ] ), "color" ) ) then return end
4511 Hermes.cmds.RunCommand( str[ 1 ] .. " " .. str[ 2 ] )
4512 end
4513 end
4514 end
4515 end
4516
4517
4518 local button1 = vgui.Create( "DButton" )
4519 button1:SetParent( panel )
4520 button1:SetSize( 165, 20 )
4521 button1:SetPos( 170, 50 )
4522 button1:SetText( "Save" )
4523 button1.DoClick = function()
4524 if ( name:GetValue() == "" ) then return end
4525 local myVars = ""
4526 for k, v in pairs( Hermes.menuitems ) do
4527 local value = v.Value
4528 if ( type( v.Value ) == "boolean" ) then
4529 value = v.Value && 1 || 0
4530 end
4531 myVars = myVars .. v.Name .. "=" .. value .. "\n"
4532 end
4533
4534 local filename = tostring( name:GetValue() )
4535 filename = string.gsub( filename, ":", "" )
4536 filename = string.gsub( filename, " ", "_" )
4537 filename = string.gsub( filename, "|", "" )
4538 filename = string.gsub( filename, "?", "" )
4539 filename = string.gsub( filename, "*", "" )
4540 filename = string.gsub( filename, "<", "" )
4541 filename = string.gsub( filename, ">", "" )
4542 filename = string.gsub( filename, " ", "" )
4543 filename = string.gsub( filename, ".txt", "" )
4544
4545 local fullname = "presets/hermes_preset_" .. filename .. ".txt"
4546 Hermes:WriteFile( fullname, myVars )
4547 Hermes.files[ fullname ] = fullname
4548
4549 name:SetValue( "" )
4550 GetAllPresetsSaved()
4551 end
4552
4553 local button2 = vgui.Create( "DButton" )
4554 button2:SetParent( panel )
4555 button2:SetSize( 165, 20 )
4556 button2:SetPos( 170, 75 )
4557 button2:SetText( "Remove Preset" )
4558 button2.DoClick = function()
4559 if ( combobox:GetSelectedItems() && combobox:GetSelectedItems()[1] ) then
4560 local filename = combobox:GetSelectedItems()[1]:GetValue()
4561 filename = string.gsub( filename, " ", "_" )
4562 filename = string.lower( filename )
4563
4564 local name = "presets/hermes_preset_" .. filename .. ".txt"
4565 Hermes:RemoveFile( name )
4566
4567 GetAllPresetsSaved()
4568 end
4569 end
4570
4571 local label = vgui.Create( "DLabel" )
4572 label:SetParent( panel )
4573 label:SetPos( 170, 25 )
4574 label:SetWide( 50 )
4575 label:SetText( "Name:" )
4576
4577 local checkbox = vgui.Create( "DCheckBoxLabel" )
4578 checkbox:SetParent( panel )
4579 checkbox:SetPos( 170, 100 )
4580 checkbox:SetText( "Colors Only" )
4581 checkbox:SetValue( tonumber( do_colors ) )
4582 checkbox:SizeToContents()
4583 checkbox:Toggle()
4584
4585 checkbox.Think = function()
4586 do_colors = checkbox:GetChecked()
4587 end
4588end
4589
4590function Hermes.Presets()
4591 if ( !Hermes.premenu ) then
4592 Hermes:PresetMenu()
4593 end
4594end
4595
4596/*----------------------------------------
4597 Color Menu
4598 Desc: Change color settings
4599*/----------------------------------------
4600Hermes.colmenu = nil
4601function Hermes:ColorSettingMenu()
4602 local panel = vgui.Create( "DFrame" )
4603 panel:SetSize( 350, 250 )
4604 panel:SetPos( ScrW() / 2 - panel:GetWide() / 2, ScrH() / 2 - panel:GetTall() / 2 )
4605 panel:SetTitle( "Color Menu" )
4606 panel:SetVisible( true )
4607 panel:SetDraggable( true )
4608 panel:ShowCloseButton( true )
4609 panel:MakePopup()
4610 panel.Close = function()
4611 Hermes.colmenu = nil
4612 panel:SetVisible( false )
4613 end
4614 panel.Paint = function()
4615 local w, h = panel:GetWide(), panel:GetTall()
4616 Hermes:Background( 0, 0, w, h, Color( 0, 0, 0 ), Color( 0, 0, 0 ) )
4617 end
4618 Hermes.colmenu = panel
4619
4620 local combobox
4621 local function Colorbox()
4622 combobox = vgui.Create( "DComboBox" )
4623 combobox:SetParent( panel )
4624 combobox:SetPos( 10, 25 )
4625 combobox:SetSize( 150, 210 )
4626 combobox:SetMultiple( false )
4627 end
4628 Colorbox()
4629
4630 local itemsadded = {}
4631 for k, v in pairs( Hermes.menuitems ) do
4632 if ( v.Type == "color" && !itemsadded[ v.Desc ] ) then
4633 combobox:AddItem( v.Desc )
4634 itemsadded[ v.Desc ] = true
4635 end
4636 end
4637
4638 local function GetSelectedItem()
4639 if ( combobox:GetSelectedItems() && combobox:GetSelectedItems()[1] ) then
4640 local selected = combobox:GetSelectedItems()[1]:GetValue()
4641 for k, v in pairs( Hermes.menuitems ) do
4642 if ( v.Desc == selected ) then
4643 return v.ConVar
4644 end
4645 end
4646 end
4647 return nil
4648 end
4649
4650
4651 local ColorTable = {
4652 "Red",
4653 "Green",
4654 "Blue"
4655 }
4656
4657 local COLOR = {}
4658 local POS = 0
4659 for k, v in ipairs( ColorTable ) do
4660 COLOR[ v ] = vgui.Create( "DNumberWang" )
4661 COLOR[ v ]:SetParent( panel )
4662 COLOR[ v ]:SetPos( 220, 25 + POS )
4663 COLOR[ v ]:SetMin( 0 )
4664 COLOR[ v ]:SetMax( 255 )
4665 COLOR[ v ]:SetDecimals( 0 )
4666
4667 local COL, SETCOL = Hermes:GetColor( GetSelectedItem() ), 255
4668 if ( COL && v == "Red" ) then SETCOL = COL.r end
4669 if ( COL && v == "Green" ) then SETCOL = COL.g end
4670 if ( COL && v == "Blue" ) then SETCOL = COL.b end
4671
4672 COLOR[ v ]:SetValue( tonumber( SETCOL ) || 0 )
4673
4674 local label = vgui.Create( "DLabel" )
4675 label:SetParent( panel )
4676 label:SetPos( 170, 25 + POS )
4677 label:SetWide( 50 )
4678 label:SetText( v .. ":" )
4679 POS = POS + 30
4680 end
4681
4682 local CURRENTCOLOR
4683 local function SETCOLOR()
4684 CURRENTCOLOR = vgui.Create( "DColouredBox" )
4685 CURRENTCOLOR:SetParent( panel )
4686 CURRENTCOLOR:SetPos( 170, 115 )
4687 CURRENTCOLOR:SetSize( 115, 115 )
4688
4689 local r, g, b = COLOR['Red']:GetValue(), COLOR['Green']:GetValue(), COLOR['Blue']:GetValue()
4690 CURRENTCOLOR:SetColor( Color( r || 255, g || 255, b || 255 ) )
4691 end
4692 SETCOLOR()
4693
4694 local RED, GREEN, BLUE = 255, 255, 255
4695 local OLD = combobox.SelectItem
4696 function combobox.SelectItem( s, i ,v )
4697 for k, v in ipairs( ColorTable ) do
4698 local COL, SETCOL = Hermes:GetColor( GetSelectedItem() ), 255
4699 if ( COL && v == "Red" ) then SETCOL = COL.r; RED = COL.r end
4700 if ( COL && v == "Green" ) then SETCOL = COL.g; GREEN = COL.g end
4701 if ( COL && v == "Blue" ) then SETCOL = COL.b; BLUE = COL.b end
4702
4703 COLOR[ v ]:SetValue( tonumber( SETCOL ) || 0 )
4704 end
4705 SETCOLOR()
4706
4707 OLD( s, i ,v )
4708 end
4709
4710 local function ChangeColor()
4711 local sel = GetSelectedItem()
4712 if ( sel ) then
4713 local cvarname = "hermes_esp_" .. sel .. "_colors "
4714
4715 local r, g, b = COLOR['Red']:GetValue(), COLOR['Green']:GetValue(), COLOR['Blue']:GetValue()
4716 Hermes.cmds.RunCommand( cvarname .. r .. " " .. g .. " " .. b )
4717
4718 CURRENTCOLOR:SetColor( Color( r, g, b ) || 0 )
4719 end
4720 end
4721
4722 combobox.Think = function()
4723 if ( COLOR['Red']:GetValue() != RED || COLOR['Green']:GetValue() != GREEN || COLOR['Blue']:GetValue() != BLUE ) then
4724 ChangeColor()
4725 end
4726 end
4727end
4728
4729function Hermes.ColorMenu()
4730 if ( !Hermes.colmenu ) then
4731 Hermes:ColorSettingMenu()
4732 end
4733end
4734timer.Simple( 1, function() Hermes:LoadedMessage() end ) // Load Message