if SERVER then MsgN("Why are you running this serverside?") return end local swaphak_whenabled = CreateClientConVar( "sleepyhak_whenabled", 1, true, false ) local swaphak_aimsmooth = CreateClientConVar( "sleepyhak_aimsmooth", 0.1, true, false ) local swaphak_bhop = CreateClientConVar( "sleepyhak_bhop", 1, true, false ) local swaphak_aimthroughwalls = CreateClientConVar( "sleepyhak_aimthroughwalls", 0, true, false ) local swaphak_extrapolateaim = CreateClientConVar( "sleepyhak_extrapolateaim", 1, true, false ) local swaphak_targetdarkrpteam = CreateClientConVar( "sleepyhak_targdarkrpteam", 1, true, false ) local swaphak_targetfriends = CreateClientConVar( "sleepyhak_targfriends", 0, true, false ) local swaphak_darkrpesp = CreateClientConVar( "sleepyhak_darkrpesp", 1, true, false ) local swaphak_clnoclip = CreateClientConVar("sleepyhak_clnoclip", 0, true, false) local swaphak_prefbodydist = CreateClientConVar("sleepyhak_prefbodydist", 800, true, false) local swaphak_dbginfo = CreateClientConVar("sleepyhak_dbginfo", 0, true, false) local swaphak_pspam_time = CreateClientConVar( "sleepyhak_pspamtime", 1.0, true, false ) local swaphak_pspam_prop = CreateClientConVar( "sleepyhak_pspamprop", "models/props_c17/chair02a.mdl", true, false ) niggershit = niggershit or {} concommand.Add("sleepyhak_bookmark", function(ply, command, arguments) local atbl = { name = arguments[1], pos = LocalPlayer():GetPos() } table.insert(niggershit, atbl) end) local function plyquery(ply, str) local status, ret = pcall(ply.query, ply, str) return status and ret or false end local function AdminCheck(ply) return ply:IsAdmin() or ply:IsSuperAdmin() or plyquery(ply, "ulx ban") or plyquery(ply, "ulx spectate") end local function GetJobOf(ply) if ply.DarkRPVars then return ply.DarkRPVars.job end return nil end local function GamemodeColorForPly(ply) if ply == ABTarget then return Color(0, 255, 0, 255) end if (ply.IsActiveTraitor and ply:IsActiveTraitor()) or ply.MightBeTraitor then return Color(255, 0, 0, 255) end return Color(255, 255, 255, 255) end local function DrawDRPEnts() local printers = {} -- contains all ents, cba to change name table.Add(printers, ents.FindByClass( "bronze_printer" )) table.Add(printers, ents.FindByClass( "silver_printer" )) table.Add(printers, ents.FindByClass( "gold_printer" )) table.Add(printers, ents.FindByClass( "platium_printer" )) table.Add(printers, ents.FindByClass( "nuclear_printer" )) --table.Add(printers, ents.FindByClass( "spawned_weapon" )) table.Add(printers, ents.FindByClass( "spawned_shipment" )) table.Add(printers, ents.FindByClass( "gmod_cameraprop" )) table.Add(printers, ents.FindByClass( "wyozi_screen_radio" )) table.Add(printers, ents.FindByClass( "wyozi_screen_projector" )) table.Add(printers, ents.FindByClass( "wyozi_screen_tv" )) table.Add(printers, ents.FindByClass( "wyozi_bc_masterradio" )) local col = Color(255, 127, 0, 255) for _,ent in pairs ( printers ) do local Position = ( ent:GetPos() ):ToScreen() local txt = ent.ClassName if ent.ClassName == "spawned_shipment" then local shipment = CustomShipments[ent:Getcontents()] if shipment then txt = "SHPMNT: " .. shipment.name end end draw.DrawText( txt .. " " .. tostring(math.Round(LocalPlayer():GetPos():Distance(ent:GetPos()))) .. "m", "DermaDefault", Position.x, Position.y, col, 1 ) end end local function UnitsToFeet(ups) return ups / 16 end local function FeetToMeters(fps) return fps * 0.3048 end surface.CreateFont("SleepHName", { font = "Roboto", size = 16, weight = 800 }) surface.CreateFont("SleepHHealth", { font = "Roboto", size = 11, weight = 800 }) surface.CreateFont("SleepHConsolis", { font = "Ludica Console", size = 24 }) hook.Add( "HUDPaint", "SleepyHak_WH", function() if not swaphak_whenabled:GetBool() then return end local splys = {} for _,ply in pairs(player.GetAll()) do if (ply:GetObserverMode() == OBS_MODE_IN_EYE or ply:GetObserverMode() == OBS_MODE_CHASE) then table.insert(splys, {ply=ply, targ=ply:GetObserverTarget(), admin=AdminCheck(ply)}) end end draw.DrawText("Garry's Mod X-Sp Debug (" .. tostring(#splys) .. ")" , "SleepHConsolis", 80, 10, Color(0, 255, 0)) for k,v in ipairs(splys) do draw.DrawText(v.ply:Nick() .. " --> " .. tostring(v.targ), "SleepHConsolis", 80, 10 + k*15, Color(0, 255, 0)) end if swaphak_darkrpesp:GetInt() == 1 then -- :D DrawDRPEnts() end local myjob = GetJobOf(LocalPlayer()) for k,v in pairs ( player.GetAll() ) do if not v:Alive() or (v.IsTerror and not v:IsTerror()) then continue end local wep = v:GetActiveWeapon() if wep and wep.CanBuy and table.HasValue(wep.CanBuy, ROLE_TRAITOR) then v.MightBeTraitor = true end local Position = ( v:GetPos() + Vector( 0,0,80 ) ):ToScreen() local Name = "" if v == LocalPlayer() then Name = "" else Name = v:Name() end local col = Color(255, 255, 255, 255) local theirjob = GetJobOf(v) if v:GetFriendStatus() == "friend" then col = Color(0, 255, 0, 255) elseif AdminCheck(v) then col = Color( 255, 0, 0, 255) elseif theirjob and theirjob == myjob then col = Color(255, 255, 0, 255) end local txt = Name local extra_info if v.MightBeTraitor then txt = "[TRAITOR]" .. txt end local vec_diff = (v:EyePos() - EyePos()) local vec_diff_norm = vec_diff:GetNormalized() local aim_vec = LocalPlayer():GetAimVector():GetNormalized() local dotprod = vec_diff_norm:Dot(aim_vec) local unitdist = vec_diff:Length() if dotprod > 0.99 or unitdist < 150 then extra_info = extra_info or {} local dist = math.Round(FeetToMeters(UnitsToFeet(unitdist)), 1) extra_info["Dist"] = tostring(dist) .. "m" local vel = v:GetVelocity():Length() extra_info["Vel"] = tostring(math.Round(FeetToMeters(UnitsToFeet(vel)), 1)) .. "m/s" local dir_norm = v:GetAimVector():GetNormalized() local dir_dotprod = dir_norm:Dot(vec_diff_norm) extra_info["Dir"] = (dir_dotprod > 0 and "A" or "T") .. ":" .. tostring(math.Round(dir_dotprod, 2)) if swaphak_dbginfo:GetBool() then extra_info["UDist"] = tostring(math.Round(unitdist)) extra_info["Dot"] = tostring(math.Round(dotprod, 3)) extra_info["UVel"] = tostring(math.Round(vel)) end local lmove = "∞" if v.LastPosMark then lmove = math.Round(CurTime() - v.LastPosMark.Time) end extra_info["LMove"] = lmove end if not v.LastPosMark or v.LastPosMark.Pos ~= v:GetPos() then v.LastPosMark = {Pos = v:GetPos(), Time = CurTime()} end surface.SetFont("SleepHName") local tw, th = surface.GetTextSize(txt) tw = math.max(tw, 90) local dotprod_norm = math.max(0, dotprod) local alpha = 1 - math.Clamp(unitdist / 3000, 0, 0.8) alpha = alpha * dotprod_norm col.a = col.a * alpha surface.SetDrawColor(0, 0, 0, 200*alpha) surface.DrawRect(Position.x-tw/2, Position.y, tw+5, th + 2) draw.DrawText(txt , "SleepHName", Position.x, Position.y, col, TEXT_ALIGN_CENTER ) draw.RoundedBox( 2, Position.x-tw/2, Position.y+th+2, tw+5, 8, Color( 255, 0, 0, 200*alpha ) ) local HpPercent = math.min(v:Health() / 100, 1) -- estimated maxhp draw.RoundedBox( 2, Position.x-tw/2+1, Position.y+th+3, (tw+3) * HpPercent, 6, Color( 0, 255, 0, 200*alpha ) ) local xtra = v:Health() - 100 if xtra > 0 then draw.DrawText("+" .. tostring(xtra), "SleepHHealth", Position.x+tw/2+4, Position.y+th-1, col ) end end for _,bm in pairs(niggershit) do local pos = bm.pos + Vector(0, 0, 80) local onscr = pos:ToScreen() draw.DrawText( bm.name, "DermaDefault", onscr.x, onscr.y, Color(255, 127, 0, 255), 1 ) end if TargetObstructed then draw.SimpleText("Target obstructed by " .. tostring(TargetObstructed), "DermaDefault", ScrW() / 2, ScrH() / 2 + 70, Color(255, 127, 127,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) end end ) ABTarget = nil BHoppin = false local weapons = { ["weapon_crossbow"] = 3110, } function GetWeaponPredictionPos(pos , pl) if IsValid(pl) and type(pl:GetVelocity()) == "Vector" and pl.GetPos and type(pl:GetPos()) == "Vector" then local distance = LocalPlayer():GetPos():Distance(pl:GetPos()) local weapon = (LocalPlayer().GetActiveWeapon and (IsValid(LocalPlayer():GetActiveWeapon()) and LocalPlayer():GetActiveWeapon():GetClass())) if weapon and weapons[weapon] then local time = distance / weapons[weapon] return pos + pl:GetVelocity() * time elseif swaphak_extrapolateaim:GetBool() then if LocalPlayer():GetVelocity():Length() > 100 then pos = pos - Vector(0 , 0 , LocalPlayer():GetVelocity():Length() / 220) end return pos + pl:GetVelocity() * 0.0067 - LocalPlayer():GetVelocity() * 0.0067 -- ( pl:GetVelocity() / 47 - LocalPlayer():GetVelocity() / 47 )--+ ( pl.GetVelocity and pl:GetVelocity() * 0.0025 * LocalPlayer():Ping() ) end return pos end return pos end local function aimbot() -- Starting the function if ABTarget and IsValid(ABTarget) then local ply = LocalPlayer() -- Getting ourselves local target = ABTarget if target:IsPlayer() and not target:Alive() then return end local targ_bone = "ValveBiped.Bip01_Head1" local dist = ply:GetPos():Distance(ABTarget:GetPos()) if dist > swaphak_prefbodydist:GetInt() then targ_bone = "ValveBiped.Bip01_Spine" end local targethead = target:LookupBone(targ_bone) if not targethead then return end local targetheadpos,targetheadang = target:GetBonePosition(targethead) -- Get the position/angle of the head. if not swaphak_aimthroughwalls:GetBool() then local tracedata = {} tracedata.start = ply:GetShootPos() tracedata.endpos = targetheadpos tracedata.filter = ply local trace = util.TraceLine(tracedata) if trace.Hit and trace.Entity ~= target then TargetObstructed = trace.Entity return end end local TargetPos = targetheadpos TargetPos = GetWeaponPredictionPos(TargetPos, target) local TargetAngle = (TargetPos - ply:GetShootPos()):Angle() local CurAngle = ply:EyeAngles() local lerped = LerpAngle(swaphak_aimsmooth:GetFloat(), CurAngle, TargetAngle) ply:SetEyeAnglez(lerped) -- And finally, we snap our aim to the head of the target. local me = LocalPlayer() if me:GetActiveWeapon():IsValid() and me:GetActiveWeapon().Primary then me:GetActiveWeapon().Primary.Recoil = 0 end end TargetObstructed = nil end hook.Add("Think","SleepyHak_AB",aimbot) -- The hook will spam "aimbot" until it finds a target.. local DeathSequences = { ["models/barnacle.mdl"] = {4,15}, ["models/antlion_guard.mdl"] = {44}, ["models/hunter.mdl"] = {124,125,126,127,128}, } local function CheckTarget(ent) --if not self:Visible(ent) then return false end if ent:IsPlayer() then local myjob = GetJobOf(LocalPlayer()) if not swaphak_targetdarkrpteam:GetBool() and myjob and myjob == GetJobOf(ent) then return false end if not swaphak_targetfriends:GetBool() and ent:GetFriendStatus() == "friend" then return false end if !ent:IsValid() then return false end if ent:Health() < 1 then return false end if ent == LocalPlayer() then return false end return true end if ent:IsNPC() then if ent:GetMoveType() == 0 then return false end if table.HasValue(DeathSequences[string.lower(ent:GetModel() or "")] or {},ent:GetSequence()) then return false end return true end return false end local function GetTargets() local tbl = {} for k,ent in pairs(ents.GetAll()) do if CheckTarget(ent) == true then table.insert(tbl,ent) end end return tbl end local function GetClosestTarget() local owner = LocalPlayer() local pos = owner:GetPos() local ang = owner:GetAimVector() local closest = {0,0} for k,ent in pairs(GetTargets()) do local diff = (ent:GetPos()-pos):GetNormalized() local dot = diff:Dot(ang) local dist_bias = math.Clamp(pos:Distance(ent:GetPos()) / 2000, 0, 0.2) dot = dot - dist_bias if (dot > closest[2]) or (closest[1] == 0) then closest = {ent,dot} end end return closest[1] end hook.Add("CreateMove", "lolBunny", function(ucmd) if swaphak_clnoclip:GetBool() then ucmd:SetForwardMove(0) ucmd:SetSideMove(0) ucmd:SetUpMove(0) return end local ply = LocalPlayer() if swaphak_bhop:GetBool() and IsValid(ply) and bit.band(ucmd:GetButtons(), IN_DUCK) > 0 then if ply:OnGround() then ucmd:SetButtons( bit.bor(ucmd:GetButtons(), IN_JUMP) ) end end end) concommand.Add("+sleepyhaktarget", function(ply, cmd, args) local closestTarget = GetClosestTarget() if closestTarget ~= 0 then ABTarget = closestTarget end end) concommand.Add("-sleepyhaktarget", function(ply, cmd, args) ABTarget = nil end) hook.Add("TTTPrepareRound", "SleepyHak_ClearRoles", function() for k,v in pairs ( player.GetAll() ) do v.MightBeTraitor = nil end end) concommand.Add("sleepyhak_debug", function(ply, cmd, args) chat.AddText("aim thru walls: " .. tostring(swaphak_aimthroughwalls:GetBool())) end) local function filter_inplace(t, predicate) local j = 1 for i = 1,#t do local v = t[i] if predicate(v) then t[j] = v j = j + 1 end end while t[j] ~= nil do t[j] = nil j = j + 1 end return t end concommand.Add("sleepyhak_startnc", function() timer.Create( "my_nc_timer", 6, 0, function() LocalPlayer():ConCommand("say /rpname " .. table.Random(filter_inplace(player.GetAll(), function(p) return not AdminCheck(p) end)):Nick() .. " ") end) end) concommand.Add("sleepyhak_stopnc", function() timer.Destroy( "my_nc_timer" ) LocalPlayer():ConCommand("say /rpname lelrt") end) local function EntsToTbl(filter, tbl) table.Add(ents.FindByClass( filter ), tbl) end local function GetAdminCount() return #filter_inplace(player.GetAll(), function(p) return AdminCheck(p) end) end hook.Add("PlayerAuthed", "SHSpawnNotifier", function(ply) if AdminCheck(ply) then chat.AddText(Color(255, 0, 0, 255), "Admin " .. ply:Nick() .. " joined! Admincount: " .. tostring(GetAdminCount())) end end) concommand.Add("+sleepyhakpspam", function(ply, cmd, args) timer.Create("SH_PSpammer", swaphak_pspam_time:GetFloat(), 0, function() RunConsoleCommand("gm_spawn", swaphak_pspam_prop:GetString()) end) end) concommand.Add("-sleepyhakpspam", function(ply, cmd, args) timer.Destroy("SH_PSpammer") end) hook.Add( "PreDrawHalos", "SHDrawItemHalos", function() if not swaphak_whenabled:GetBool() then return end if swaphak_darkrpesp:GetInt() >= 2 then local printers = {} table.Add(printers, ents.FindByClass( "bronze_printer" )) table.Add(printers, ents.FindByClass( "silver_printer" )) table.Add(printers, ents.FindByClass( "gold_printer" )) table.Add(printers, ents.FindByClass( "platium_printer" )) table.Add(printers, ents.FindByClass( "nuclear_printer" )) halo.Add( printers, Color( 255, 127, 0 ), 2, 2, 1, _, true ) halo.Add( ents.FindByClass( "spawned_weapon" ), Color( 0, 255, 0 ), 2, 2, 1, _, true ) halo.Add( ents.FindByClass( "spawned_shipment" ), Color( 127, 255, 0 ), 2, 2, 1, _, true ) end halo.Add( ents.FindByClass( "gmod_cameraprop" ), Color(0, 0, 255), 2, 2, 1, _, true) end ) local oldcvn = GetConVarNumber function GetConVarNumber(cv) if cv == "sv_allowcslua" then return 0 end return oldcvn(cv) end local clnc_pos hook.Add("CalcView", "SHClNoclip", function(ply, pos, angles, fov) if swaphak_clnoclip:GetBool() then local me = ply clnc_pos = clnc_pos or LocalPlayer():EyePos() local angles = angles:Forward() local speed = 150 if me:KeyDown(IN_SPEED) then speed = speed * 10 end if(me:KeyDown(IN_FORWARD)) then local tr = util.TraceLine({start = clnc_pos, endpos = clnc_pos + angles * FrameTime() * speed, mask = COLLISION_GROUP_WORLD}) clnc_pos = tr.HitPos end if(me:KeyDown(IN_BACK)) then local tr = util.TraceLine({start = clnc_pos, endpos = clnc_pos + angles * FrameTime() * speed * -1, mask = COLLISION_GROUP_WORLD}) clnc_pos = tr.HitPos end if(me:KeyDown(IN_MOVELEFT)) then local tr = util.TraceLine({start = clnc_pos, endpos = clnc_pos + angles:Angle():Right() * FrameTime() * speed * -1, mask = COLLISION_GROUP_WORLD}) clnc_pos = tr.HitPos end if(me:KeyDown(IN_MOVERIGHT)) then local tr = util.TraceLine({start = clnc_pos, endpos = clnc_pos + angles:Angle():Right() * FrameTime() * speed, mask = COLLISION_GROUP_WORLD}) clnc_pos = tr.HitPos end return({origin = clnc_pos}) else clnc_pos = nil end end) hook.Add("Think", "SHClNoclipFlash", function() if not LocalPlayer():FlashlightIsOn() then return end local dlight = DynamicLight( LocalPlayer():EntIndex() ) if ( dlight ) then local r, g, b, a = 255, 255, 255, 255 dlight.Pos = clnc_pos or LocalPlayer():GetPos() dlight.r = r dlight.g = g dlight.b = b dlight.Brightness = 1 dlight.Size = 512 dlight.Decay = 1024 dlight.DieTime = CurTime() + 1 dlight.Style = 0 end end) local last_duck local last_lk hook.Add("PlayerBindPress", "SHQuickToggleBH", function(ply, bind, press) if bind == "+duck" then if last_duck and last_duck > CurTime()-0.2 then local newval = cvars.Bool("sleepyhak_bhop") and "0" or "1" RunConsoleCommand("sleepyhak_bhop", newval) chat.AddText(LocalPlayer(), Color(127, 127, 127), ": bh set " .. tostring(newval)) end last_duck = CurTime() end if bind == "+jump" and swaphak_clnoclip:GetBool() then RunConsoleCommand("sleepyhak_clnoclip", "0") end if bind == "+lolkillz" then last_lk = CurTime() end if bind == "invprev" and last_lk and last_lk > CurTime() - 0.5 then -- sum building aid return true end end) local Command_Enter = 0 local Command_Reset = 1 local Command_Accept = 2 local function SendCode(keypad, code) local codestr = string.format("%04d", code) for i=1,4 do local codenum = string.sub(codestr, i, i) MsgN(codestr, "-", i, "-", codenum) net.Start("keypad_command") net.WriteEntity(keypad) net.WriteUInt(Command_Enter, 3) net.WriteUInt(tonumber(codenum), 4) net.SendToServer() end net.Start("keypad_command") net.WriteEntity(keypad) net.WriteUInt(Command_Accept, 3) net.SendToServer() end --[[ concommand.Add("sleepyhak_keycrax", function() local tr = LocalPlayer():GetEyeTrace() if IsValid(tr.Entity) and tr.Entity:GetClass() == "keypad" then MsgN("Cracking keypad ", tr.Entity, " ...") local code = 0 timer.Create("sh_kpcracker", 0.2, 0, function() if not IsValid(tr.Entity) then MsgN("tr.Entity invalidated while cracking") return timer.Destroy("sh_kpcracker") end if tr.Entity:GetStatus() == 1 then MsgN("Found the code at around ", code, "!!!!") return timer.Destroy("sh_kpcracker") end SendCode(tr.Entity, code) MsgN("Testing ", code) code = code + 1 end) else MsgN("No keypad found in end of trace") end end) concommand.Add("sleepyhak_keycrax_end", function() timer.Destroy("sh_kpcracker") end) ]] hook.Add( "PopulateMenuBar", "SHAddMenuBarThings", function( menubar ) local m = menubar:AddOrGetMenu( "SleepyH" ) m:AddCVar( "Cl Noclip", "sleepyhak_clnoclip", "1", "0" ) end) MsgN("SleepyHak loaded. Welcome and have fun! FOR SCIENCE")