OldSchoolHack

Register / Login English

LuaCSGO

icon Thread: [Release] LuaCSGO

Join Date: Aug 2007

Posts: 1957

Kategorie: Counter-Strike: Global Offensive
Entwickler: MarkHC

Beschreibung:
This is a Lua "API" for CSGO. I used LuaBind for the interactions between Lua and C++. There's a lot of info on the github repository, link below.

Github repository: Only registered and activated users can see links.

How to use this:
  1. At the bottom of this post there's a download link for the Dll + Scripts.
  2. Scripts MUST be placed at "steamapps\common\Counter-Strike Global Offensive\LuaCSGO\"
  3. After having everything on its place, you can inject the Dll into CSGO


LUA Code:
  1. require("LuaCSGO/Settings")
  2. require("LuaCSGO/LuaESP")
  3.  
  4. g_pEngine         = Interfaces:GetEngineInterface()
  5. g_pEngineTrace    = Interfaces:GetEngineTraceInterface()
  6. g_pEntityList     = Interfaces:GetEntityListInterface()
  7. g_pVGUIPanel    = Interfaces:GetPanelInterface()
  8. g_pGlobals         = Interfaces:GetGlobalVars()
  9.  
  10. local g_pMenuFont     = nil
  11. local iTopPanel        = nil
  12.  
  13. function OnKeyEvent(keyEvent)
  14.     if keyEvent.Type == EVENT_KEYDOWN then
  15.         if keyEvent.KeyCode == KEY_HOME then
  16.             LuaCSGO:Toggle()
  17.             if not LuaCSGO:IsActive() then
  18.                 --Not active, disable all callbacks except the keyboard
  19.                 Callbacks:DisableAllExcept(CALLBACK_KEYBOARD)
  20.             else
  21.                 --Enable all of the registered callbacks
  22.                 Callbacks:EnableAllCallbacks()
  23.             end
  24.         elseif keyEvent.KeyCode == KEY_INSERT then
  25.             --This will force a reload of all the scripts
  26.             RELOAD()
  27.         end
  28.         
  29.     end
  30.     
  31.     return false
  32. end
  33.  
  34. function OnPaintTraverse(vguiPanel)
  35.     if iTopPanel == nil then
  36.         szPanelName = g_pVGUIPanel:GetName(vguiPanel)
  37.         print(szPanelName)
  38.         --Is this panel the top panel?
  39.         if szPanelName == "MatSystemTopPanel" then
  40.         
  41.             --If it is, then save its number so we dont have to compare strings anymore
  42.             iTopPanel = vguiPanel
  43.             print("MatSystemTopPanel found. ID = " .. iTopPanel)
  44.             
  45.             --Create a font for drawing
  46.             g_pMenuFont = DrawManager:CreateNewFont("Courier New", 16, false, false, true, true)
  47.         end
  48.     elseif vguiPanel == iTopPanel then
  49.         
  50.         --Is the local player in-game?
  51.         if g_pEngine:IsInGame() then
  52.             
  53.             --Taking a screenshot. Don't draw anything, let's look legit! :-)
  54.             if g_pEngine:IsTakingScreenshot() then return end
  55.         
  56.             local pLocalPlayer = g_pEntityList:GetEntityFromIndex(g_pEngine:GetLocalPlayer())
  57.             
  58.             --If local player is not valid then we return immediately.
  59.             --This should never happen, but it is good to check anyways.
  60.             if not pLocalPlayer:IsValid() then
  61.                 return
  62.             end
  63.             
  64.             --For each entity...
  65.             for i = 1, g_pEntityList:GetHighestEntityIndex() do
  66.                 --Grab the entity from the entity list
  67.                 local pEntity = g_pEntityList:GetEntityFromIndex(i)
  68.                 
  69.                 --Is it a valid entity?
  70.                 if pEntity:IsValid() then
  71.                     
  72.                     iClassID = pEntity:GetClassID()
  73.                     --Is it a player? (This check is not a must, but it is useful when you want to do something with entities that are not players)
  74.                     --    You could also compare by name, if you dont know the ID. like so: if pEntity:GetClassName() == "CCSPlayer"
  75.                     if iClassID == 34 --[[CCSPlayer]] then
  76.                         
  77.                         --Is it alive, not dormant and is not the local player?
  78.                         if pEntity:IsAlive() and not pEntity:IsDormant() and i ~= g_pEngine:GetLocalPlayer() then
  79.                             
  80.                             DrawBox(pLocalPlayer, pEntity)
  81.                             DrawNames(pLocalPlayer, pEntity, i)
  82.                         end    
  83.                     elseif iClassID == 103 then
  84.                         --Do something with CCSPlantedC4
  85.                     end
  86.                 end
  87.             end
  88.         end
  89.     end
  90. end
  91.  
  92. function Clamp(vec)
  93.     if vec.Y > 180.0 then
  94.         vec.Y = vec.Y - 360.0
  95.     elseif vec.Y < -180.0 then
  96.         vec.Y = vec.Y + 360.0
  97.     end
  98.  
  99.     if vec.X > 89.0 then
  100.         vec.X = 89.0;
  101.     elseif vec.X < -89.0 then
  102.         vec.X = -89.0
  103.     end
  104.     
  105.     vec.Z = 0.0
  106.     
  107.     return vec
  108. end
  109.  
  110. function OnCreateMove(userCmd,verifiedCmd)
  111.     --Local player will always be valid on CreateMove (LuaCSGO does the check before calling the callback)
  112.     local pLocalPlayer = g_pEntityList:GetEntityFromIndex(g_pEngine:GetLocalPlayer())
  113.     local oldAngles = userCmd.ViewAngles
  114.     local punchAngles = pLocalPlayer:GetAimPunch()
  115.     
  116.     local newAngles = oldAngles - punchAngles * 2
  117.     
  118.     userCmd.ViewAngles = Clamp(newAngles)
  119.     
  120.     --Apply new UserCMD and updates CRC
  121.     verifiedCmd:Update(userCmd)
  122. end
  123.  
  124. local oldAimPunch = Vector()
  125. local oldViewPunch = Vector()
  126. local bRestore = false
  127.  
  128. function OnFrameStageNotifyBegin(stage)
  129.     if stage == FRAME_RENDER_START then
  130.         local pLocalPlayer = g_pEntityList:GetEntityFromIndex(g_pEngine:GetLocalPlayer())
  131.         if pLocalPlayer:IsValid() then
  132.             --Save the old angles
  133.             oldViewPunch = pLocalPlayer:GetViewPunch()
  134.             oldAimPunch = pLocalPlayer:GetAimPunch()
  135.             
  136.             --Reset view and aim punch
  137.             pLocalPlayer:SetViewPunch(Vector(0,0,0))
  138.             pLocalPlayer:SetAimPunch(Vector(0,0,0))
  139.             
  140.             --Set the restore flag
  141.             bRestore = true
  142.         end
  143.     end
  144. end
  145.  
  146. function OnFrameStageNotifyEnd(stage)
  147.     --If the flag is set, then we have angles to restore
  148.     if bRestore then
  149.         local pLocalPlayer = g_pEntityList:GetEntityFromIndex(g_pEngine:GetLocalPlayer())
  150.         if pLocalPlayer:IsValid() then
  151.             pLocalPlayer:SetViewPunch(oldViewPunch)
  152.             pLocalPlayer:SetAimPunch(oldAimPunch)
  153.             bRestore = false
  154.         end
  155.     end
  156. end
  157.  
  158. --Register used callbacks
  159. Callbacks:Register(CALLBACK_KEYBOARD,                     OnKeyEvent)
  160. Callbacks:Register(CALLBACK_PAINTTRAVERSE,                 OnPaintTraverse)
  161. Callbacks:Register(CALLBACK_CREATEMOVE,                 OnCreateMove)
  162. Callbacks:Register(CALLBACK_FRAMESTAGENOTIFY_BEGIN,     OnFrameStageNotifyBegin)
  163. Callbacks:Register(CALLBACK_FRAMESTAGENOTIFY_END,         OnFrameStageNotifyEnd)
  164.  

Screenshots:
https://www.oldschoolhack.me/hackdata/screenshot/thumb/252471034c3b921727342e92310b8246.jpg

Download:
LuaCSGO