Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SetDebugPrivileges()
- local hwnd = 0
- while (hwnd == 0) do
- hwnd = FindWindow("Counter-Strike Source")
- end
- local procID = GetProcessId(hwnd)
- WriteConsole("Process ID: " .. tostring(procID) .. "\n")
- local procHandle = OpenProcess(PROCESS_ALL_ACCESS, procID)
- WriteConsole("Process Handle: " .. tostring(procHandle) .. " [" .. tostring(PROCESS_ALL_ACCESS) .. "]\n")
- local engine = GetBaseAddress(procHandle, "engine.dll")
- local client = GetBaseAddress(procHandle, "client.dll")
- local r_drawothermodels = client + 0x741F20
- local EntTable = client + 0x00751FFC --hardcode for now
- WriteConsole("Entity Table @ " .. tostring(EntTable) .. "\n");
- local GetEntity = function(idx)
- return ReadInt(procHandle, EntTable + (0x10 * idx))
- end
- local Player = {
- lifeState = function(base) return ReadInt(procHandle, base + 0x8F) end,
- m_iHealth = function(base) return ReadInt(procHandle, base + 0x90) end,
- m_iTeamNum = function(base) return ReadInt(procHandle, base + 0x98) end,
- m_vecMins = function(base) return ReadFloat(procHandle, base + 0x20),
- ReadFloat(procHandle, base + 0x24), ReadFloat(procHandle, base + 0x28) end,
- m_vecMaxs = function(base) return ReadFloat(procHandle, base + 0x2C),
- ReadFloat(procHandle, base + 0x30), ReadFloat(procHandle, base + 0x34) end,
- m_vecOrigin = function(base) return ReadFloat(procHandle, base + 0x2FC),
- ReadFloat(procHandle, base + 0x300), ReadFloat(procHandle, base + 0x304) end,
- m_angRotation = function(base) return ReadFloat(procHandle, base + 0x308),
- ReadFloat(procHandle, base + 0x308), ReadFloat(procHandle, base + 0x308) end,
- m_fFlags = function(base) return ReadInt(procHandle, base + 0x314) end,
- m_flFOVStart = function(base) return ReadFloat(procHandle, base + 0xF8C) end,
- m_hGroundEntity = function(base) return ReadInt(procHandle, base + 0x220) end,
- m_bDucked = function(base) return ReadByte(procHandle, base + 0x44) end,
- m_bDucking = function(base) return ReadByte(procHandle, base + 0x45) end,
- m_bInDuckJump = function(base) return ReadFloat(procHandle, base + 0x46) end,
- m_flFallVelocity = function(base) return ReadFloat(procHandle, base + 0x58) end,
- m_szLastPlaceName = function(base) return ReadStr(procHandle, base + 0x120C, 20) end,
- m_flStamina = function(base) return ReadFloat(procHandle, base + 0x13E8) end,
- m_bHasHelmet = function(base) return ReadFloat(procHandle, base + 0x144C) end,
- m_iTargetEntIdx = function(base) return ReadInt(procHandle, base + 0x14A8) end,
- }
- local RadarPtr = client + 0x791240 --hardcode for now
- WriteConsole("Radar Base @ " .. tostring(RadarPtr) .. "\n");
- local GetRadarEntity = function(idx)
- return ReadInt(procHandle, RadarPtr + (0x140 * idx))
- end
- local RadarPlayer = {
- name = function(base) return ReadStr(procHandle, base + 0x38, 0) end,
- health = function(base) return ReadStr(procHandle, base + 0x5C, 0) end,
- pos = function(base) return ReadFloat(procHandle, base + 0x60),
- ReadFloat(procHandle, base + 0x64), ReadFloat(procHandle, base + 0x68) end,
- ang = function(base) return ReadFloat(procHandle, base + 0x6C),
- ReadFloat(procHandle, base + 0x70), ReadFloat(procHandle, base + 0x74) end,
- }
- local o_EyeP = engine + 0x43140C
- local o_EyeY = engine + 0x431410
- local o_EyeR = engine + 0x431414
- local NamePtr = ReadInt(procHandle, engine + 0x40FAEC)
- local o_NameStr = ReadStr(procHandle, NamePtr, 0) --read till NULL byte
- WriteConsole("Local player name found: " .. o_NameStr .. "\n")
- local function AngleToTarget(pX,pY,pZ, tX,tY,tZ)
- local deltaX = pX - tX
- local deltaY = pY - tY
- local deltaZ = pZ - tZ
- local hyp = math.sqrt((deltaX*deltaX) + (deltaY*deltaY))
- local angP = math.deg(math.asin(deltaZ / hyp))
- local angY = math.deg(math.atan(deltaY / deltaX))
- local angR = 0
- if (deltaX >= 0) then angY = angY + 180 end
- return angP,angY,angR
- end
- local function Distance3D(pX,pY,pZ, tX,tY,tZ)
- local deltaX = pX - tX
- local deltaY = pY - tY
- local deltaZ = pZ - tZ
- return math.sqrt((deltaX*deltaX) + (deltaY*deltaY) + (deltaZ*deltaZ))
- end
- local function RotatePoint2D(pX,pY, oX,oY, degrees)
- local theta = math.rad(degrees)
- local newX = (math.cos(theta) * (pX-oX)) - (math.sin(theta) * (pY-oY)) + oX
- local newY = (math.sin(theta) * (pX-oX)) + (math.cos(theta) * (pY-oY)) + oY
- return newX, newY
- end
- WriteConsole("INITIALIZED.\n");
- local aimbot = false
- local bhop = false
- local trigbot = false
- local localidx = -1
- local lastgroundent = -1
- while (not IsKeyDown(VK_END)) do --END
- if (IsKeyDown(VK_F11)) then
- if (ReadInt(procHandle, r_drawothermodels) == 1) then
- WriteInt(procHandle, r_drawothermodels, 2)
- WriteConsole("Wallhack on\n")
- else
- WriteInt(procHandle, r_drawothermodels, 1)
- WriteConsole("Wallhack off\n")
- end
- Sleep(100)
- end
- if (IsKeyDown(VK_F10)) then
- aimbot = not aimbot
- if (aimbot) then WriteConsole("Aimbot on\n")
- else WriteConsole("Aimbot off\n") end
- Sleep(100)
- end
- if (IsKeyDown(VK_F9)) then
- bhop = not bhop
- if (bhop) then WriteConsole("BunnyHop on\n")
- else WriteConsole("BunnyHop off\n") end
- Sleep(100)
- end
- if (IsKeyDown(VK_F8)) then
- trigbot = not trigbot
- if (trigbot) then WriteConsole("TriggerBot on\n")
- else WriteConsole("TriggerBot off\n") end
- Sleep(100)
- end
- if (aimbot or bhop or trigbot) then
- if (localidx ~= -1) then
- local test = GetRadarEntity(localidx)
- if (RadarPlayer.name(test) ~= o_NameStr) then
- localidx = -1
- end
- end
- if (localidx == -1) then
- WriteConsole("Finding local player index... ")
- local i = 0
- for i=0,128 do
- local test = GetRadarEntity(i)
- local name = RadarPlayer.name(test)
- if (name == o_NameStr) then
- localidx = i
- end
- end
- if (localidx ~= -1) then
- WriteConsole(" Found! Index #" .. tostring(localidx) .. ". @ " .. tostring(GetEntity(localidx)) .. "\n")
- else
- WriteConsole(" Not found!\n")
- end
- end
- end
- if (trigbot) then
- local Me = GetEntity(localidx)
- local target = Player.m_iTargetEntIdx(Me)
- local Nme = GetEntity(target)
- local ok = false
- if (Nme ~= 0) then
- if ((Player.m_iTeamNum(Nme) ~= Player.m_iTeamNum(Me)) and (Player.m_iTeamNum(Nme) ~= 0)) then
- ok = true
- end
- end
- if ((target > 0) and ok) then
- SendMessage(hwnd, WM_LBUTTONDOWN, MK_LBUTTON, 0)
- Sleep(10)
- SendMessage(hwnd, WM_LBUTTONUP, MK_LBUTTON, 0)
- end
- end
- if (bhop) then
- local Me = GetEntity(localidx)
- local groundent = Player.m_hGroundEntity(Me)
- if (groundent ~= lastgroundent) then
- SendMessage(hwnd, WM_KEYDOWN, VK_SPACE, 0x390000)
- Sleep(10)
- SendMessage(hwnd, WM_KEYUP, VK_SPACE, 0x390000)
- lastgroundent = groundent
- end
- end
- if (aimbot) then
- local Me = GetEntity(localidx)
- local OrgX, OrgY, OrgZ = Player.m_vecOrigin(Me)
- local EyeX = OrgX
- local EyeY = OrgY
- local EyeZ = OrgZ + (Player.m_bDucked(Me) and 32 or 65)
- local TgtX = 0
- local TgtY = 0
- local TgtZ = 0
- local CheckDist = 99999999
- for i=0,128 do
- if (i ~= localidx) then
- local Nme = GetEntity(i)
- if (Nme ~= 0) then
- if ((Player.m_iTeamNum(Nme) ~= Player.m_iTeamNum(Me)) and
- (Player.m_iTeamNum(Nme) ~= 0))
- then
- local NmeX, NmeY, NmeZ = Player.m_vecOrigin(Nme)
- local NyeX = NmeX
- local NyeY = NmeY
- local NyeZ = NmeZ + (Player.m_bDucked(Nme) and 32 or 65)
- --in CS:S the head is a bit forward of (0,0) on the XY plane
- local NmeP, NmeYaw, NmeR = Player.m_angRotation(Nme)
- local NmoX, NmoY = RotatePoint2D(5,5, NyeX,NyeY, NmeYaw)
- NyeX = NyeX + NmoX
- NyeY = NyeY + NmoY
- --target selection here
- local Dist = Distance3D(EyeX,EyeY,EyeZ, NyeX,NyeY,NyeZ)
- if (Dist < CheckDist) then
- TgtX = NyeX
- TgtY = NyeY
- TgtZ = NyeZ
- CheckDist = Dist
- end
- end
- end
- end
- end
- if (not IsKeyDown(VK_V)) then
- if ((TgtX ~= 0) and (TgtY ~= 0) and (TgtZ ~= 0)) then
- local pitch, yaw, roll = AngleToTarget(EyeX,EyeY,EyeZ, TgtX,TgtY,TgtZ)
- if (pitch ~= (1/0)) then
- WriteFloat(procHandle, o_EyeP, math.NormalizeAngle(pitch))
- end
- if (yaw ~= (1/0)) then
- WriteFloat(procHandle, o_EyeY, math.NormalizeAngle(yaw))
- end
- end
- end
- end
- end
- CloseHandle(procHandle)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement