Set Mouse Pos to be Locked onto an enemy

Is there a way to use the SetMousePos() to lock onto an entities position?

subtle request for aimbot?

no more for a game mode

Yes there is. One second and I’ll upload the code I wrote a while ago.

[editline]10:09PM[/editline]

[lua]
local target = // The entity at which to point
local toPoint = target:GetPos():ToScreen()

xaim = math.ceil(toPoint.x)
yaim = math.ceil(toPoint.y)
curx = ScrW() / 2
cury = ScrH() / 2
tomoveto = {}

if curx > xaim then
local tempx = curx - xaim

tomoveto.x = math.ceil(xaim + (tempx / 1.5))
if tomoveto.x != nil && tomoveto.x < ScrW() && tomoveto.x > 0 then
	prevx = tomoveto.x
end

end

if curx < xaim then
local tempx = xaim - curx

tomoveto.x = math.ceil(xaim - (tempx / 1.5))
if tomoveto.x != nil && tomoveto.x &lt; ScrW() && tomoveto.x &gt; 0 then
	prevx = tomoveto.x
end

end

if cury > yaim then
local tempy = cury - yaim

tomoveto.y = math.ceil(yaim + (tempy / 1.5))
if tomoveto.y != nil && tomoveto.y &lt; ScrH() && tomoveto.y &gt; 0 then
	prevy = tomoveto.y
end

end

if cury < yaim then
local tempy = yaim - cury

tomoveto.y = math.ceil(yaim - (tempy / 1.5))
if tomoveto.y != nil && tomoveto.y &lt; ScrH() && tomoveto.y &gt; 0 then
	prevy = tomoveto.y
end

end

if tomoveto.x == nil || tomoveto.x > ScrH() then
tomoveto.x = prevx
end

if tomoveto.y == nil || tomoveto.y > ScrH() then
tomoveto.y = prevy
end

gui.SetMousePos(tomoveto.x, tomoveto.y)[/lua]

Like I said, this is really old, as in aulde, so don’t expect it to be as optimized as it could be.