Use shit velocity prediction.
Is there a way to have accurate aimbot using GLua?
Use shit velocity prediction.
20% hit when either me or enemy moving
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.)
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.
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 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.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)
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