Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- LOCK-ON OVERHAUL ( SOURCE CODE )
- -- AUTHOR : ALTAMURENZA
- --[[
- - NOTE -
- YOU CAN'T CHANGE OBJECT BECAUSE ITS VALUE ALWAYS BE -1 OR PED
- * AIM PERSPECTIVE (Type) *
- 0 - FREE AIM
- 1 - CLOSEST DISTANCE ( RECOMMENDED )
- 2 - LOWEST HEALTH
- 3 - FARTHEST DISTANCE
- 4 - HIGHEST HEALTH
- * MAXIMUM RANGE (Range) *
- IT'S RECOMMENDED ABOUT 5 TO 10
- ]]
- shared.Aim = {
- Object = -1, Type = 1, Range = 8 -- look at the note above
- }; local sqrt, floor = math.sqrt, math.floor
- function main()
- while not SystemIsReady() or AreaIsLoading() do
- Wait(0)
- end
- CreateThread("mainSwitch")
- while true do
- local X, Y, Z = PlayerGetPosXYZ()
- if shared.Aim.Type ~= 0 and shared.Aim.Type < 5 then
- if IsButtonPressed(10, 0) then
- shared.Aim.Object = -1
- local SIZE, MAXN = {}, 0
- for i, Ped in {PedFindInAreaXYZ(0, 0, 0, 999999)} do
- if PedIsValid(Ped) and Ped ~= gPlayer and PedGetHealth(Ped) > 0 then
- local PX, PY, PZ = PedGetPosXYZ(Ped)
- local Distance = sqrt((X - PX)*(X - PX) + (Y - PY)*(Y - PY) + (Z - PZ)*(Z - PZ))
- if Distance < shared.Aim.Range then
- local Value = floor(shared.Aim.Type == 1 and Distance or PedGetHealth(Ped))
- SIZE[SIZE[Value] and Value - 1 or Value], MAXN = Ped, Value > MAXN and Value or MAXN
- end
- end
- end
- local Count = shared.Aim.Type > 2 and MAXN or 0
- while shared.Aim.Type < 3 and not SIZE[Count] do
- Count = Count + 1
- if Count > MAXN then
- break
- end
- end
- shared.Aim.Object = PedIsValid(SIZE[Count]) and SIZE[Count] or -1
- if shared.Aim.Object ~= -1 then
- PedLockTarget(gPlayer, shared.Aim.Object, 3)
- end
- else
- if IsButtonBeingReleased(10, 0) then
- shared.Aim.Object = -1; PedLockTarget(gPlayer, -1)
- end
- end
- else
- shared.Aim.Object = -1
- end
- Wait(0)
- end
- end; function mainSwitch()
- while true do
- if IsButtonPressed(10, 0) and IsButtonBeingPressed(3, 0) then
- shared.Aim.Type = shared.Aim.Type + 1 < 5 and shared.Aim.Type + 1 or 0
- if shared.Aim.Type == 0 then
- PedLockTarget(gPlayer, -1)
- end
- TextPrintString(shared.Aim.Type == 0 and "FREE AIM" or
- (shared.Aim.Type == 1 and "AIM - CLOSEST DISTANCE" or
- (shared.Aim.Type == 2 and "AIM - LOWEST HEALTH" or
- (shared.Aim.Type == 3 and "AIM - FARTHEST DISTANCE" or
- (shared.Aim.Type == 4 and "AIM - HIGHEST HEALTH" or
- "NILL"))))
- , 1, 2)
- end
- Wait(0)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement