Results 1 to 9 of 9
  1. #1
    martin951's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Location
    Straight outta Compton
    Posts
    158
    Reputation
    139
    Thanks
    114
    My Mood
    Mellow

    Lua Aim Prediction

    Is there a way to have accurate aimbot using GLua?

  2. #2
    guessjoe1's Avatar
    Join Date
    Aug 2014
    Gender
    male
    Posts
    58
    Reputation
    10
    Thanks
    4
    My Mood
    Bored
    Use shit velocity prediction.

  3. #3
    martin951's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Location
    Straight outta Compton
    Posts
    158
    Reputation
    139
    Thanks
    114
    My Mood
    Mellow
    20% hit when either me or enemy moving

  4. #4
    kingnigger123's Avatar
    Join Date
    May 2018
    Gender
    male
    Posts
    7
    Reputation
    10
    Thanks
    0
    predict localplayer

  5. #5
    guessjoe1's Avatar
    Join Date
    Aug 2014
    Gender
    male
    Posts
    58
    Reputation
    10
    Thanks
    4
    My Mood
    Bored
    There's numerous reason why you're going to miss. (Your position always being 1 tick behind, Your tickcount,How you store the position of the players, Maybe your bad code aswell.)

  6. #6
    martin951's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Location
    Straight outta Compton
    Posts
    158
    Reputation
    139
    Thanks
    114
    My Mood
    Mellow
    Trying to solve all those reaons, thast why I created this post.


    This is the mess that I have now
    - - - Updated - - -

    Code:
    for k,v in pairs (ents.FindByClass(aimClass)) do
    			if v ~= LP and !v:IsDormant() and v:IsValid() and v:Health() > 0 then
    				if aimClass == "player" then
    					aimPredTarget = ( v:GetVelocity() * ( (engine.TickInterval()) ))
    					aimPredPlayer = ( LP:GetVelocity() * ( (engine.TickInterval()) ))
    				else
    					aimPredTarget = ( v:GetVelocity() * ( (engine.TickInterval()) ))
    					aimPredPlayer = ( LP:GetVelocity() * ( (engine.TickInterval()) ))
    				end
    
    				local targetBone = ENT["GetHitBoxBone"](v,0,0)
    				local min,max = ENT["GetHitBoxBounds"](v,0,0)
    				local _Matrix = ENT["GetBoneMatrix"](v, targetBone);
    				if !_Matrix then return end
    				_Matrix = VM["ToTable"](_Matrix)
    
    				local TargetPos = (Transform(min, _Matrix) + Transform(max,_Matrix))* 0.5
    				local TargetAimPos = (TargetPos-aimPredTarget-aimPredPlayer)
    				local rc = util.TraceLine(
    					{
    						start = LP:GetShootPos(),
    						endpos = TargetPos,
    						filter = {LP}
    					}
    				)
    
    				if v:Health() > 0 and rc.Entity == v and (LP:GetActiveWeapon():GetNextPrimaryFire() - CurTime()) < 0.01 then
    					pCmd:SetViewAngles( (TargetAimPos - (LP:GetShootPos()) ):Angle())
    					pCmd:SetViewAngles( pCmd:GetViewAngles() - LP:GetViewPunchAngles() )
    					--FixMovement(pCmd)
    				end
    
    				if canFire(v, TargetPos) and (LP:GetActiveWeapon():GetNextPrimaryFire() - CurTime()) < 0.01 then
    					pCmd:SetButtons(bit.bor(pCmd:GetButtons(), 1))
    				else
    				end
    			end
    		end
    Last edited by martin951; 10-08-2019 at 04:14 PM.

  7. #7
    guessjoe1's Avatar
    Join Date
    Aug 2014
    Gender
    male
    Posts
    58
    Reputation
    10
    Thanks
    4
    My Mood
    Bored
    Quote Originally Posted by martin951 View Post
    Trying to solve all those reaons, thast why I created this post.


    This is the mess that I have now
    - - - Updated - - -

    Code:
    for k,v in pairs (ents.FindByClass(aimClass)) do
    			if v ~= LP and !v:IsDormant() and v:IsValid() and v:Health() > 0 then
    				if aimClass == "player" then
    					aimPredTarget = ( v:GetVelocity() * ( (engine.TickInterval()) ))
    					aimPredPlayer = ( LP:GetVelocity() * ( (engine.TickInterval()) ))
    				else
    					aimPredTarget = ( v:GetVelocity() * ( (engine.TickInterval()) ))
    					aimPredPlayer = ( LP:GetVelocity() * ( (engine.TickInterval()) ))
    				end
    
    				local targetBone = ENT["GetHitBoxBone"](v,0,0)
    				local min,max = ENT["GetHitBoxBounds"](v,0,0)
    				local _Matrix = ENT["GetBoneMatrix"](v, targetBone);
    				if !_Matrix then return end
    				_Matrix = VM["ToTable"](_Matrix)
    
    				local TargetPos = (Transform(min, _Matrix) + Transform(max,_Matrix))* 0.5
    				local TargetAimPos = (TargetPos-aimPredTarget-aimPredPlayer)
    				local rc = util.TraceLine(
    					{
    						start = LP:GetShootPos(),
    						endpos = TargetPos,
    						filter = {LP}
    					}
    				)
    
    				if v:Health() > 0 and rc.Entity == v and (LP:GetActiveWeapon():GetNextPrimaryFire() - CurTime()) < 0.01 then
    					pCmd:SetViewAngles( (TargetAimPos - (LP:GetShootPos()) ):Angle())
    					pCmd:SetViewAngles( pCmd:GetViewAngles() - LP:GetViewPunchAngles() )
    					--FixMovement(pCmd)
    				end
    
    				if canFire(v, TargetPos) and (LP:GetActiveWeapon():GetNextPrimaryFire() - CurTime()) < 0.01 then
    					pCmd:SetButtons(bit.bor(pCmd:GetButtons(), 1))
    				else
    				end
    			end
    		end
    You can't really do much in lua so I'd advise learn about how to make modules to use source functions to help you with. (Aka tickcount/engine prediction)

  8. #8
    SemixOfficial's Avatar
    Join Date
    Aug 2018
    Gender
    male
    Location
    Czech Republic
    Posts
    4
    Reputation
    10
    Thanks
    0
    My Mood
    Lonely

    Smile

    First of all, this is horrible, what you are doing has nothing to do with prediction, this is just extrapolation that gives you approximate estimation of your position on next tick.

    About this:
    You can't really do much in lua so I'd advise learn about how to make modules to use source functions to help you with. (Aka tickcount/engine prediction)
    You can actually create very accurate prediction, in fact almost as good or same as engine prediction you will just have to port some functions from SourceSDK into Garry's mod lua or make simplified version of the function that does same thing except you'd throw out some stuff that you won't really need to do engine prediction or lua.

    Engine prediction is a very simple thing in C++ and if you can recreate three functions it's actually very easy in GLua too!

    First we are gonna call CPrediction::SetupMove() which will set some move data and stuff used later in CGameMovement::ProcessMovement() which is the second function we are gonna be calling, lastly we are gonna call CPrediction::FinishMove()

    You might also want to call CGameMovement::StartTrackPredictionErrors() before doing this and CGameMovement::FinishTrackPredictionErrors() after wards but if you are gonna be making engine pred in lua you won't need this anyways.

    Make sure you also set all globals appropriatelly and save some stuff that you might want or need to restore after you are done with engine prediction before doing your engine prediction and then restoring them afterwards, this is why many cheats have g_pEnginePrediction->Start(pCmd) and g_pEnginePrediction->Finish() so once they are done and don't need engine prediction all variables that need and should be restored to their original value actually get restored, once again if you are doing lua you might just make locals and not actually change the globals like C++ engine pred does.

    In the end this is as simple as engine prediction can get, there's few other things you might want to do like calling CPrediction::Update() before engine pred which will fix bunnyhop, tickbase and lot of other things when your framerate is low, you can do it by either calling it manually with proper arguments or just call host runframe which will call CPrediction::Update for you.

    If you are interested in making pure lua engine prediction or at least a wague replica of it in lua, see SourceSDK for all the functions you will need.
    https://******.com/ValveSoftware/sou...ction.cpp#L831
    https://******.com/ValveSoftware/sou...ction.cpp#L608
    https://******.com/ValveSoftware/sou...ment.cpp#L1133
    https://******.com/ValveSoftware/sou...ction.cpp#L689

  9. #9
    guessjoe1's Avatar
    Join Date
    Aug 2014
    Gender
    male
    Posts
    58
    Reputation
    10
    Thanks
    4
    My Mood
    Bored
    Thanks for the necro bump.

Similar Threads

  1. Replies: 2
    Last Post: 01-06-2016, 12:38 AM
  2. [Request] Sniper Aim Prediction
    By formpg in forum Battlefield 3 (BF3) Hacks & Cheats
    Replies: 5
    Last Post: 02-19-2012, 09:31 PM
  3. Aim Prediction
    By hhhjr1 in forum Combat Arms Hack Coding / Programming / Source Code
    Replies: 11
    Last Post: 08-19-2010, 10:12 PM
  4. Aim Prediction
    By nahum12339 in forum Combat Arms Help
    Replies: 3
    Last Post: 08-14-2010, 10:15 PM
  5. Aim Prediction
    By @chris in forum Combat Arms Discussions
    Replies: 20
    Last Post: 08-07-2010, 09:51 PM