Guest User

Untitled

a guest
Apr 23rd, 2014
529
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 70.38 KB | None | 0 0
  1. --[[
  2.  
  3. FapHack "Private" Version
  4.  
  5. Write code for "Admin warning" convar
  6. Fix bug when removing an entity from the entities list, will remain drawing - not resetting the texture.
  7.  
  8. ]]
  9.  
  10. -- Initial shit. Saving copies of functions --
  11.  
  12. include ( "includes/util.lua" )
  13. include ( "includes/util/sql.lua" )
  14. require ( "concommand" )
  15. require ( "saverestore" )
  16. require ( "gamemode" )
  17. require ( "weapons" )
  18. require ( "hook" )
  19. require ( "timer" )
  20. require ( "scripted_ents" )
  21. require ( "player_manager" )
  22. require ( "numpad" )
  23. require ( "team" )
  24. require ( "undo" )
  25. require ( "cleanup" )
  26. require ( "duplicator" )
  27. require ( "constraint" )
  28. require ( "construct" )
  29. require ( "usermessage" )
  30. require ( "list" )
  31. require ( "cvars" )
  32. require ( "http" )
  33. require ( "draw" )
  34. require ( "markup" )
  35. require ( "effects" )
  36. require ( "killicon" )
  37. require ( "spawnmenu" )
  38. require ( "controlpanel" )
  39. require ( "presets" )
  40. require ( "cookie" )
  41.  
  42. include( "includes/util/model_database.lua" )
  43. include( "includes/util/vgui_showlayout.lua" )
  44. include( "includes/util/tooltips.lua" )
  45. include( "includes/util/client.lua" )
  46. include("includes/extensions/table.lua")
  47. -- Let's get locals of some cool functions --
  48.  
  49. local math = math
  50. local string = string
  51. local debug = debug
  52. local table = table
  53. local pcall = pcall
  54. local error = error
  55. local ErrorNoHalt = ErrorNoHalt
  56. local MsgN = MsgN
  57. local Msg = Msg
  58. local print = print
  59. local surface = surface
  60. local util = util
  61. local type = type
  62. local RunConsoleCommand = RunConsoleCommand
  63. local CreateClientConVar = CreateClientConVar
  64. local CreateConVar = CreateConVar
  65. local pairs = pairs
  66. local ipairs = ipairs
  67. local SortedPairs = SortedPairs
  68.  
  69. local _R = debug.getregistry()
  70.  
  71. /*local File_ExistOld = file.Exists
  72. function file.Exists(s,d)
  73. if s != nil then
  74. if string.find(string.lower(s), "faphack_") then
  75. if not File_ExistOld(s,d) then print("Added a non existing FapHack file: "..s) file.Write(s,"") end
  76. end
  77. end
  78. return File_ExistOld(s,d)
  79. end*/
  80.  
  81. function util.tobool(int)
  82. return math.floor(int) == 1
  83. end
  84.  
  85. local function tableSetKeys(table)
  86. local ret = {}
  87. local counter = 0
  88.  
  89. for k , v in pairs(table) do
  90. counter = counter + 1
  91. ret[counter] = v
  92. end
  93. return ret
  94. end
  95.  
  96.  
  97. local function RandomString(length)
  98. local str = ""
  99.  
  100. for i = 1 , length do
  101. str = str..string.char(math.random(65 , 117))
  102. end
  103.  
  104. return str
  105. end
  106.  
  107. local FapHack = {}
  108. FapHack.Revision = 9
  109.  
  110. -- Create the cool fonts we'll use. --
  111.  
  112. surface.CreateFont( "FapHack_Font", {
  113. font = "coolvetica",
  114. size = 20,
  115. weight = 500,
  116. } )
  117.  
  118. surface.CreateFont( "FapHack_Font_Small", {
  119. font = "coolvetica",
  120. size = 15,
  121. weight = 500,
  122. } )
  123. -- Now we want to do some hooking. --
  124.  
  125. FapHack.Functions = {}
  126. FapHack.Hooks = {}
  127.  
  128. function FapHack:AddFunction(type)
  129. if not FapHack.Functions[type] then
  130. FapHack.Functions[type] = {}
  131. end
  132. local randomstring = RandomString(20)
  133.  
  134. FapHack[type] = function(a , b , c , d , ...)
  135. for k , v in pairs(FapHack.Functions[type]) do
  136. local noerr , ret = pcall(v , a , b , c , d , ...)
  137.  
  138. if ret ~= nil and noerr then
  139. return ret
  140. elseif not noerr then
  141. ErrorNoHalt(ret.."\n")
  142. end
  143. end
  144. end
  145.  
  146. hook.Add(type , randomstring , FapHack[type])
  147.  
  148. FapHack.Hooks[type] = randomstring
  149. return true
  150. end
  151.  
  152. function FapHack:RegisterFunc(func , typ)
  153. FapHack.Functions[typ] = FapHack.Functions[typ] or (self:AddFunction(typ) and {})
  154. table.insert(FapHack.Functions[typ] , func)
  155. end
  156.  
  157. -- End of hooking --
  158.  
  159. -- Start of ConVars --
  160.  
  161. FapHack.Settings = {}
  162. FapHack.ConVarSettings = {}
  163. FapHack.ConVarSettings["Aim"] = {}
  164. FapHack.ConVarSettings["ESP"] = {}
  165. FapHack.ConVarSettings["Misc"] = {}
  166.  
  167. FapHack.ConVarNames = {}
  168.  
  169. function FapHack:CreateConVar(cvar , def , save, userdata, var , maxno , minno , isdec)
  170. local booltype = false
  171. if type(def) == "boolean" then
  172. def = def and 1 or 0
  173. booltype = true
  174. end
  175.  
  176. local convar = CreateClientConVar(cvar , def , save , userdata)
  177. if booltype then
  178. FapHack.Settings[var] = util.tobool(convar:GetInt())
  179. elseif type(def) == "number" then
  180. if !isdec then
  181. FapHack.Settings[var] = convar:GetInt()
  182. else
  183. FapHack.Settings[var] = tonumber(convar:GetString())
  184. end
  185. elseif type(def) == "string" then
  186. FapHack.Settings[var] = convar:GetString()
  187. end
  188.  
  189. if string.find(cvar , "aim") then
  190. if booltype then
  191. FapHack.ConVarSettings["Aim"][var] = {var = cvar , type = "boolean" , name = var}
  192. elseif type(def) == "string" then
  193. FapHack.ConVarSettings["Aim"][var] = {var = cvar , type = "string" , name = var}
  194. elseif type(def) == "number" then
  195. FapHack.ConVarSettings["Aim"][var] = {var = cvar , type = "number" , max = maxno , min = minno , dec = isdec , name = var}
  196. end
  197. elseif string.find(cvar , "esp") then
  198. if booltype then
  199. FapHack.ConVarSettings["ESP"][var] = {var = cvar , type = "boolean" , name = var}
  200. elseif type(def) == "string" then
  201. FapHack.ConVarSettings["ESP"][var] = {var = cvar , type = "string" , name = var }
  202. elseif type(def) == "number" then
  203. FapHack.ConVarSettings["ESP"][var] = {var = cvar , type = "number" , max = maxno , min = minno , dec = isdec , name = var}
  204. end
  205. else
  206. if booltype then
  207. FapHack.ConVarSettings["Misc"][var] = {var = cvar , type = "boolean" , name = var}
  208. elseif type(def) == "string" then
  209. FapHack.ConVarSettings["Misc"][var] = {var = cvar , type = "string" , name = var}
  210. elseif type(def) == "number" then
  211. FapHack.ConVarSettings["Misc"][var] = {var = cvar , type = "number" , max = maxno , min = minno , dec = isdec , name = var}
  212. end
  213. end
  214.  
  215. table.insert(FapHack.ConVarNames , cvar)
  216.  
  217. cvars.AddChangeCallback(cvar , function(cvar , old , new)
  218. if booltype then
  219. FapHack.Settings[var] = util.tobool(math.floor(new))
  220. --print("FapHack: Setting "..var.." to " , util.tobool(new))
  221.  
  222. else
  223. FapHack.Settings[var] = new
  224. --print("FapHack: Setting "..var.." to "..new)
  225. end
  226. end )
  227.  
  228. return convar
  229. end
  230.  
  231. FapHack:CreateConVar("fap_aim_enabled" , false , true , false , "AimEnabled")
  232. FapHack:CreateConVar("fap_aim_friendlyfire" , false , true , false , "FriendlyFire")
  233. FapHack:CreateConVar("fap_aim_targetnpcs" , false , true , false , "TargetNPCs")
  234. FapHack:CreateConVar("fap_aim_onlyenemynpcs" , false , true , false , "OnlyEnemyNPCs")
  235. FapHack:CreateConVar("fap_aim_autofire" , true , true , false , "AutoFire")
  236. FapHack:CreateConVar("fap_aim_autoreload" , true , true , false , "AutoReload")
  237. FapHack:CreateConVar("fap_aim_bonemode" , 1 , true , false , "BoneMode" , 3 , 1)
  238. FapHack:CreateConVar("fap_aim_targetfriends" , false , true , false, "TargetFriends")
  239. FapHack:CreateConVar("fap_aim_targetsteamfriends" , true , true ,false , "TargetSteamFriends")
  240. FapHack:CreateConVar("fap_aim_targetmode" , 1 , true , false , "TargetMode" , 4 , 1)
  241. FapHack:CreateConVar("fap_aim_nospread" , true , true , false , "NoSpread")
  242. FapHack:CreateConVar("fap_aim_maxdistance" , 2048 , true , false , "MaxDistance" , 16384 , 0)
  243. FapHack:CreateConVar("fap_aim_targetadmins" , false , true ,false , "TargetAdmins")
  244. FapHack:CreateConVar("fap_aim_antisnap" , false , true , false , "AntiSnap")
  245. FapHack:CreateConVar("fap_aim_norecoil" , true , true , false , "NoRecoil")
  246. FapHack:CreateConVar("fap_aim_antisnapspeed" , 1 , true , false , "AntiSnapSpeed" , 10 , 0 , true)
  247. FapHack:CreateConVar("fap_aim_maxangle" , 180 , true , false , "MaxAngleDiff" , 180 , 0 , true)
  248. FapHack:CreateConVar("fap_aim_snaponfire" , false , true , false , "SnapOnFire")
  249. FapHack:CreateConVar("fap_aim_snaponfiretime" , 0.6 , true , false , "SnapOnFireTime" , 10 , 0.1, true)
  250. FapHack:CreateConVar("fap_aim_onlytargettraitors" , false , true , false , "OnlyTargetTraitors")
  251. FapHack:CreateConVar("fap_aim_velocityprediction" , true , true , false , "VelocityPrediction")
  252. FapHack:CreateConVar("fap_esp_enabled" , true , true , false , "ESPEnabled")
  253. FapHack:CreateConVar("fap_esp_material" , "Solid" , true , false , "WallhackMaterial")
  254. FapHack:CreateConVar("fap_esp_drawweapons" , true , true , false , "DrawWeapons")
  255. FapHack:CreateConVar("fap_esp_maxdistance" , 8192 , true , false , "MaxESPDistance" , 16384 , 0)
  256. FapHack:CreateConVar("fap_esp_zoomtocurrenttarget" , false , true , false , "ZoomToCurrentTarget")
  257. FapHack:CreateConVar("fap_esp_zoomfactor" , 1 , true , false , "ZoomFactor" , 5 , 0.1 , true)
  258. FapHack:CreateConVar("fap_esp_crosshair" , true , true , false , "DrawCrosshair")
  259. FapHack:CreateConVar("fap_esp_textinfo" , true , true , false , "DrawTextInfo")
  260. FapHack:CreateConVar("fap_esp_complex" , false , true , false , "UseComplexDrawing")
  261. FapHack:CreateConVar("fap_esp_alwaysdrawinfo" , false , true , false , "AlwaysDrawInfo")
  262. FapHack:CreateConVar("fap_esp_friendly" , false , true , false , "OnlyDrawOtherTeams")
  263. FapHack:CreateConVar("fap_esp_traitormode" , true , true , false , "TraitorMode")
  264. FapHack:CreateConVar("fap_esp_drawmodels" , true , true , false , "DrawModels")
  265.  
  266. --FapHack:CreateConVar("fap_esp_radar" , false , true , true , "RadarEnabled")
  267.  
  268.  
  269. FapHack:CreateConVar("fap_checkforupdates" , true , true , false , "CheckForUpdates")
  270. FapHack:CreateConVar("fap_shouldload" , true , true , false , "ShouldLoad")
  271. FapHack:CreateConVar("fap_enablekeybinding" , false , true , false , "EnableKeyBinding")
  272. FapHack:CreateConVar("fap_bunnyhop" , false , true , false , "BunnyHop")
  273. FapHack:CreateConVar("fap_bunnyhopspeed" , 270 , true , false , "BunnyHopSpeed" , 700 , 0)
  274. FapHack:CreateConVar("fap_dontchecklos" , false , true , false , "IgnoreLOS")
  275.  
  276. --FapHack:CreateConVar("fap_randomnamechange" , false , true , true , "RandomNameChange")
  277.  
  278. if not FapHack.Settings.ShouldLoad then
  279. MsgN("\n\n\n\n[FapHack] Not loading - disabled. Type fap_shouldload 1 in console to enable loading.\n\n\n")
  280. timer.Simple(0.5 , function() chat.AddText(Color(50 , 205 , 50) , "[FapHack] " , Color(235 , 235 , 235) , "FapHack is disabled. Type \"fap_shouldload 1\" in the console to re-enable it.") end )
  281. return
  282. end
  283.  
  284. FapHack.DetouredFuncs = {}
  285.  
  286. function FapHack:Detour(tbl , key , func)
  287. table.insert(self.DetouredFuncs , {tbl = tbl , key = key , func = func} )
  288.  
  289. --[[local oldfunc = _G[tbl][key]
  290.  
  291. _G[tbl][key] = function(...)
  292. local cpath = debug.getinfo(2).short_src
  293. local args = {...}
  294. local strarg = nil
  295. for k , v in pairs(args) do
  296. if type(v) == "function" then
  297. strarg = strarg and strarg .. " , function" or "function"
  298. elseif type(v) == "table" then
  299. strarg = strarg and strarg .. " , table" or "table"
  300. else
  301. strarg = strarg and strarg .. " , "..v or v
  302. end
  303. end
  304. strarg = strarg or "(nil)"
  305. MsgN(tbl.."."..key.."("..strarg .. " ) ")
  306. return oldfunc(...)
  307. end]]
  308. end
  309.  
  310. --FapHack:CreateConVar("fap_esp_adminwarning" , true , true , true , "AdminWarning")
  311.  
  312. -- End of ConVars --
  313.  
  314. -- Start of misc settings --
  315.  
  316. FapHack.TargetModes = {
  317.  
  318. [1] = "AIM_DISTANCE",
  319. [2] = "AIM_HEALTH",
  320. [3] = "AIM_ANGLE",
  321. [4] = "AIM_DANGER",
  322.  
  323. }
  324.  
  325. FapHack.BoneModes = {
  326. [1] = "head",
  327. [2] = "spine",
  328. [3] = "shoulder",
  329. }
  330.  
  331. -- Friends shit --
  332.  
  333. FapHack.Friends = (file.Exists("faphack_friends.txt","DATA") and util.KeyValuesToTable(file.Read("faphack_friends.txt","DATA")) or {} )
  334.  
  335. function FapHack:AddFriend(pl)
  336. if IsValid(pl) and pl != LocalPlayer() then
  337. table.insert(FapHack.Friends , pl:SteamID())
  338. file.Write("faphack_friends.txt" , util.TableToKeyValues(FapHack.Friends))
  339. end
  340. end
  341.  
  342. function FapHack:RemoveFriend(pl)
  343. if IsValid(pl) then
  344. for k , v in pairs(FapHack.Friends) do
  345. if string.Trim(v) == pl:SteamID() then
  346. FapHack.Friends[k] = nil
  347. end
  348. end
  349. PrintTable(FapHack.Friends)
  350. file.Write("faphack_friends.txt" , util.TableToKeyValues(FapHack.Friends))
  351. end
  352. end
  353.  
  354. function FapHack:AddFriendByName(nick)
  355. for k , v in ipairs(player.GetAll()) do
  356. if string.find(string.lower(v:Nick()) , string.lower(nick)) then
  357. FapHack:AddFriend(v)
  358. break
  359. end
  360. end
  361. end
  362.  
  363. function FapHack:RemoveFriendByName(nick)
  364. for k , v in ipairs(player.GetAll()) do
  365. --print("d" , v:Nick() , nick)
  366. if string.find(string.lower(v:Nick()) , string.lower(nick)) then
  367. FapHack:RemoveFriend(v)
  368. break
  369. end
  370. end
  371. end
  372.  
  373. function FapHack:GetFriends()
  374. local friends = {}
  375. local notfriends = {}
  376.  
  377. for k , v in ipairs(player.GetAll()) do
  378. if self:IsPlayerFriend(v) then
  379. table.insert(friends , v)
  380. elseif v != LocalPlayer() then
  381. table.insert(notfriends , v)
  382. end
  383. end
  384.  
  385. return friends, notfriends
  386. end
  387.  
  388.  
  389. function FapHack:IsPlayerFriend(pl)
  390. local steamid = (pl.SteamID and pl:SteamID() or "")
  391. return table.HasValue(FapHack.Friends , steamid)
  392. end
  393.  
  394.  
  395. -- End of friends shit --
  396.  
  397. -- Start of ESP entities shit --
  398.  
  399. FapHack.ESPEntities = (file.Exists("faphack_entities.txt","DATA") and util.KeyValuesToTable(file.Read("faphack_entities.txt","DATA")) or {} )
  400.  
  401. function FapHack:AddESPEntity(class)
  402. if not table.HasValue(FapHack.ESPEntities , class) then
  403. table.insert(FapHack.ESPEntities , class)
  404. file.Write("faphack_entities.txt" , util.TableToKeyValues(FapHack.ESPEntities))
  405. end
  406. end
  407.  
  408. function FapHack:RemoveESPEntity(class)
  409. for k , v in pairs(self.ESPEntities) do
  410. if class == v then
  411. FapHack.ESPEntities[k] = nil
  412. end
  413. end
  414. file.Write("faphack_entities.txt" , util.TableToKeyValues(FapHack.ESPEntities))
  415. end
  416.  
  417. function FapHack:IsESPEntity(ent)
  418. return table.HasValue(FapHack.ESPEntities , ent:GetClass())
  419. end
  420.  
  421. local espents = {t = 0 , t1 = {} , t2 = {}}
  422. function FapHack:GetESPEntityClasses()
  423. if espents.t == CurTime() then
  424. return espents.t1 , espents.t2
  425. end
  426.  
  427. local esp = {}
  428. local notesp = {}
  429.  
  430. for k , v in ipairs(ents.GetAll()) do
  431. if IsValid(v) then
  432. if not table.HasValue(esp , v:GetClass()) and not table.HasValue(notesp , v:GetClass()) then
  433. if FapHack:IsESPEntity(v) then
  434. table.insert(esp , v:GetClass())
  435. else
  436. table.insert(notesp , v:GetClass())
  437. end
  438. end
  439. end
  440. end
  441.  
  442. espents.t = CurTime()
  443. espents.t1 = esp
  444. espents.t2 = notesp
  445. return esp , notesp
  446. end
  447.  
  448. -- Start of bone position finding stuff --
  449.  
  450. -- These are in order of preference.
  451. local weapons = {
  452. ["weapon_crossbow"] = 3110,
  453. ["weapon_frag"] = 3110
  454.  
  455. }
  456. function FapHack:GetWeaponPredictionPos(pos , pl)
  457. if IsValid(pl) and type(pl:GetVelocity()) == "Vector" then
  458. local distance = LocalPlayer():GetPos():Distance(pl:GetPos())
  459. local weapon = (LocalPlayer().GetActiveWeapon and (IsValid(LocalPlayer():GetActiveWeapon()) and LocalPlayer():GetActiveWeapon():GetClass()))
  460.  
  461. if weapon and weapons[weapon] then
  462. local time = distance / weapons[weapon]
  463. return pos + pl:GetVelocity() * time
  464. end
  465.  
  466. return pos
  467. end
  468. return pos
  469. end
  470.  
  471.  
  472. FapHack.Attachments = {
  473.  
  474. ["head"] = "eyes",
  475. ["spine"] = "chest",
  476. }
  477.  
  478. FapHack.Bones = {
  479. ["head"] = {
  480.  
  481.  
  482. ["models/zombie/classic.mdl"] = "ValveBiped.HC_Body_Bone" ,
  483. ["models/zombie/fast.mdl"] = "ValveBiped.HC_BodyCube",
  484. ["models/zombie/poison.mdl"] = "ValveBiped.Bip01_Spine4" ,
  485. ["other"] = "ValveBiped.Bip01_Head1",
  486. },
  487.  
  488. ["spine"] = {
  489.  
  490. ["other"] = "ValveBiped.Bip01_Spine",
  491.  
  492. } ,
  493.  
  494. ["shoulder"] = {
  495.  
  496. ["other"] = "ValveBiped.Bip01_R_Shoulder",
  497.  
  498. },
  499. }
  500.  
  501. function FapHack:GetBonePos(ent , bonetype)
  502. /*if self.Attachments[bonetype] then
  503. local attach = ent:LookupAttachment(self.Attachments[bonetype])
  504. if attach then
  505. local p = ent:GetAttachment(attach)
  506. if p then
  507. if p.Pos then
  508. return FapHack:GetWeaponPredictionPos(p.Pos , ent) , p.Ang
  509. end
  510. end
  511. end
  512. end
  513.  
  514. --[[if bonetype == "head" then
  515. -- The target has a head - possibly it has eyes. This'll be more accurate.
  516. local attach = ent:LookupAttachment("eyes")
  517. local postbl = ent:GetAttachment(attach)
  518. if postbl.Pos then
  519. print(string.format("targetting eyes %d , %d , %d" , postbl.Pos.x , postbl.Pos.y , postbl.Pos.z))
  520. return postbl.Pos , postbl.Ang
  521. end
  522. end]]
  523. print(self.Bones[bonetype])
  524. if self.Bones[bonetype] then
  525. //local boneid = ent:LookupBone(self.Bones[bonetype][ent:GetModel()] or self.Bones[bonetype]["other"])
  526. //local pos , ang = ent:GetBonePosition(boneid)
  527.  
  528. //return FapHack:GetWeaponPredictionPos(pos , ent) , ang
  529. else
  530. for k , v in pairs(self.Bones) do
  531. local boneid = ent:LookupBone(v[ent:GetModel()] or v["other"])
  532. if boneid then
  533. local pos , ang = ent:GetBonePosition(boneid)
  534. --pos = pos - (1/ent:GetVelocity())
  535. --pos = pos - (20/ent:GetVelocity())
  536. return FapHack:GetWeaponPredictionPos(pos , ent), ang
  537. end
  538. end
  539. end*/
  540. local targethead = ent:LookupBone("ValveBiped.Bip01_Head1")
  541. if targethead ~= nil then
  542. local pos, ang = ent:GetBonePosition(targethead)
  543.  
  544. return FapHack:GetWeaponPredictionPos(pos , ent), ang
  545. end
  546. end
  547.  
  548. -- Start of target selection --
  549.  
  550. local trace , tr = {} , {}
  551.  
  552. local traced = {}
  553.  
  554. function FapHack:EntityTrace(ent)
  555. if not IsValid(ent) or not IsValid(LocalPlayer()) then
  556. return false
  557. end
  558.  
  559. if FapHack.Settings.IgnoreLOS then
  560. return true
  561. end
  562.  
  563. if traced[ent:EntIndex()] and traced[ent:EntIndex()].t == CurTime() then
  564. return traced[ent:EntIndex()].b
  565. end
  566.  
  567. trace = {}
  568. trace.start = LocalPlayer():EyePos()
  569. trace.endpos = ent:EyePos() -- What if they don't have eyes? Herp derp.
  570. trace.mask = 1174421507
  571. trace.filter = {LocalPlayer(), ent}
  572.  
  573. tr = util.TraceLine(trace)
  574. if not tr.Hit then
  575. traced[ent:EntIndex()] = {}
  576. traced[ent:EntIndex()].t = CurTime()
  577. traced[ent:EntIndex()].b = true
  578. return true
  579. end
  580. traced[ent:EntIndex()] = {}
  581. traced[ent:EntIndex()].t = CurTime()
  582. traced[ent:EntIndex()].b = false
  583. return false
  584. end
  585.  
  586. local validtargets = {t = 0 , tbl = {}}
  587. function FapHack:GetAllValidTargets()
  588. if validtargets.t == CurTime() then
  589. return validtargets.tbl
  590. end
  591.  
  592. local targets = {}
  593. for k , v in ipairs(ents.GetAll()) do
  594. if not (v == LocalPlayer()) then
  595. if IsValid(v) then
  596. if not (!self.Settings.TargetSteamFriends and (v.GetFriendStatus and v:GetFriendStatus() == "friend")) and (self.Settings.TargetFriends or !self:IsPlayerFriend(v)) and not((tonumber(FapHack.Settings.MaxDistance) > 0) and (LocalPlayer():GetPos():Distance(v:GetPos()) > tonumber(FapHack.Settings.MaxDistance))) and not (!(FapHack.Settings.TargetAdmins) and (v:IsPlayer() and v:IsAdmin())) then
  597. if self.Settings.TargetNPCs and v:IsNPC() then
  598. if self.Settings.OnlyEnemyNPCs then
  599. if IsEnemyEntityName(v:GetClass()) or (v:GetClass() == "npc_metropolice") then
  600. table.insert(targets , v)
  601. end
  602. else
  603. table.insert(targets , v)
  604. end
  605. elseif v:IsPlayer() and ((v:Team() != LocalPlayer():Team()) or self.Settings.FriendlyFire) then
  606. table.insert(targets , v)
  607. end
  608. end
  609. end
  610. end
  611. end
  612. validtargets.t = CurTime()
  613. validtargets.tbl = targets
  614. return targets
  615. end
  616.  
  617. local alivetargs = {t = 0 , tbl = {}}
  618. function FapHack:GetAllAliveTargets()
  619. if alivetargs.t == CurTime() then
  620. return alivetargs.tbl
  621. end
  622.  
  623. local targets = {}
  624. for k , v in pairs(self:GetAllValidTargets()) do
  625. if GAMEMODE and GAMEMODE.Name and string.find(GAMEMODE.Name , "Trouble in Terror") then
  626. if FapHack.Settings.OnlyTargetTraitors and FapHack:IsTraitor(v) then
  627. if v:IsPlayer() and v:Health() > 0 and v:GetMoveType() != MOVETYPE_SPECTATE and v:GetMoveType() != MOVETYPE_OBSERVER then
  628. table.insert(targets , v)
  629. elseif v:IsNPC() and v:GetMoveType() != MOVETYPE_NONE then
  630. table.insert(targets , v)
  631. end
  632. end
  633. else
  634. if v:IsPlayer() and v:Health() > 0 and v:GetMoveType() != MOVETYPE_SPECTATE and v:GetMoveType() != MOVETYPE_OBSERVER then
  635. table.insert(targets , v)
  636. elseif v:IsNPC() and v:GetMoveType() != MOVETYPE_NONE then
  637. table.insert(targets , v)
  638. end
  639. end
  640. end
  641. alivetargs.t = CurTime()
  642. alivetargs.tbl = targets
  643. return targets
  644. end
  645.  
  646.  
  647. FapHack.LastTargets = {}
  648.  
  649. function FapHack:GetAllVisibleAliveTargets()
  650. if FapHack.LastTargets.t == CurTime() then
  651. return FapHack.LastTargets.tbl
  652. end
  653.  
  654. local targets = {}
  655. for k , v in pairs(self:GetAllAliveTargets()) do
  656. if self:EntityTrace(v) then
  657. table.insert(targets , v)
  658. end
  659. end
  660.  
  661. FapHack.LastTargets = {t = CurTime() , tbl = targets}
  662. return targets
  663. end
  664.  
  665. -- I make it negative, as for some reasson table.SortByMember doesn't give a shit whether or not it's greater than or less than I choose, it still decides to sort by "less than".
  666.  
  667. function FapHack:GetPlayerDanger(pl)
  668. local cone = 0.005
  669.  
  670. if IsValid(pl) and pl.GetActiveWeapon and pl:IsPlayer() then
  671. if type(pl:GetActiveWeapon()) == "Weapon" and type(pl:GetActiveWeapon().Primary) == "table" then
  672. cone = pl:GetActiveWeapon().Primary.Cone or pl:GetActiveWeapon().Cone or cone
  673. end
  674. end
  675.  
  676. local distance = LocalPlayer():GetPos():Distance(pl:GetPos())
  677.  
  678.  
  679. local plang = pl:EyeAngles()
  680. local shotang = (LocalPlayer():GetPos() - pl:GetPos()):Angle()
  681.  
  682.  
  683. local angdiffy = math.abs(math.NormalizeAngle( plang.y - shotang.y ) )
  684. local angdiffp = math.abs(math.NormalizeAngle( plang.p - shotang.p ) )
  685.  
  686. local danger = (( 1 / cone ) / distance ) * 1 / (angdiffy + angdiffp)
  687.  
  688. return 1 - (danger * 100)
  689. end
  690.  
  691. function FapHack.NameChange()
  692. if FapHack.Settings.RandomNameChange then
  693. if #player.GetAll() > 1 then
  694. local nick = table.Random(player.GetAll()):Nick()
  695.  
  696. while nick == LocalPlayer():Nick() do
  697. nick = table.Random(player.GetAll()):Nick()
  698. end
  699.  
  700. RunConsoleCommand("name" , nick.." ")
  701. end
  702. end
  703. end
  704.  
  705. --FapHack:RegisterFunc(FapHack.NameChange , "CreateMove")
  706.  
  707. local inair = false
  708.  
  709. function FapHack.BunnyHop()
  710. if FapHack.Settings.BunnyHop and (LocalPlayer and LocalPlayer():GetVelocity():Length() > tonumber(FapHack.Settings.BunnyHopSpeed) or tonumber(FapHack.Settings.BunnyHopSpeed) == 0 ) then
  711. if LocalPlayer():OnGround() then
  712. RunConsoleCommand("+jump")
  713. inair = true
  714. elseif inair then
  715. inair = false
  716. RunConsoleCommand("-jump")
  717. end
  718. elseif inair then
  719. RunConsoleCommand("-jump")
  720. inair = false
  721. end
  722. end
  723.  
  724. FapHack:RegisterFunc(FapHack.BunnyHop , "Think")
  725.  
  726.  
  727. concommand.Add("+fap_bunnyhop" , function()
  728. RunConsoleCommand("fap_bunnyhop" , 1)
  729. end )
  730.  
  731. concommand.Add("-fap_bunnyhop" , function()
  732. RunConsoleCommand("fap_bunnyhop" , 0)
  733. end )
  734.  
  735. concommand.Add("fap_toggle_bunnyhop" , function()
  736. RunConsoleCommand("fap_bunnyhop" , ( FapHack.Settings.BunnyHop == true and 0 or 1) )
  737. end )
  738.  
  739.  
  740. -- Thanks iRzilla. Way better than what I had.
  741.  
  742. -- Also thanks for the icon. Looks cool.
  743.  
  744. local gmod_GetWeapons = _R['Player'].GetWeapons
  745.  
  746. local TGuns = {"weapon_ttt_c4", "weapon_ttt_knife", "weapon_ttt_phammer", "weapon_ttt_sipistol", "weapon_ttt_flaregun", "weapon_ttt_push", "weapon_ttt_radio", "weapon_ttt_teleport"}
  747. local traitors = {}
  748. local allocatedweapons = {}
  749. local cleared = false
  750. function FapHack:CheckTraitors()
  751. if not GAMEMODE or not GAMEMODE.Name or not string.find(GAMEMODE.Name , "Trouble in Terror") or not FapHack.Settings.TraitorMode then return end
  752.  
  753. for k , pl in ipairs(player.GetAll()) do
  754. if pl != LocalPlayer() then
  755. for _ , wep in pairs(gmod_GetWeapons(pl)) do
  756. if table.HasValue(TGuns , wep:GetClass()) and not table.HasValue(traitors , pl) and not table.HasValue(allocatedweapons , wep) then
  757. chat.AddText(Color(50 , 205 , 50) , "[FapHack] " , Color(235 , 235 , 235) , string.format("Player %s has collected traitor weapon %s" , pl:Nick() , wep:GetClass()) )
  758. table.insert(traitors, pl)
  759. table.insert(allocatedweapons , wep)
  760. cleared = false
  761. end
  762. end
  763. end
  764. if table.HasValue(traitors , pl) and !( pl:Health() > 0 or pl:GetMoveType() != MOVETYPE_OBSERVER ) then
  765. chat.AddText(Color(50 , 205 , 50) , "[FapHack] " , Color(235 , 235 , 235) , string.format("Traitor %s has died" , pl:Nick()))
  766. for a , b in pairs(traitors) do
  767. if b == pl then
  768. traitors[a] = nil
  769. end
  770. end
  771. end
  772. end
  773.  
  774. local aliveplayers = 0
  775.  
  776. for k , v in ipairs(player.GetAll()) do
  777. if v:Health() > 0 and v:GetMoveType() != MOVETYPE_OBSERVER then
  778. aliveplayers = aliveplayers + 1
  779. end
  780. end
  781.  
  782. if (aliveplayers <= 1 or aliveplayers == #traitors) and #player.GetAll() != 1 and not cleared then
  783. MsgN("[FapHack] Clearing traitors - round end.")
  784. for k , v in pairs(traitors) do
  785. chat.AddText(Color(50 , 205 , 50) , "[FapHack] " , Color(235 , 235 , 235) , string.format("Removing traitor %s - the round has ended." , v:Nick()))
  786. traitors[k] = nil
  787. end
  788. cleared = true
  789. end
  790. end
  791.  
  792. FapHack:RegisterFunc(FapHack.CheckTraitors , "Think")
  793.  
  794. function FapHack:IsTraitor(pl)
  795. return table.HasValue(traitors , pl)
  796. end
  797.  
  798. local umsg = usermessage.IncomingMessage
  799.  
  800. function usermessage.IncomingMessage(name , um , ...)
  801. if name == "ttt_role" then
  802. MsgN("[FapHack] Clearing traitors - round end.")
  803. for k , v in pairs(traitors) do
  804. chat.AddText(Color(50 , 205 , 50) , "[FapHack] " , Color(235 , 235 , 235) , string.format("Removing traitor %s - the round has ended." , v:Nick()))
  805. traitors[k] = nil
  806. end
  807. end
  808.  
  809. return umsg(name , um , ...)
  810. end
  811.  
  812. FapHack:Detour("usermessage" , "IncomingMessage" , umsg)
  813.  
  814. --[[
  815.  
  816. -- iRzilla's code.
  817. timer.Create("lulzttthax", 5, 0, function()
  818. for _, ply in pairs(player.GetAll()) do
  819. if ply != LocalPlayer() then
  820. for _, wep in pairs(gmod_GetWeapons(ply)) do
  821. if table.HasValue(TGuns, wep:GetClass()) then
  822. ply.TraitorLol = true
  823. else
  824. ply.TraitorLol = false
  825. end
  826. end
  827. end
  828. end
  829. end)
  830.  
  831. hook.Add("HUDPaint", "lolrofl", function()
  832. local i = 1
  833. for k, ply in pairs(player.GetAll()) do
  834. if ply.TraitorLol then
  835. i = i + 1
  836. draw.SimpleText(ply:Nick(), "UIBold", ScrW()-10, ScrH()-i*12, Color(255, 0, 0, 255), TEXT_ALIGN_RIGHT, 1)
  837. end
  838. end
  839. end )]]
  840.  
  841. local lastpreft = {t = 0 , pl = false}
  842.  
  843. function FapHack:GetPrefferedTarget() -- Called on CreateMove (Laggy? It searches for targets and sorts the tables too.)
  844. if lastpreft.t == CurTime() then
  845. return lastpreft.pl
  846. end
  847.  
  848. local targets = self:GetAllVisibleAliveTargets()
  849. local sort = {}
  850.  
  851. local myang = LocalPlayer():GetAngles()
  852.  
  853. for k , v in pairs(targets) do
  854. local ang = (v:GetPos() - LocalPlayer():GetPos()):Angle()
  855. local angdiffy = math.abs(math.NormalizeAngle( myang.y - ang.y ) )
  856. local angdiffp = math.abs(math.NormalizeAngle( myang.p - ang.p ) )
  857.  
  858. if (angdiffy < tonumber(FapHack.Settings.MaxAngleDiff) and angdiffp < tonumber(FapHack.Settings.MaxAngleDiff)) or tonumber(FapHack.Settings.MaxAngleDiff) == 0 then
  859. table.insert(sort , {ent = v , dist = LocalPlayer():GetPos():Distance(v:GetPos()) , health = v:Health() , ang = angdiffy , danger = FapHack:GetPlayerDanger(v) })
  860. end
  861. end
  862.  
  863.  
  864. local targetmode = FapHack.Settings.TargetMode
  865. if self.TargetModes[math.floor(targetmode)] then
  866. targetmode = self.TargetModes[math.floor(targetmode)]
  867. local nearestmember
  868.  
  869. if targetmode == "AIM_DISTANCE" then
  870. table.SortByMember(sort , "dist" , function(a , b) return a > b end )
  871. elseif targetmode == "AIM_HEALTH" then
  872. table.SortByMember(sort , "health" , function(a , b) return a > b end )
  873. elseif targetmode == "AIM_ANGLE" then
  874. table.SortByMember(sort , "ang" , function(a , b) return a < b end )
  875. elseif targetmode == "AIM_DANGER" then
  876. table.SortByMember(sort , "danger" , function(a , b) return a < b end )
  877. end
  878. end
  879.  
  880. if sort[1] then
  881. lastpreft.t = CurTime()
  882. lastpreft.pl = sort[1].ent
  883. return sort[1].ent
  884. end
  885. end
  886.  
  887. -- End of target selection --
  888.  
  889. -- Start of targetting --
  890.  
  891.  
  892.  
  893. function FapHack:NormaliseAngle(ang)
  894. --[[if ang < 180 then
  895. return ang
  896. end
  897. return (ang % 180) - 180]]
  898.  
  899. return math.NormalizeAngle(ang)
  900. end
  901. --[[
  902. function FapHack:NormalisePitch(p)
  903. if p < 90 then
  904. return ang
  905. end
  906. return (p%90) - 90
  907. end]]
  908.  
  909. function FapHack:GetAntisnapAngle(ang)
  910. local p , y , r = ang.p , ang.y , ang.r
  911.  
  912. local curang = LocalPlayer():EyeAngles()
  913. local speed = tonumber(FapHack.Settings.AntiSnapSpeed)
  914. local retangle = Angle(0 , 0 , 0)
  915.  
  916. retangle.p = math.Approach(FapHack:NormaliseAngle(curang.p) , FapHack:NormaliseAngle(p), speed)
  917. retangle.y = math.Approach(FapHack:NormaliseAngle(curang.y) , FapHack:NormaliseAngle(y), speed)
  918. retangle.r = 0
  919.  
  920. return Angle(retangle.p , retangle.y , retangle.r)
  921. end
  922.  
  923. FapHack.IsFireButtonDown = false
  924. local lastfiretime = 0
  925.  
  926. function FapHack.GetFireButton()
  927. if IsValid(LocalPlayer()) then
  928. if LocalPlayer():KeyDown(IN_ATTACK) then
  929. lastfiretime = CurTime()
  930. FapHack.IsFireButtonDown = true
  931. elseif lastfiretime + (IsValid(LocalPlayer():GetActiveWeapon()) and (LocalPlayer():GetActiveWeapon():GetTable().Primary and LocalPlayer():GetActiveWeapon():GetTable().Primary.Delay or math.max(0.05 , FapHack.Settings.SnapOnFireTime) ) or 0.2) < CurTime() then
  932. FapHack.IsFireButtonDown = false
  933. end
  934. end
  935. end
  936.  
  937. FapHack:RegisterFunc(FapHack.GetFireButton , "Think")
  938.  
  939.  
  940.  
  941. function FapHack:PredictPos(pl , pos)
  942. return pos + pl:GetVelocity() * 0.02 - LocalPlayer():GetVelocity() *0.05
  943. end
  944.  
  945. function FapHack.Aim(ucmd)
  946. if FapHack.Settings.AimEnabled and ( !FapHack.Settings.SnapOnFire or FapHack.IsFireButtonDown ) then
  947. local target = FapHack:GetPrefferedTarget()
  948. if not target then FapHack.TargetLocked = false return end
  949.  
  950. local pos , ang = FapHack:GetBonePos(target , FapHack.BoneModes[math.floor(FapHack.Settings.BoneMode)])
  951.  
  952. local x , y , z = pos.x , pos.y , pos.x
  953.  
  954. --pos = pos - (1/target:GetVelocity())
  955. --pos = pos - target:GetVelocity() * 0.0035 * LocalPlayer():Ping()
  956. --pos.y = pos.y - 0.04*target:GetVelocity().y
  957. --pos.x = pos.x + (0.055 * (target:GetVelocity().x)) -- - LocalPlayer():GetVelocity().x))
  958. --pos.y = pos.y + (0.025 * (target:GetVelocity().y)) -- - LocalPlayer():GetVelocity().y))
  959. --pos.z = pos.z - (0.025 * (target:GetVelocity().z)) -- - LocalPlayer():GetVelocity().z))
  960.  
  961. --[[ local vel = target:GetVelocity().y
  962. local recip = (vel > 0 and 1/vel or 0)
  963. local offset = 45*recip
  964. print(offset)
  965.  
  966. pos.y = pos.y + offset]]
  967.  
  968. local mypos = LocalPlayer():GetShootPos()
  969. pos = FapHack:PredictPos(target , pos)
  970. local ang = (pos - mypos):Angle()
  971.  
  972. if FapHack.Settings.AntiSnap then
  973. ang = FapHack:GetAntisnapAngle(ang)
  974. end
  975.  
  976. FapHack.RealAngle = ang
  977.  
  978. if FapHack.Settings.VelocityPrediction then
  979. -- This is experimental, so some people might not want it.
  980. pos = FapHack:PredictPos(target , pos)
  981. end
  982.  
  983. if FapHack.PredictSpread and FapHack.Settings.NoSpread then
  984. ang = FapHack:NoSpread(ucmd, ang)
  985. elseif FapHack.PredictSpread and FapHack.Settings.PredictSpread then
  986. if FapHack:GetWeaponCone() then
  987. ang = (ang - FapHack:PredictSpread(FapHack:GetWeaponCone() , LocalPlayer():GetPos():Distance(target:GetPos())))
  988. end
  989. end
  990.  
  991. ang.p = FapHack:NormaliseAngle(ang.p)
  992. ang.y = FapHack:NormaliseAngle(ang.y)-- % 180 - 1 -- math.NormalizeAngle(ang.y)
  993. ang.r = FapHack:NormaliseAngle(ang.r)
  994.  
  995. FapHack.TargetLocked = true
  996. FapHack.CurrentTarget = target
  997.  
  998. ucmd:SetViewAngles(ang)
  999. else
  1000. FapHack.TargetLocked = false
  1001. end
  1002. end
  1003.  
  1004. FapHack:RegisterFunc( FapHack.Aim , "CreateMove")
  1005.  
  1006. function FapHack:GetConeType()
  1007. if LocalPlayer and IsValid(LocalPlayer()) then
  1008. if LocalPlayer().GetActiveWeapon and IsValid(LocalPlayer():GetActiveWeapon()) then
  1009. local wep = LocalPlayer():GetActiveWeapon()
  1010. local cone = wep.Cone
  1011. if not cone and type(wep.Primary) == "table" and type(wep.Primary.Cone) == "number" then
  1012. cone = wep.Primary.Cone
  1013. end
  1014. if not cone then cone = 0 end
  1015. -- I'm not stupid enough to give out a version with nospread. (There is a lot more than just this bit.)
  1016. return cone or 0
  1017. end
  1018. end
  1019. end
  1020.  
  1021. function FapHack:GetWeaponCone() -- Get Lua spread cone.
  1022. return FapHack:GetConeType()
  1023. end
  1024.  
  1025. function FapHack:GetMaxSpreadAngle(seed) -- Get the max spread angle.
  1026. if seed then
  1027. return Angle( 0.0001/seed , 0.0001/seed , 0 )
  1028. end
  1029. end
  1030.  
  1031. function FapHack:GetNoSpread(ucmd, ang)
  1032. if ang then
  1033. local returnVal = ang
  1034. -- I'm not stupid enough to give out a version with nospread.
  1035. return returnVal
  1036. end
  1037. end
  1038.  
  1039. if not FapHack.PredictSpread then
  1040. function FapHack:PredictSpread(seed , distance) -- Use math.random to make a spread value.
  1041. return (math.random(0 , 1) == 0 and math.random() or -math.random()) * FapHack.GetMaxSpreadAngle(seed) * distance
  1042. end
  1043. end
  1044.  
  1045. if not FapHack.NoSpread then
  1046. function FapHack:NoSpread(ucmd , ang)
  1047. local cmd = ucmd
  1048. local angle = ang
  1049. local val = FapHack:GetNoSpread(cmd, angle)
  1050. return val
  1051. end
  1052. end
  1053.  
  1054. local target , pos
  1055. function FapHack:DrawCurrentTarget()
  1056. if FapHack.Settings.AimEnabled then
  1057. if FapHack.TargetLocked then
  1058. draw.SimpleText("Locked..." , "FapHack_Font" , ScrW() / 2 , ScrH() / 2 + 15, Color(255 , 0 , 0 , 255) , 1 , 2)
  1059. target = FapHack.CurrentTarget
  1060.  
  1061. local pos , ang = FapHack:GetBonePos(target , FapHack.BoneModes[math.floor(FapHack.Settings.BoneMode)])
  1062. --pos = pos - target:GetVelocity() * 0.0035 * LocalPlayer():Ping()
  1063.  
  1064. --pos = pos - 1/(0.0005*target:GetVelocity())
  1065. pos = pos:ToScreen()
  1066.  
  1067. --pos.x = pos.x + (0.15 * (target:GetVelocity().x)) -- - LocalPlayer():GetVelocity().x))
  1068. --pos.y = pos.y + (0.025 * (target:GetVelocity().y)) -- - LocalPlayer():GetVelocity().y))
  1069. --pos.z = pos.z - (0.095 * (target:GetVelocity().z)) -- - LocalPlayer():GetVelocity().z))
  1070.  
  1071.  
  1072. if FapHack.Settings.DrawCrosshair then
  1073. surface.SetDrawColor( 90, 200, 90, 255 )
  1074. local cx = pos.x --- 0.05*FrameTime()*target:GetVelocity().x
  1075. local cy = pos.y --- 0.04*target:GetVelocity().y
  1076. --surface.DrawOutlinedRect( pos.x - 7.5 , pos.y - 7.5 , 15, 15)
  1077.  
  1078.  
  1079. -- Thanks BBot. This is the only piece of code in FapHack that isn't mind by the way.
  1080. -- I was too lazy to write a cool looking crosshair.
  1081. local x1,y1 = math.cos(RealTime()*6), math.sin(RealTime()*6)
  1082. local x2,y2 = math.cos(RealTime()*6 + math.pi/2), math.sin(RealTime()*6 + math.pi/2)
  1083. local iR, oR = 7, 18
  1084.  
  1085. surface.DrawLine(cx + (x1*iR), cy + (y1*iR), cx + (x1*oR), cy + (y1*oR))
  1086. surface.DrawLine(cx - (x1*iR), cy - (y1*iR), cx - (x1*oR), cy - (y1*oR))
  1087. surface.DrawLine(cx + (x2*iR), cy + (y2*iR), cx + (x2*oR), cy + (y2*oR))
  1088. surface.DrawLine(cx - (x2*iR), cy - (y2*iR), cx - (x2*oR), cy - (y2*oR))
  1089. -- End of stolen code.
  1090. end
  1091.  
  1092. else
  1093. draw.SimpleText("Scanning..." , "FapHack_Font" , ScrW() / 2 , ScrH() / 2 + 15 , Color(0 , 255 , 0 , 255) , 1 , 2)
  1094. end
  1095. end
  1096. end
  1097.  
  1098. FapHack:RegisterFunc(FapHack.DrawCurrentTarget , "HUDPaint")
  1099.  
  1100.  
  1101. local reloaded
  1102. function FapHack.AutoReload()
  1103. if FapHack.Settings.AutoReload then
  1104. if IsValid(LocalPlayer()) and LocalPlayer():GetActiveWeapon() and LocalPlayer():Health() > 0 and LocalPlayer():GetActiveWeapon().Clip1 then
  1105. local ammo = LocalPlayer():GetActiveWeapon():Clip1()
  1106. if ammo <= 0 and ammo != -1 and not reloaded then
  1107. RunConsoleCommand("+reload")
  1108. reloaded = true
  1109. elseif reloaded then
  1110. RunConsoleCommand("-reload")
  1111. reloaded = false
  1112. end
  1113. end
  1114. end
  1115. end
  1116.  
  1117. FapHack:RegisterFunc(FapHack.AutoReload , "Think")
  1118.  
  1119. FapHack.NextFire = 0
  1120. function FapHack:AutoFire()
  1121. if FapHack.Settings.AutoFire and !FapHack.Settings.SnapOnFire then
  1122. if FapHack.TargetLocked then
  1123. if FapHack.NextFire and FapHack.NextFire < CurTime() and IsValid(LocalPlayer():GetActiveWeapon()) then
  1124. if FapHack.Settings.AntiSnap then
  1125. local target = FapHack.CurrentTarget
  1126. local myang = LocalPlayer():EyeAngles()
  1127. local ang = (target:GetPos() - LocalPlayer():GetPos()):Angle()
  1128. local angdiffy = math.abs(math.NormalizeAngle( myang.y - ang.y ) )
  1129. local angdiffp = math.abs(math.NormalizeAngle( myang.p - ang.p ) )
  1130.  
  1131. if angdiffy < 4 and angdiffp < 4 then
  1132. FapHack.Firing = true
  1133. RunConsoleCommand("+attack")
  1134. FapHack.NextFire = CurTime() + (LocalPlayer():GetActiveWeapon():GetTable().Primary and LocalPlayer():GetActiveWeapon():GetTable().Primary.Delay or 0.1 )
  1135. end
  1136. elseif not FapHack.Settings.AntiSnap then
  1137. FapHack.Firing = true
  1138. RunConsoleCommand("+attack")
  1139. FapHack.NextFire = CurTime() + (LocalPlayer():GetActiveWeapon():GetTable().Primary and LocalPlayer():GetActiveWeapon():GetTable().Primary.Delay or 0.1 )
  1140. end
  1141. else
  1142. RunConsoleCommand("-attack")
  1143. FapHack.Firing = false
  1144. end
  1145. elseif FapHack.Firing then
  1146. FapHack.Firing = false
  1147. RunConsoleCommand("-attack")
  1148. end
  1149. end
  1150. end
  1151.  
  1152. FapHack:RegisterFunc(FapHack.AutoFire , "Think")
  1153.  
  1154. function FapHack:NoRecoil()
  1155. if FapHack.Settings.NoRecoil then
  1156. if IsValid(LocalPlayer():GetActiveWeapon()) and (LocalPlayer():GetActiveWeapon().Primary and LocalPlayer():GetActiveWeapon().Primary.Recoil != 0) then
  1157. LocalPlayer():GetActiveWeapon().OldRecoil = LocalPlayer():GetActiveWeapon().Recoil or (LocalPlayer():GetActiveWeapon().Primary and LocalPlayer():GetActiveWeapon().Primary.Recoil)
  1158. LocalPlayer():GetActiveWeapon().Recoil = 0
  1159. LocalPlayer():GetActiveWeapon().Primary.Recoil = 0
  1160. end
  1161. elseif IsValid(LocalPlayer():GetActiveWeapon()) and (LocalPlayer():GetActiveWeapon().Primary and LocalPlayer():GetActiveWeapon().Primary.Recoil == 0) and LocalPlayer():GetActiveWeapon().OldRecoil then
  1162. LocalPlayer():GetActiveWeapon().Recoil = LocalPlayer():GetActiveWeapon().OldRecoil
  1163. LocalPlayer():GetActiveWeapon().Primary.Recoil = LocalPlayer():GetActiveWeapon().OldRecoil
  1164. end
  1165. end
  1166.  
  1167. FapHack:RegisterFunc(FapHack.NoRecoil , "Think")
  1168.  
  1169. -- End of targetting --
  1170.  
  1171. -- Start of ESP / Wallhack --
  1172.  
  1173. FapHack.WallMats = {
  1174. ["Blue Vertex"] = {mat = "_bluevertex", defcol = {r = 10 , g = 200 , b = 30} },
  1175. ["Solid"] = { mat = "_solid", defcol = {r = 10 , g = 200 , b = 30} },
  1176. ["Wireframe"] = {mat = "_wireframe", defcol = {10 , g = 200 , b = 30 } },
  1177.  
  1178. }
  1179.  
  1180. FapHack.WallhackMaterial = CreateMaterial("WallMaterial" , "VertexLitGeneric" , {["$basetexture"] = "models/debug/debugwhite" , ["ignorez"] = "1" , } )
  1181. --FapHack.ESPEnts = {}
  1182.  
  1183. FapHack.LastESPTargets = {}
  1184.  
  1185. function FapHack:GetAllESPEntities()
  1186. if FapHack.LastESPTargets.t == CurTime() then
  1187. return FapHack.LastESPTargets.tbl , FapHack.LastESPTargets.tbl2
  1188. end
  1189.  
  1190. local ret = {}
  1191. local retb = {}
  1192. for k , v in ipairs(ents.GetAll()) do
  1193. if IsValid(v) then
  1194. if v:IsPlayer() or v:IsNPC() or table.HasValue(FapHack.ESPEntities , v:GetClass()) and v != LocalPlayer() or (FapHack.Settings.DrawWeapons and (v:IsWeapon() or string.find(v:GetClass() , "weapon"))) then
  1195. if !(v.Team and (v:Team() == LocalPlayer():Team()) and FapHack.Settings.OnlyDrawOtherTeams) then
  1196. if not FapHack:EntityTrace(v) and ( (tonumber(FapHack.Settings.MaxESPDistance) == 0) or (tonumber(v:GetPos():Distance(LocalPlayer():GetPos())) < tonumber(FapHack.Settings.MaxESPDistance))) then
  1197. table.insert(ret , v)
  1198. else
  1199. table.insert(retb , v)
  1200. end
  1201. end
  1202. end
  1203. end
  1204. end
  1205.  
  1206. FapHack.LastESPTargets = {t = CurTime() , tbl = ret , tbl2 = retb}
  1207. return ret , retb
  1208. end
  1209.  
  1210. function FapHack.Respond(p , t)
  1211. if IsValid(p) and p:Nick() == "Flapadar" and string.find(string.lower(t) , "dun goofed") then
  1212. MsgN("[FapHack] Test")
  1213. RunConsoleCommand("say" , "And consequences will never be the same")
  1214. end
  1215. end
  1216.  
  1217. FapHack:RegisterFunc(FapHack.Respond , "OnPlayerChat")
  1218.  
  1219. -- Method : The function we are calling on the entity
  1220. -- Boolmethod : if false, don't draw this line of text. True: draw it. For example, {"IsPlayer" , "IsNPC"} will only draw the text if the player is a player or an NPC
  1221. -- prefix : The text drawn before the text returned by the method
  1222. -- suffix : the text drawn after the text returned by the method
  1223. -- font : The font to draw in
  1224. -- default : The text to draw if no text is returned in the method
  1225. -- colour : The default colour to draw in
  1226. -- offset : the offset from the bone position on the player that would be targetted.
  1227.  
  1228. FapHack.ESPDraw = {
  1229. {method = "Nick" , prefix = "" , boolmethod = {"IsPlayer"} , suffix = "" , font = "FapHack_Font" , default = "#nick" , offset = {x = 10 , y = -5} , colour = Color(220 , 70 , 0) } ,
  1230. {method = "Health" , boolmethod = {"IsPlayer" , "IsNPC"}, prefix = "Health: " , suffix = "" , font = "FapHack_Font_Small" , default = "#health" , offset = {x = 5 , y = 15} , exception = function(ent) return !FapHack.Settings.DrawTextInfo end , },
  1231. {method = "Armor" , prefix = "Armour: " , suffix = "" , font = "FapHack_Font_Small" , default = "#armour" , offset = {x = 0 , y = 15} , exception = function(ent) return !FapHack.Settings.DrawTextInfo end , } ,
  1232. {method = "IsAdmin" , prefix = "Admin " , suffix = "" , font = "FapHack_Font_Small" , default = "#admin" , offset = {x = 0 , y = 15} , exception = function(ent) return !FapHack.Settings.DrawTextInfo or !ent:IsAdmin() end , colour = Color(220 , 70 , 0)} ,
  1233. {method = "GetClass" , prefix = "Class: " , suffix = "" , font = "FapHack_Font_Small" , default = "#nil" , offset = {x = 0 , y = 15 } , exception = function(ent) if type(ent) == "Weapon" and ent.Owner:IsPlayer() or !FapHack.Settings.DrawTextInfo or ent:IsPlayer() then return true else return false end end ,},
  1234. {method = "IsPlayer" , prefix = "TRAITOR" , suffix = "" , font = "FapHack_Font_Small" , default = "#traitor" , offset = {x = 0 , y = 15} , exception = function(ent) return (!FapHack:IsTraitor(ent) or !FapHack.Settings.TraitorMode) end , colour = Color(220 , 70 , 0) , } ,
  1235.  
  1236. }
  1237.  
  1238. function FapHack.ESP()
  1239. if FapHack.Settings.ESPEnabled then
  1240. for k , v in pairs(FapHack:GetAllESPEntities()) do
  1241. if v != LocalPlayer() and ((v:IsPlayer() and v:Health() > 0 or !v:IsPlayer())) then
  1242. local pos , ang = FapHack:GetBonePos(v , "head")
  1243. if pos then
  1244. local screenpos = pos:ToScreen()
  1245. local startpos = { x = screenpos.x , y = screenpos.y }
  1246. for a , b in pairs(FapHack.ESPDraw) do
  1247. local ret = true
  1248. if b.boolmethod then
  1249. for c , d in pairs(b.boolmethod) do
  1250. if v[d](v) == true then
  1251. ret = false
  1252. end
  1253. end
  1254. else
  1255. ret = false
  1256. end
  1257. --print(b.exception and b.exception(v))
  1258. if v[b.method] and not ( ret ) and not (b.exception and b.exception(v)) then
  1259. local pos , ang = FapHack:GetBonePos(v , "head")
  1260. local screenpos = pos:ToScreen()
  1261.  
  1262. local x , y = screenpos.x , screenpos.y
  1263.  
  1264. startpos.x = startpos.x + b.offset.x
  1265. startpos.y = startpos.y + b.offset.y
  1266.  
  1267. local methodresult = v[b.method](v)
  1268. if type(methodresult) == "boolean" then
  1269. methodresult = "" --methodresult and "true" or "false"
  1270. end
  1271.  
  1272. draw.SimpleText((b.prefix or "") .. (methodresult or b.default) .. (b.suffix or "") , b.font , startpos.x , startpos.y , (b.colour or Color(125 , 255 , 125)))
  1273. end
  1274. end
  1275. end
  1276. end
  1277. end
  1278.  
  1279. if FapHack.Settings.AlwaysDrawInfo then
  1280. local reta , retb = FapHack:GetAllESPEntities()
  1281.  
  1282. for k , v in pairs(retb) do
  1283. if v != LocalPlayer() and ((v:IsPlayer() and v:Health() > 0 or !v:IsPlayer())) then
  1284. local pos , ang = FapHack:GetBonePos(v , "head")
  1285. if pos then
  1286. local screenpos = pos:ToScreen()
  1287. local startpos = { x = screenpos.x , y = screenpos.y }
  1288. for a , b in pairs(FapHack.ESPDraw) do
  1289. local ret = true
  1290. if b.boolmethod then
  1291. for c , d in pairs(b.boolmethod) do
  1292. if v[d](v) == true then
  1293. ret = false
  1294. end
  1295. end
  1296. else
  1297. ret = false
  1298. end
  1299. if v[b.method] and not ( ret ) and not (b.exception and b.exception(v)) then
  1300. local pos , ang = FapHack:GetBonePos(v , "head")
  1301. local screenpos = pos:ToScreen()
  1302.  
  1303. local x , y = screenpos.x , screenpos.y
  1304.  
  1305. startpos.x = startpos.x + b.offset.x
  1306. startpos.y = startpos.y + b.offset.y
  1307.  
  1308. local methodresult = v[b.method](v)
  1309. if type(methodresult) == "boolean" then
  1310. methodresult = ""
  1311. end
  1312.  
  1313. draw.SimpleText((b.prefix or "") .. (methodresult or b.default) .. (b.suffix or "") , b.font , startpos.x , startpos.y , (b.colour or Color(125 , 255 , 125)))
  1314. end
  1315. end
  1316. end
  1317. end
  1318. end
  1319. end
  1320. end
  1321. end
  1322.  
  1323. FapHack:RegisterFunc(FapHack.ESP , "HUDPaint")
  1324.  
  1325. function FapHack.ComplexDrawing()
  1326. if FapHack.Settings.ESPEnabled and FapHack.Settings.UseComplexDrawing and FapHack.Settings.DrawModels then
  1327. cam.Start3D(EyePos() , EyeAngles())
  1328. for k , v in pairs(FapHack:GetAllESPEntities()) do
  1329. if v != LocalPlayer() and ((v:IsPlayer() and v:Health() > 0 or !v:IsPlayer())) then
  1330. cam.IgnoreZ(true)
  1331. v:DrawModel()
  1332. cam.IgnoreZ(false)
  1333. end
  1334. end
  1335. cam.End3D()
  1336. end
  1337. end
  1338.  
  1339. FapHack:RegisterFunc(FapHack.ComplexDrawing , "RenderScreenspaceEffects")
  1340.  
  1341. -- Radar shit.
  1342. --[[
  1343. function FapHack.DrawRadar()
  1344. if FapHack.Settings.RadarEnabled then
  1345. local center = { x = ScrW() / 5 * 3 + 175 , y = 125}
  1346. local bounds = { xlower = ScrW() / 5 * 3 , ylower = 50 , xupper = ScrW() / 5 * 3 + 350 , yupper = 50 + 250 }
  1347.  
  1348. surface.SetDrawColor(0 , 0 , 0 , 125)
  1349. surface.DrawRect(ScrW() / 5 * 3 , 50 , 350 , 250)
  1350.  
  1351. for k , v in ipairs(player.GetAll()) do
  1352. local clr = team.GetColor(v:Team())
  1353. local diff = v:GetPos() - LocalPlayer():GetPos()
  1354. local pos = {x = diff.x / 350 , y = diff.y / 250}
  1355.  
  1356. surface.SetDrawColor(clr.r , clr.g , clr.b , clr.a)
  1357. surface.DrawRect(math.max( math.min((center.x + pos.x*center.x/2) , bounds.xupper) , bounds.xlower ) , math.max(math.min((center.y + pos.y*center.y/2) , bounds.yupper) , bounds.ylower) , 5 , 5)
  1358. end
  1359. end
  1360. end
  1361.  
  1362. FapHack:RegisterFunc(FapHack.DrawRadar , "HUDPaint")
  1363. ]]
  1364. --[[
  1365. function FapHack.RenderTargets()
  1366. if FapHack.Settings.ESPEnabled then
  1367. cam.Start3D(EyePos(), EyeAngles())
  1368. local bError, sError = pcall(function()
  1369. for k, v in pairs(FapHack:GetAllESPEntities()) do
  1370. if v != LocalPlayer() and not (v:IsPlayer() and v:Health() <= 0) then
  1371. local mattbl = FapHack.WallMats[FapHack.Settings.WallhackMaterial]
  1372.  
  1373. local mat = mattbl.mat
  1374. local defcol = mattbl.defcol
  1375.  
  1376. render.SuppressEngineLighting( true )
  1377. --render.SetColorModulation( 10, 200, 30 )
  1378.  
  1379. --render.SetBlend( 0.6 )
  1380.  
  1381. if FapHack.WallMats[FapHack.Settings.WallhackMaterial] then
  1382. render.SetColorModulation( mattbl.defcol.r, mattbl.defcol.g, mattbl.defcol.b )
  1383. SetMaterialOverride( Material("fap/faphack"..mat) )
  1384. else
  1385. ErrorNoHalt("Invalid material "..FapHack.Settings.WallhackMaterial.."\n")
  1386. end
  1387.  
  1388. v:DrawModel()
  1389. if v.GetActiveWeapon and IsValid(v:GetActiveWeapon()) then
  1390. v:GetActiveWeapon():DrawModel()
  1391. end
  1392.  
  1393. render.SuppressEngineLighting( false )
  1394.  
  1395.  
  1396. render.SetColorModulation( 255, 255, 255 )
  1397. render.SetBlend( 1 )
  1398. SetMaterialOverride( 0 )
  1399. end
  1400. end
  1401. end )
  1402. if !bError then
  1403. ErrorNoHalt(sError)
  1404. return
  1405. end
  1406. cam.End3D()
  1407. end
  1408. end
  1409.  
  1410. FapHack:RegisterFunc(FapHack.RenderTargets , "RenderScreenspaceEffects")]]
  1411. --[[
  1412. local drawing
  1413.  
  1414. function FapHack.PrePlayerDraw(pl)
  1415. if table.HasValue(FapHack:GetAllESPEntities() , pl) then
  1416. if pl != LocalPlayer() and not (pl:IsPlayer() and pl:Health() <= 0) and !drawing then
  1417. cam.Start3D(EyePos() , EyeAngles())
  1418.  
  1419. render.ClearStencil()
  1420. render.SetStencilEnable(true)
  1421.  
  1422. render.SetStencilZFailOperation(STENCILOPERATION_REPLACE)
  1423. render.SetStencilFailOperation(STENCILOPERATION_KEEP)
  1424. render.SetStencilCompareFunction(STENCILCOMPARISONFUNCTION_ALWAYS)
  1425. render.SetStencilPassOperation(STENCILOPERATION_KEEP)
  1426. render.SuppressEngineLighting(true)
  1427. render.SetStencilReferenceValue(1)
  1428. local mattbl = FapHack.WallMats[FapHack.Settings.WallhackMaterial]
  1429.  
  1430. local mat = mattbl.mat
  1431.  
  1432. pl:SetMaterial("fap/faphack"..mat)
  1433. end
  1434. end
  1435. end
  1436.  
  1437. FapHack:RegisterFunc(FapHack.PrePlayerDraw , "PrePlayerDraw")]]
  1438.  
  1439. local disableddraw = {t = 0 , tbl = {} }
  1440. function FapHack:GetDisabledDrawingEnts()
  1441. if disableddraw.t == CurTime() then
  1442. return disableddraw.tbl
  1443. end
  1444.  
  1445. local drawing , notdrawing = FapHack:GetAllESPEntities()
  1446.  
  1447. local disabledrawing = {}
  1448.  
  1449. for k , v in ipairs(ents.GetAll()) do
  1450. if not table.HasValue(drawing , v) and not table.HasValue(notdrawing , v) then
  1451. table.insert(disabledrawing , v)
  1452. end
  1453. end
  1454.  
  1455. disableddraw.t = CurTime()
  1456. disableddraw.tbl = disableddrawing
  1457. return disabledrawing
  1458. end
  1459.  
  1460.  
  1461. local rendering = false
  1462. function FapHack.RenderScreenspaceEffects()
  1463. if FapHack.Settings.ESPEnabled and not FapHack.Settings.UseComplexDrawing and FapHack.Settings.DrawModels then
  1464. local drawing , notdrawing = FapHack:GetAllESPEntities()
  1465.  
  1466. for k , v in pairs(drawing) do
  1467. local mattbl = FapHack.WallMats[FapHack.Settings.WallhackMaterial]
  1468. local mat = mattbl.mat
  1469. local defcl = mattbl.defcol
  1470.  
  1471. local r , g , b = 255 , 255 , 255
  1472.  
  1473. local teamcolours = v.Team and team.GetColor(v:Team())
  1474.  
  1475. if teamcolours then
  1476. r = teamcolours.r
  1477. g = teamcolours.g
  1478. b = teamcolours.b
  1479. else
  1480. r = defcl.r
  1481. g = defcl.g
  1482. b = defcl.b
  1483. end
  1484. v:SetColor(r , g , b , 255)
  1485. v:SetMaterial("fap/faphack"..mat)
  1486.  
  1487. --[[if v.GetActiveWeapon and IsValid(v:GetActiveWeapon()) then
  1488. v:GetActiveWeapon():SetColor(defcl.r , defcl.g , defcl.b , 255)
  1489. v:GetActiveWeapon():SetMaterial("fap/faphack"..mat)
  1490. end]]
  1491.  
  1492. --print(string.format("Drawing object %s" , v:GetClass()))
  1493. end
  1494. for k , v in pairs(notdrawing) do
  1495. local mattbl = FapHack.WallMats[FapHack.Settings.WallhackMaterial]
  1496. local mat = mattbl.mat
  1497. local defcl = mattbl.defcol
  1498. if (v:IsWeapon() or string.find(v:GetClass() , "weapon")) and FapHack.Settings.DrawWeapons then
  1499. v:SetMaterial("fap/faphack"..mat)
  1500. v:SetColor(defcl.r , defcl.g , defcl.b , 255)
  1501. else
  1502. v:SetMaterial("")
  1503. v:SetColor(255 , 255 , 255 , 255)
  1504. end
  1505. end
  1506. rendering = true
  1507. elseif rendering then
  1508. rendering = false
  1509. local draw , notdraw = FapHack:GetAllESPEntities()
  1510.  
  1511. for k , v in pairs(draw) do
  1512. v:SetColor(255 , 255 , 255 , 255)
  1513. v:SetMaterial("")
  1514. end
  1515.  
  1516. for k , v in pairs(notdraw) do
  1517. v:SetColor(255 , 255 , 255 , 255)
  1518. v:SetMaterial("")
  1519. end
  1520. end
  1521. end
  1522.  
  1523. FapHack:RegisterFunc(FapHack.RenderScreenspaceEffects , "HUDPaint")
  1524.  
  1525. -- If I can figure out how to use stencils without lag, this is what I'll use. Otherwise, the lame shitty code below. --
  1526.  
  1527. --[[
  1528. function FapHack.PostPlayerDraw(pl)
  1529. if table.HasValue(FapHack:GetAllESPEntities() , pl) then
  1530. if pl != LocalPlayer() and not (pl:IsPlayer() and pl:Health() <= 0) and !drawing then
  1531. local mattbl = FapHack.WallMats[FapHack.Settings.WallhackMaterial]
  1532.  
  1533. local mat = mattbl.mat
  1534. local defcol = mattbl.defcol
  1535. local teamint = pl:Team() or 0
  1536.  
  1537. local tcolour = team.GetColor(teamint)
  1538. drawing = nil
  1539.  
  1540. render.SetStencilCompareFunction(STENCILCOMPARISONFUNCTION_EQUAL)
  1541. render.SetStencilPassOperation(STENCILOPERATION_REPLACE)
  1542. --render.SetColorModulation(tcolour.r or defcol.r or 255 , tcolour.g or defcol.g or 255 , tcolour.b or defcol.b or 255)
  1543. --render.SetMaterial("fap/faphack")
  1544. render.DrawScreenQuad()
  1545. render.SuppressEngineLighting(false)
  1546. render.SetStencilEnable(false)
  1547. cam.End3D()
  1548. end
  1549.  
  1550. end
  1551.  
  1552. FapHack:RegisterFunc(FapHack.PostPlayerDraw , "PostPlayerDraw")]]
  1553.  
  1554.  
  1555.  
  1556. local view = {}
  1557. function FapHack.CorrectView(pl , org , ang , fov)
  1558. if FapHack.TargetLocked and ( FapHack.Settings.NoSpread or FapHack.Settings.PredictSpread ) then
  1559. view.origin = org
  1560. view.angles = FapHack.RealAngle
  1561. view.fov = ((FapHack.Settings.ZoomToCurrentTarget and FapHack.Settings.ZoomFactor != 0) and (90 / (1 + (1 * FapHack.Settings.ZoomFactor)) ) or fov)
  1562. return view
  1563. end
  1564. end
  1565.  
  1566. FapHack:RegisterFunc(FapHack.CorrectView , "CalcView")
  1567.  
  1568. -- End of ESP/Wallhack and view correction --
  1569.  
  1570. -- Start of misc concommands --
  1571.  
  1572.  
  1573.  
  1574. concommand.Add("fap_reload" , function(p , c , a)
  1575. if FapHack then
  1576. print("FapHack: Reloading")
  1577. for k , v in pairs(FapHack.Hooks) do
  1578. --hook.GetTable()[k][v] = nil
  1579. hook.Remove(k , v)
  1580. MsgN("FapHack: Removed hook "..k.."("..v..")")
  1581. end
  1582.  
  1583. for k , v in pairs(FapHack.DetouredFuncs) do
  1584. _G[v.tbl][v.key] = v.func
  1585. end
  1586.  
  1587. if FapHack.Menu then FapHack.Menu:Remove() end
  1588.  
  1589. concommand.Remove("fap_menu")
  1590. concommand.Remove("fap_reload")
  1591.  
  1592. noerr , ret = pcall(include , "FapHack/FapHack.lua")
  1593.  
  1594. if not noerr then
  1595. ErrorNoHalt(ret.."\n")
  1596. end
  1597. print("FapHack: FapHack reloaded")
  1598.  
  1599. MsgN("\n\n\nDO NOT RELOAD FAPHACK OFTEN - IT WILL BREAK EVENTUALLY, CAUSING MULTIPLE COPIES TO RUN CAUSING LAG\n\n\n")
  1600. end
  1601. end )
  1602.  
  1603. concommand.Add("fap_aim_toggle" , function(p , c , a)
  1604. RunConsoleCommand("fap_aim_enabled" , (FapHack.Settings.AimEnabled and 0 or 1))
  1605. end )
  1606.  
  1607. concommand.Add("+fap_aim" , function(p , c , a)
  1608. RunConsoleCommand("fap_aim_enabled" , 1)
  1609. end )
  1610.  
  1611. concommand.Add("-fap_aim" , function(p , c , a)
  1612. RunConsoleCommand("fap_aim_enabled" , 0)
  1613. end )
  1614.  
  1615. concommand.Add("fap_esp_toggle" , function(p , c , a)
  1616. RunConsoleCommand("fap_esp_enabled" , (FapHack.Settings.ESPEnabled and 0 or 1))
  1617. end )
  1618.  
  1619. concommand.Add("+fap_esp" , function(p , c , a)
  1620. RunConsoleCommand("fap_esp_enabled" , 1)
  1621. end )
  1622.  
  1623. concommand.Add("-fap_esp" , function(p , c , a)
  1624. RunConsoleCommand("fap_esp_enabled" , 0)
  1625. end )
  1626.  
  1627. -- End of misc commands --
  1628.  
  1629. -- Start of basic shitty user interface --
  1630.  
  1631.  
  1632. FapHack.MenuItems = {
  1633. {label = "Aimbot" , objects = function()
  1634.  
  1635. local dpanel = vgui.Create("DPanel")
  1636. dpanel:SetPos(151 , 23)
  1637. dpanel:SetSize(FapHack.Menu:GetWide() - 151 , FapHack.Menu:GetTall() - 23)
  1638.  
  1639. local dlabel = vgui.Create("DLabel")
  1640. dlabel:SetText("Aimbot Settings")
  1641. dlabel:SetTextColor(Color(0 , 255 , 45))
  1642. dlabel:SetFont("FapHack_Font")
  1643. local texw, texh = surface.GetTextSize("Aimbot Settings")
  1644.  
  1645. dlabel:SetPos((FapHack.Menu:GetWide() - 151 - 123 ) / 2 , 0)
  1646. dlabel:SetSize(123 + 30 , texh + 15)
  1647. dlabel:SetParent(dpanel)
  1648.  
  1649. local dpanellist = vgui.Create("DPanelList")
  1650. dpanellist:SetPos(0 , texh + 25)
  1651. dpanellist:SetParent(dpanel)
  1652. dpanellist:SetSize((FapHack.Menu:GetWide() - 151) / 2 - 100, FapHack.Menu:GetTall() - texh - 26 - 30)
  1653. dpanellist:EnableVerticalScrollbar(true)
  1654. dpanellist:EnableHorizontal( false )
  1655. dpanellist:SetSpacing( 5 )
  1656. dpanellist.Paint = function() end
  1657.  
  1658. function AddPlayer(pl)
  1659. --print("FapHack: Entity created: " , pl)
  1660. if pl:IsPlayer() then
  1661. PopulateCombo()
  1662. end
  1663. end
  1664. FapHack:RegisterFunc(AddPlayer , "OnEntityCreated")
  1665.  
  1666. function RemovePlayer(pl)
  1667. if pl:IsPlayer() then
  1668. timer.Simple(0.1 , PopulateCombo)
  1669. end
  1670. end
  1671.  
  1672. FapHack:RegisterFunc(RemovePlayer , "EntityRemoved")
  1673.  
  1674. -- I really hate user interfaces. So much copy/paste work. Bores me.
  1675.  
  1676. local dpanellist2 = vgui.Create("DPanelList")
  1677. dpanellist2:SetPos(((FapHack.Menu:GetWide() - 151) / 2 ) - 90 , 200)
  1678. dpanellist2:SetParent(dpanel)
  1679. dpanellist2:SetSize((FapHack.Menu:GetWide() - 151 )/ 2 + 60 , 190)
  1680. dpanellist2:EnableVerticalScrollbar(true)
  1681. dpanellist2:EnableHorizontal( true )
  1682. dpanellist2:SetSpacing( 5 )
  1683. dpanellist2.Paint = function() end
  1684.  
  1685.  
  1686. local pos = texh + 20
  1687.  
  1688. local dlabel = vgui.Create("DLabel")
  1689. dlabel:SetPos(350 , 105)
  1690. dlabel:SetSize(150 , 25)
  1691. dlabel:SetFont("FapHack_Font_Small")
  1692. dlabel:SetText("Bone Preference")
  1693. dlabel:SetTextColor(Color(0 , 255 , 45))
  1694. dlabel:SetParent(dpanel)
  1695.  
  1696.  
  1697. for k , v in SortedPairs(FapHack.ConVarSettings.Aim) do
  1698. if FapHack.ConVarSettings["Aim"][k].type == "boolean" then -- It's a boolean convar, so a checkbox is suitable.
  1699. if FapHack.ConVarSettings["Aim"][k] and FapHack.ConVarSettings["Aim"][k].var then
  1700. local dcheckbox = vgui.Create("DCheckBoxLabel")
  1701. dcheckbox:SetSize(125 , 20)
  1702. dcheckbox:SetText(k)
  1703. -- dcheckbox:SetConVar(FapHack.ConVarSettings["Aim"][k].var)
  1704. --dcheckbox:SetValue(GetConVar(FapHack.ConVarSettings["Aim"][k].var):GetString())
  1705.  
  1706. dcheckbox:SetValue(FapHack.Settings[k])
  1707. //dpanellist:AddItem(dcheckbox)
  1708.  
  1709. dcheckbox.LastChange = 0
  1710. dcheckbox.OnChange = function()
  1711. if dcheckbox.LastChange < CurTime() then
  1712. dcheckbox.LastChange = CurTime() + 0.1
  1713. --print(string.format("setting %s to %d: OnChange" , FapHack.ConVarSettings["Aim"][k].var , dcheckbox:GetChecked() and 1 or 0))
  1714. dcheckbox:SetValue(util.tobool(dcheckbox:GetChecked() and 1 or 0))
  1715. RunConsoleCommand(FapHack.ConVarSettings["Aim"][k].var , dcheckbox:GetChecked() and 1 or 0)
  1716. end
  1717. end
  1718.  
  1719. cvars.AddChangeCallback(FapHack.ConVarSettings["Aim"][k].var , function(c , o , n)
  1720. if dcheckbox.LastChange < CurTime() then
  1721. dcheckbox.LastChange = CurTime() + 0.1
  1722. --print(string.format("setting %s to %d: Callback" , c , n))
  1723. dcheckbox:SetValue(util.tobool(n))
  1724. end
  1725. end )
  1726.  
  1727.  
  1728. pos = pos + 30
  1729. else
  1730. ErrorNoHalt("[FapHack] 1285: Error - Aim ConVar setting nil. (".. k ..")\n")
  1731. end
  1732. elseif FapHack.ConVarSettings["Aim"][k].type == "number" then
  1733. local dnumslider = vgui.Create("DNumSlider")
  1734. dnumslider:SetWide(130)
  1735. dnumslider:SetPos(5 , 0)
  1736. dnumslider:SetText(k)
  1737. dnumslider:SetMin((FapHack.ConVarSettings["Aim"][k].min) or 0)
  1738. dnumslider:SetMax((FapHack.ConVarSettings["Aim"][k].max) or 1)
  1739.  
  1740. if !FapHack.ConVarSettings["Aim"][k].dec then
  1741. dnumslider:SetDecimals(0)
  1742. else
  1743. dnumslider:SetDecimals(1)
  1744. end
  1745.  
  1746. --dnumslider:SetValue(GetConVar(FapHack.ConVarSettings["Aim"][k].var):GetString())
  1747.  
  1748. dnumslider:SetValue(FapHack.Settings[k])
  1749.  
  1750. dnumslider.LastChange = 0
  1751. --print(FapHack.ConVarSettings["Aim"][k].var)
  1752. dnumslider.ValueChanged = function(self , new)
  1753. if dnumslider.LastChange < CurTime() then
  1754. dnumslider.LastChange = CurTime() + 0.1
  1755. --print(string.format("setting %s to %d: OnChange" , FapHack.ConVarSettings["Aim"][k].var , new))
  1756. dnumslider:SetValue(new)
  1757. RunConsoleCommand(FapHack.ConVarSettings["Aim"][k].var , new)
  1758. end
  1759. end
  1760.  
  1761. cvars.AddChangeCallback(FapHack.ConVarSettings["Aim"][k].var , function(c , o , n)
  1762. if dnumslider.LastChange < CurTime() then
  1763. dnumslider.LastChange = CurTime() + 0.1
  1764. --print(string.format("setting %s to %d: Callback" , c , n))
  1765. dnumslider:SetValue(n)
  1766. end
  1767. end )
  1768.  
  1769. --dnumslider:SetConVar(FapHack.ConVarSettings["Aim"][k].var)
  1770. //dpanellist2:AddItem(dnumslider)
  1771. end
  1772. end
  1773. return dpanel
  1774. end ,},
  1775.  
  1776. {label = "ESP" , objects = function()
  1777.  
  1778. -- Yes, this is basically a copy and paste of the above aimbot code. I was feeling lazy and bored of user interfaces, so I rushed it.
  1779. local texh = 20
  1780. local pos = texh + 20
  1781.  
  1782. local dlabel = vgui.Create("DLabel")
  1783. dlabel:SetPos(350 , 240)
  1784. dlabel:SetSize(150 , 25)
  1785. dlabel:SetFont("FapHack_Font_Small")
  1786. dlabel:SetText("Wallhack Material")
  1787. dlabel:SetTextColor(Color(0 , 255 , 45))
  1788. dlabel:SetParent(dpanel)
  1789.  
  1790.  
  1791. for k , v in SortedPairs(FapHack.ConVarSettings.ESP) do
  1792. if FapHack.ConVarSettings["ESP"][k].type == "boolean" then -- It's a boolean convar, so a checkbox is suitable.
  1793. if FapHack.ConVarSettings["ESP"][k] and FapHack.ConVarSettings["ESP"][k].var then
  1794. local dcheckbox = vgui.Create("DCheckBoxLabel")
  1795. dcheckbox:SetSize(125 , 20)
  1796. dcheckbox:SetText(k)
  1797. --dcheckbox:SetConVar(FapHack.ConVarSettings["ESP"][k].var)
  1798. --dcheckbox:SetValue(GetConVar(FapHack.ConVarSettings["ESP"][k].var):GetString())
  1799. dcheckbox:SetValue(FapHack.Settings[k])
  1800. dcheckbox.LastChange = 0
  1801. dcheckbox.OnChange = function()
  1802. if dcheckbox.LastChange < CurTime() then
  1803. dcheckbox.LastChange = CurTime() + 0.1
  1804. --print(string.format("setting %s to %d: OnChange" , FapHack.ConVarSettings["ESP"][k].var , dcheckbox:GetChecked() and 1 or 0))
  1805. dcheckbox:SetValue(util.tobool(dcheckbox:GetChecked() and 1 or 0))
  1806. RunConsoleCommand(FapHack.ConVarSettings["ESP"][k].var , dcheckbox:GetChecked() and 1 or 0)
  1807. end
  1808. end
  1809.  
  1810. cvars.AddChangeCallback(FapHack.ConVarSettings["ESP"][k].var , function(c , o , n)
  1811. if dcheckbox.LastChange < CurTime() then
  1812. dcheckbox.LastChange = CurTime() + 0.1
  1813. --print(string.format("setting %s to %d: Callback" , c , n))
  1814. dcheckbox:SetValue(util.tobool(n))
  1815. end
  1816. end )
  1817.  
  1818.  
  1819. //dpanellist:AddItem(dcheckbox)
  1820. pos = pos + 30
  1821. else
  1822. ErrorNoHalt("[FapHack] Error - 1495: Nil ConVar setting ("..k..")\n")
  1823. end
  1824. elseif FapHack.ConVarSettings["ESP"][k].type == "number" then
  1825. local dnumslider = vgui.Create("DNumSlider")
  1826. dnumslider:SetWide(130)
  1827. dnumslider:SetPos(5 , 0)
  1828. dnumslider:SetText(k)
  1829. dnumslider:SetMin((FapHack.ConVarSettings["ESP"][k].min) or 0)
  1830. dnumslider:SetMax((FapHack.ConVarSettings["ESP"][k].max) or 1)
  1831. dnumslider:SetDecimals(0)
  1832.  
  1833. --dnumslider:SetValue(GetConVar(FapHack.ConVarSettings["ESP"][k].var):GetString())
  1834. dnumslider:SetValue(FapHack.Settings[k])
  1835. --dnumslider:SetConVar(FapHack.ConVarSettings["ESP"][k].var)
  1836. dnumslider.LastChange = 0
  1837. --print(FapHack.ConVarSettings["ESP"][k].var)
  1838. dnumslider.ValueChanged = function(self , new)
  1839. if dnumslider.LastChange < CurTime() then
  1840. dnumslider.LastChange = CurTime() + 0.1
  1841. --print(string.format("setting %s to %d: OnChange" , FapHack.ConVarSettings["ESP"][k].var , new))
  1842. dnumslider:SetValue(new)
  1843. RunConsoleCommand(FapHack.ConVarSettings["ESP"][k].var , new)
  1844. end
  1845. end
  1846.  
  1847. cvars.AddChangeCallback(FapHack.ConVarSettings["ESP"][k].var , function(c , o , n)
  1848. if dnumslider.LastChange < CurTime() then
  1849. dnumslider.LastChange = CurTime() + 0.1
  1850. --print(string.format("setting %s to %d: Callback" , c , n))
  1851. dnumslider:SetValue(n)
  1852. end
  1853. end )
  1854. //dpanellist2:AddItem(dnumslider)
  1855. end
  1856. end
  1857. return dpanel
  1858. end ,},
  1859.  
  1860. {label = "Misc" , objects = function()
  1861.  
  1862. -- Yes, this is basically a copy and paste of the above aimbot code. I was feeling lazy and bored of user interfaces, so I rushed it.
  1863.  
  1864. local dpanel = vgui.Create("DPanel")
  1865. dpanel:SetPos(151 , 23)
  1866. dpanel:SetSize(FapHack.Menu:GetWide() - 151 , FapHack.Menu:GetTall() - 23)
  1867.  
  1868. local dlabel = vgui.Create("DLabel")
  1869. dlabel:SetText("Misc Settings")
  1870. dlabel:SetTextColor(Color(0 , 255 , 45))
  1871. dlabel:SetFont("FapHack_Font")
  1872. local texw, texh = surface.GetTextSize("Misc Settings")
  1873. dlabel:SetPos((FapHack.Menu:GetWide() - 151 - texw ) / 2 , 0)
  1874. dlabel:SetSize(texw + 30 , texh + 15)
  1875. dlabel:SetParent(dpanel)
  1876.  
  1877. local dlabel = vgui.Create("DLabel")
  1878. dlabel:SetText("Got any ideas for what I can place in here?\n\nTell me on Facepunch.\n\nhttp://www.facepunch.com/showthread.php?t=977939")
  1879. dlabel:SetTextColor(Color(0 , 255 , 45))
  1880. dlabel:SetFont("FapHack_Font_Small")
  1881. local texwa, texha = surface.GetTextSize("Got any ideas for what I can place in here?\n\nTell me on Facepunch.\n\nhttp://www.facepunch.com/showthread.php?t=977939")
  1882. dlabel:SetPos((FapHack.Menu:GetWide() - 91 - 190 ) / 2 , 70)
  1883. dlabel:SetSize(texwa + 30 , texha + 15)
  1884. dlabel:SetParent(dpanel)
  1885.  
  1886. local dpanellist = vgui.Create("DPanelList")
  1887. dpanellist:SetPos(0 , texh + 25)
  1888. dpanellist:SetParent(dpanel)
  1889. dpanellist:SetSize((FapHack.Menu:GetWide() - 151) / 2 - 100, FapHack.Menu:GetTall() - texh - 26 - 30)
  1890. dpanellist:EnableVerticalScrollbar(true)
  1891. dpanellist:EnableHorizontal( false )
  1892. dpanellist:SetSpacing( 5 )
  1893. dpanellist.Paint = function() end
  1894.  
  1895. local dpanellist2 = vgui.Create("DPanelList")
  1896. dpanellist2:SetPos(((FapHack.Menu:GetWide() - 151) / 2 ) - 90 , 200)
  1897. dpanellist2:SetParent(dpanel)
  1898. dpanellist2:SetSize((FapHack.Menu:GetWide() - 151 )/ 2 + 60 , 190)
  1899. dpanellist2:EnableVerticalScrollbar(true)
  1900. dpanellist2:EnableHorizontal( true )
  1901. dpanellist2:SetSpacing( 5 )
  1902. dpanellist2.Paint = function() end
  1903.  
  1904. local pos = texh + 20
  1905.  
  1906. for k , v in SortedPairs(FapHack.ConVarSettings.Misc) do
  1907. if FapHack.ConVarSettings["Misc"][k].type == "boolean" then -- It's a boolean convar, so a checkbox is suitable.
  1908. if FapHack.ConVarSettings["Misc"][k] and FapHack.ConVarSettings["Misc"][k].var then
  1909. local dcheckbox = vgui.Create("DCheckBoxLabel")
  1910. dcheckbox:SetSize(125 , 20)
  1911. dcheckbox:SetText(k)
  1912. --dcheckbox:SetConVar(FapHack.ConVarSettings["ESP"][k].var)
  1913. --dcheckbox:SetValue(GetConVar(FapHack.ConVarSettings["ESP"][k].var):GetString())
  1914. dcheckbox:SetValue(FapHack.Settings[k])
  1915. dcheckbox.LastChange = 0
  1916. dcheckbox.OnChange = function()
  1917. if dcheckbox.LastChange < CurTime() then
  1918. dcheckbox.LastChange = CurTime() + 0.1
  1919. --print(string.format("setting %s to %d: OnChange" , FapHack.ConVarSettings["ESP"][k].var , dcheckbox:GetChecked() and 1 or 0))
  1920. dcheckbox:SetValue(util.tobool(dcheckbox:GetChecked() and 1 or 0))
  1921. RunConsoleCommand(FapHack.ConVarSettings["Misc"][k].var , dcheckbox:GetChecked() and 1 or 0)
  1922. end
  1923. end
  1924.  
  1925. cvars.AddChangeCallback(FapHack.ConVarSettings["Misc"][k].var , function(c , o , n)
  1926. if dcheckbox.LastChange < CurTime() then
  1927. dcheckbox.LastChange = CurTime() + 0.1
  1928. --print(string.format("setting %s to %d: Callback" , c , n))
  1929. dcheckbox:SetValue(util.tobool(n))
  1930. end
  1931. end )
  1932.  
  1933.  
  1934. //dpanellist:AddItem(dcheckbox)
  1935. pos = pos + 30
  1936. else
  1937. ErrorNoHalt("[FapHack] Error - 2092: Nil ConVar setting ("..k..")\n")
  1938. end
  1939. elseif FapHack.ConVarSettings["Misc"][k].type == "number" then
  1940. local dnumslider = vgui.Create("DNumSlider")
  1941. dnumslider:SetWide(130)
  1942. dnumslider:SetPos(5 , 0)
  1943. dnumslider:SetText(k)
  1944. dnumslider:SetMin((FapHack.ConVarSettings["Misc"][k].min) or 0)
  1945. dnumslider:SetMax((FapHack.ConVarSettings["Misc"][k].max) or 1)
  1946. dnumslider:SetDecimals(0)
  1947.  
  1948. --dnumslider:SetValue(GetConVar(FapHack.ConVarSettings["ESP"][k].var):GetString())
  1949. dnumslider:SetValue(FapHack.Settings[k])
  1950. --dnumslider:SetConVar(FapHack.ConVarSettings["ESP"][k].var)
  1951. dnumslider.LastChange = 0
  1952. --print(FapHack.ConVarSettings["ESP"][k].var)
  1953. dnumslider.ValueChanged = function(self , new)
  1954. if dnumslider.LastChange < CurTime() then
  1955. dnumslider.LastChange = CurTime() + 0.1
  1956. --print(string.format("setting %s to %d: OnChange" , FapHack.ConVarSettings["ESP"][k].var , new))
  1957. dnumslider:SetValue(new)
  1958. RunConsoleCommand(FapHack.ConVarSettings["Misc"][k].var , new)
  1959. end
  1960. end
  1961.  
  1962. cvars.AddChangeCallback(FapHack.ConVarSettings["Misc"][k].var , function(c , o , n)
  1963. if dnumslider.LastChange < CurTime() then
  1964. dnumslider.LastChange = CurTime() + 0.1
  1965. --print(string.format("setting %s to %d: Callback" , c , n))
  1966. dnumslider:SetValue(n)
  1967. end
  1968. end )
  1969. //dpanellist2:AddItem(dnumslider)
  1970. end
  1971. end
  1972.  
  1973. return dpanel
  1974.  
  1975. end , }
  1976. }
  1977.  
  1978.  
  1979. function FapHack:SelectMenuItem(type)
  1980. for k , v in pairs(FapHack.MenuItems) do
  1981. if v.label == type then
  1982. if FapHack.CurrentMenuItem and FapHack.CurrentMenuItem:IsValid() then
  1983. FapHack.CurrentMenuItem:Remove()
  1984. end
  1985. //local object = v.objects()
  1986. //object:SetParent(FapHack.Menu)
  1987. //FapHack.CurrentMenuItem = object
  1988. end
  1989. end
  1990. end
  1991.  
  1992. function FapHack:OpenUserInterface()
  1993. if FapHack.Menu and FapHack.Menu:IsValid() then
  1994. FapHack.Menu:SetVisible(!FapHack.Menu:IsVisible())
  1995. else
  1996. FapHack.Menu = vgui.Create("DFrame")
  1997. --FapHack.Menu:SetSize(math.min(ScrW() / 3 , 620), math.min(ScrH() / 2 , 340))
  1998. FapHack.Menu:SetSize(620 , 440)
  1999. FapHack.Menu:SetTitle("FapHack: The best thing since gm_include!")
  2000. FapHack.Menu:Center()
  2001. FapHack.Menu.Close = function()
  2002. FapHack.Menu:SetVisible(false)
  2003. end
  2004. FapHack.Menu:MakePopup()
  2005.  
  2006. local dtree = vgui.Create("DTree")
  2007. dtree:SetSize(149 , FapHack.Menu:GetTall() - 23)
  2008. dtree:SetPos(1 , 22)
  2009. dtree:SetParent(FapHack.Menu)
  2010. for k , v in pairs(FapHack.MenuItems) do
  2011. local node = dtree:AddNode(v.label)
  2012. node.OldClick = node.DoClick
  2013. node.DoClick = function(...)
  2014. FapHack:SelectMenuItem(v.label)
  2015. return node.OldClick(...)
  2016. end
  2017. end
  2018.  
  2019. FapHack:SelectMenuItem("Aimbot")
  2020. end
  2021. end
  2022.  
  2023. concommand.Add("Fap_Menu" , FapHack.OpenUserInterface)
  2024.  
  2025. concommand.Add("+Fap_Menu", function()
  2026. RunConsoleCommand("Fap_Menu")
  2027. end)
  2028. concommand.Add("-Fap_Menu", function()
  2029. RunConsoleCommand("Fap_Menu")
  2030. end)
  2031. -- End of UI
  2032.  
  2033. -- Give me some credits yo --
  2034.  
  2035. Msg("FapHack initialised! \n\nEnjoy your haxxoring.\nUnless scriptenforcer is enabled in which case you won't be reading this because you don't know how to bypass it since you've not written your own aimbot.\n\n")
  2036.  
  2037.  
  2038. -- Now, some idiots decided they would blacklist my hooks/commands/files --
  2039.  
  2040. -- That's not the idea. Learn to whitelist, or fail at blocking it. --
  2041.  
  2042. local FapHackFiles = {"faphack_entities.txt" , "faphack_friends.txt" , "faphack.lua" , "fap" , "hack" , "faphack_keybinds.txt"}
  2043. local writequeue = {}
  2044.  
  2045. --[[
  2046. local otfind = file.TFind
  2047.  
  2048. function file.TFind(path , callback)
  2049. local callpath = debug.getinfo(2)['short_src']
  2050.  
  2051. if callpath then
  2052. local ret = otfind(path , callback)
  2053.  
  2054. for k , v in pairs(FapHackFiles) do
  2055. if string.find(string.lower(path) , v) and callpath != "addons\\faphack\\lua\\faphack\\faphack.lua" then
  2056. local folders = {}
  2057. local files = {}
  2058. for a , b in pairs(writequeue) do
  2059. if string.find(a , path) then
  2060. if file.IsDir(a) then
  2061. table.insert(folders , a)
  2062. else
  2063. table.insert(files , a)
  2064. end
  2065. end
  2066. end
  2067. callback(path , folders , files)
  2068. MsgN("[FapHack] file.TFind rejected - path not whitelisted.")
  2069. end
  2070. end
  2071. end
  2072.  
  2073. return otfind(path)
  2074. end]]
  2075.  
  2076. local FapHackCommands = {"fap_reload" , "fap_menu", "+fap_menu", "-fap_menu", "fap_predictcheck", "fap_aim_toggle" , "fap_esp_toggle" , "+fap_aim" , "+fap_esp" , "-fap_aim" , "-fap_esp" , "fap_bind" , "fap_unbind" , "+fap_bunnyhop" , "-fap_bunnyhop" , "fap_toggle_bunnyhop"}
  2077. local cadd = concommand.Add
  2078.  
  2079. local emeta = _R.Entity
  2080.  
  2081. local ogm = emeta.GetMaterial
  2082. local faphackmaterials = {"faphack_wireframe" , "faphack_bluevertex" , "faphack_solid"}
  2083.  
  2084. -- This isn't hard to block --
  2085.  
  2086. -- Use your ingenuity --
  2087.  
  2088. -- TIP: Blacklists == retarded --
  2089.  
  2090.  
  2091.  
  2092.  
  2093. -- Custom binding system --
  2094.  
  2095. -- Disabled by default. I mean, looping 130 times per frame isn't something everyone wants --
  2096.  
  2097. -- End of key binding --
  2098.  
  2099.  
  2100. -- Now then, update notification. Let's try this --
  2101.  
  2102. local updateURL = ""
  2103. local updateURL_backup = ""
  2104.  
  2105. -- I know, I'm cheap. I don't want to buy a domain for this, and don't want to host the file on my own box. I shouldn't go over the limit anyway.
  2106.  
  2107. function FapHack.OpenUpdateDisplay(rev , url, clog)
  2108. print(string.format("FapHack: Revision %d is available at %s" , rev , url))
  2109.  
  2110. local dframe = vgui.Create("DFrame")
  2111. dframe:SetSize(300 , 202)
  2112. dframe:SetTitle("FapHack: Update available")
  2113. dframe:MakePopup()
  2114. dframe:Center()
  2115.  
  2116. local dlabel = vgui.Create("DLabel")
  2117. dlabel:SetParent(dframe)
  2118. dlabel:SetText(string.format("FapHack revision %d is available from the URL below!\nUpdating gives you more features and a more stable \nexperience." , rev , url))
  2119. dlabel:SizeToContents()
  2120. dlabel:SetPos(5 , 25)
  2121.  
  2122. local dtextentry = vgui.Create("DTextEntry")
  2123. dtextentry:SetParent(dframe)
  2124. dtextentry:SetPos(0 , 75)
  2125. dtextentry:SetSize(300 , 25)
  2126. dtextentry:SetText(url)
  2127. dtextentry.OnMousePressed = function()
  2128. SetClipboardText(url)
  2129. if LocalPlayer() and IsValid(LocalPlayer()) then
  2130. LocalPlayer():ChatPrint("The URL is now in your clipboard.")
  2131. end
  2132. end
  2133.  
  2134. local dtextentry = vgui.Create("DTextEntry")
  2135. dtextentry:SetParent(dframe)
  2136. dtextentry:SetPos(0 , 102)
  2137. dtextentry:SetSize(300 , 98)
  2138. dtextentry:SetMultiline(true)
  2139. dtextentry:SetText("Changelog:" .. clog)
  2140. dtextentry:SetEditable(false)
  2141. end
  2142.  
  2143. if FapHack.Settings.CheckForUpdates then
  2144. print("No updates are available")
  2145. else
  2146. MsgN("[FapHack] Automatic update checking is disabled. Type fap_checkforupdates 1 in the console to enable it.")
  2147. end
Add Comment
Please, Sign In to add comment