i think theres an offset for it, i did that before i can search later
/edit
Code:
crosshair Y float 0xB6EC10
crosshair X float 0xB6EC14
both values of 0.5 results in a retarded view. yes its the middle if u want that xD
That is exactly what I was looking for! Thank you.
OK in return,here is my Basic Aimbot example, it is a
Snapshot Aimbot:
- Toggle Key: CAPSLOCK + 1 key
- Just press fire+aim key and the crosshair will Instantly snap at the brain of an actor near the center of the screen.
Code:
{$CLEO}
0000: ajom's Basic Brain Snapshot(No Prediction System) - I call it "snapshot" because the crosshair "snap/instantly" moves at the brain of the actor
repeat
wait 0
until 056D: actor $PLAYER_ACTOR defined
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Initialization ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
const
TARGET_ACTOR = 31@
ISENABLED = 30@
DATABASE = 29@
KEY1 = 20 // CAPSLOCK
KEY2 = 49 // 1 Key
end
ISENABLED = false
// save default settings to allocated memory
alloc DATABASE 8
0A8D: 1@ = read_memory 0xB6EC14 size 4 virtual_protect 0 // Crosshair X multiplier
0085: 0@ = DATABASE
0A8C: write_memory 0@ size 4 value 1@ virtual_protect 0 // Save Crosshair X multiplier
0A8D: 1@ = read_memory 0xB6EC10 size 4 virtual_protect 0 // Crosshair Y multiplier
0@ += 4
0A8C: write_memory 0@ size 4 value 1@ virtual_protect 0 // Save Crosshair Y multiplier
//
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ End of Initialization ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Main Thread ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
while true
wait 0 // loop anti hang
if and
0AB0: key_pressed KEY1
0AB0: key_pressed KEY2
then
0B12: ISENABLED = ISENABLED XOR 1
if ISENABLED == true
then
0A8C: write_memory 0xB6EC14 size 4 value 0.5 virtual_protect 0 // Crosshair X multiplier
0A8C: write_memory 0xB6EC10 size 4 value 0.5 virtual_protect 0 // Crosshair Y multiplier
else // reset default crosshair settings
0085: 0@ = DATABASE
0A8D: 1@ = read_memory 0@ size 4 virtual_protect 0 // default settings: Crosshair X multiplier
0A8C: write_memory 0xB6EC14 size 4 value 1@ virtual_protect 0 // Crosshair X multiplier
0@ += 4
0A8D: 1@ = read_memory 0@ size 4 virtual_protect 0 // default settings: Crosshair Y multiplier
0A8C: write_memory 0xB6EC10 size 4 value 1@ virtual_protect 0 // Crosshair Y multiplier
end
0AD1: show_formatted_text_highpriority "~g~Brain Snapshot: ~y~%d" time 2000 ISENABLED
while 0AB0: key_pressed KEY2 // anti key spam
wait 0
end
end
if ISENABLED == true
then
if // or
// 00E1: player $PLAYER_CHAR pressed_key 6 // aim weapon
00E1: player $PLAYER_CHAR pressed_key 17 // fire weapon
then
// screen resolution
0A8D: 0@ = read_memory 0xC17044 size 4 virtual_protect 0 // Screen Width
0A8D: 1@ = read_memory 0xC17048 size 4 virtual_protect 0 // Screen Height
008F: 0@ = integer 0@ to_float
008F: 1@ = integer 1@ to_float
// screen half resolution
0087: 2@ = 0@
0087: 3@ = 1@
2@ /= 2.0
3@ /= 2.0
//
if 0AB1: @getactoratscreen 7 _withinupperleftrectangleXY 0.0 0.0 _andbottomrightrectangleXY 0@ 1@ _nearscreencoordXY 2@ 3@ _ignoreactor -1 _storeactor TARGET_ACTOR
then
0A96: 0@ = actor TARGET_ACTOR struct
while 00E1: player $PLAYER_CHAR pressed_key 6 // aim weapon
if and
056D: actor TARGET_ACTOR defined
00E1: player $PLAYER_CHAR pressed_key 17 // fire weapon
then
0AA6: call_method 0x5E4280 struct 0@ num_params 3 pop 0 bIncludeAnim 1 iBoneID 6 vPosition 1@v // store Actor Brain XYZ Position to 1@ 2@ 3@
0AB1: @camatpos 5 _XYZ 1@ 2@ 3@ _withCamOffsetAngleX 0.0 _andCamOffsetAngleZ 0.0
wait 0 // loop anti hang
else break
end
end
end
end
end
end
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ End of Main Thread ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SubRoutines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ End of SubRoutines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// 0AB1: @getactoratscreen 7 _withinupperleftrectangleXY 0.0 0.0 _andbottomrightrectangleXY 2.0 2.0 _nearscreencoordXY 1.0 1.0 _ignoreactor -1 _storeactor 29@ // all coords are float!
:getactoratscreen
0085: 29@ = 6@ // ignored actor
28@ = 65535.0 // very high screen coord
0A8D: 27@ = read_memory 0xB74490 size 4 virtual_protect 0
27@ += 4
0A8D: 27@ = read_memory 27@ size 4 virtual_protect 0
for 26@ = 0x0 to 0x8B00 step 0x100
0A8D: 25@ = read_memory 27@ size 1 virtual_protect 0
27@++
if and
25@ >= 0x00
25@ < 0x80
then
005A: 25@ += 26@ // got the ped
if or
856D: NOT actor 25@ defined // REMOTE ACTOR IS NOT DEFINED
003C: $PLAYER_ACTOR == 25@ // OUR ACTOR == REMOTE ACTOR
003C: 6@ == 25@ // IGNORED ACTOR == REMOTE ACTOR
then continue
end
if 82CB: not actor 25@ bounding_sphere_visible
then continue
end
//
// < SOME PARAMETERS HERE FOR GETTING YOUR DESIRED TARGETS >
//
00A0: store_actor 25@ position_to 21@ 22@ 23@
0B55: convert_3D_coords 21@ 22@ 23@ to_screen 14@ 15@
0AB1: @getScreenXYFrom3DCoords 3 _from3Dcoord_XYZ 21@ 22@ 23@ _to2Dcoord_XY 22@ 23@
0AD1: show_formatted_text_highpriority "SNIPPET: %fx%f~n~SAMPFUNCS: %dx%d" time 2000 22@ 23@ 14@ 15@
if and // if bounded within the rectangle
0035: 22@ >= 0@ // leftmost boundary
0035: 2@ >= 22@ // rightmost boundary
0035: 23@ >= 1@ // uppermost boundary
0035: 3@ >= 23@ // bottommost boundary
then
0509: 21@ = distance_between_XY 22@ 23@ and_XY 4@ 5@
if 0025: 28@ > 21@ // (float)
then
0087: 28@ = 21@ // store nearer distance
0085: 29@ = 25@ // store nearer actor
end
end
end
end
if or
856D: not actor 29@ defined
003C: 29@ == 6@ // was the ignored actor
then 059A: return_false
else 0485: return_true
end
ret 1 29@
:getScreenXYFrom3DCoords
{
Parameters: 0AB1: @getScreenXYFrom3DCoords 3 _from3Dcoord_XYZ 0@ 1@ 2@ _toscreencoord_XY 3@ 4@
Passed: 0@ - position X 1@ - position Y 2@ - position Z
Result: 3@ - screen X 4@ - screen Y
Example: 0AB1: @getScreenXYFrom3DCoords 3 _from3Dcoord_XYZ 2488.562 -1666.865 12.8757 _toscreencoord_XY 1@ 2@
}
0AA5: call 0x70CE30 num_params 6 pop 6 bFarClip 0 bNearClip 0 pMultY 6@v pMultX 5@v pScreen 3@v pCoords 0@v // ConvertGlobalXYToScreenXY
0A8D: 11@ = read_memory 0xC17044 size 4 virtual_protect 0 // full screen X
0093: 11@ = integer 11@ to_float
0A8D: 12@ = read_memory 0x859520 size 4 virtual_protect 0 // screen X scale
006B: 11@ *= 12@
0073: 3@ /= 11@
0A8D: 11@ = read_memory 0xC17048 size 4 virtual_protect 0 // full screen Y
0093: 11@ = integer 11@ to_float
0A8D: 12@ = read_memory 0x859524 size 4 virtual_protect 0 // screen Y scale
006B: 11@ *= 12@
0073: 4@ /= 11@
0AB2: ret 2 3@ 4@
// 0AB1: @camatpos 5 _XYZ 0@ 1@ 2@ _withCamOffsetAngleX 3@ _andCamOffsetAngleZ 4@
:camatpos
// ~~~~~~~~~~anti auto-vehicle cam movement
if and
TIMERA>=400
Actor.Driving($PLAYER_ACTOR)
then
0A8C: write_memory 0xB70118 size 4 value 50.0 virtual_protect 0 // reset camera stabalizer timer, credit to Parazitas
TIMERA = 0
end
// ~~~~~~~~~~
068D: get_camera_position_to 31@ 30@ 29@
// ~~~~~~~~~~Camera Z-Angle from our camera towards the target
0087: 28@ = 1@ // y2
0063: 28@ -= 30@ // y1
0087: 27@ = 0@ // x2
0063: 27@ -= 31@ // x1
if and
27@ == 0.0
28@ == 0.0
then 28@ = 0.0
else
0AA5: atan2 | 0x4207C0 2 2 | _X 27@ _Y 28@
0AE9: pop_float 28@ // store result from above operation
end
28@ += 3.1415926535897981710616733832795 // Camera Angle Leads 180 degrees respect to Z world coordinats
005B: 28@ += 4@ // use the defined camz offset to move the camera leftwards or rightwards
// ~~~~~~~~~~
// ~~~~~~~~~~Camera X-Angle from our camera towards the target
0087: 27@ = 2@ // z2
0063: 27@ -= 29@ // z1
0509: 26@ = distance_between_XY 31@ 30@ and_XY 0@ 1@ // adjacent side
if and
26@ == 0.0
27@ == 0.0
then 27@ = 0.0
else
0AA5: atan2 | 0x4207C0 2 2 | _X 26@ _Y 27@
0AE9: pop_float 27@ // store result from above operation
end
005B: 27@ += 3@ // use the defined camx offset to move the camera downwards or upwards
// ~~~~~~~~~~
0A25: set_camera_on_players_X_angle 27@ Z_angle 28@
ret 0
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ End of Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Now I am facing a New problem, it is about
Wesser's getScreenXYFrom3DCoords, I produces innacurate result. I compared it with SAMPFUNCS Opcode
0B55 and it seems the SAMPFUNCS shows the right screen value while getScreenXYFrom3DCoords produces bad results
:
Code:
// 25@ is any actor at the screen
00A0: store_actor 25@ position_to 21@ 22@ 23@
0B55: convert_3D_coords 21@ 22@ 23@ to_screen 14@ 15@
0AB1: @getScreenXYFrom3DCoords 3 _from3Dcoord_XYZ 21@ 22@ 23@ _to2Dcoord_XY 22@ 23@
0AD1: show_formatted_text_highpriority "SNIPPET: %fx%f~n~SAMPFUNCS: %dx%d" time 2000 22@ 23@ 14@ 15@
As you can see on the picture the SAMPFUNCS have the right values. The
getScreenXYFrom3DCoords snippet fails to have the same value. Anybody knows the sourcecode of SAMPFUNCS Opcode
0B55?