With this two snippets you can get Cursor Position.
Explane.:
Credits.: @Opcode.eXe
Explane.:
Code:
{$CLEO .cs}
0000:
REPEAT
WAIT 0
UNTIL 0AFA: SAMP_IS_READY
WHILE TRUE
wait 0
IF
0B8C: samp is_cursor_active
THEN
0AB1: @GetCursorPos 0 0@ 1@
0AB1: @getFullScreenXY 2 FullScreen_And_CursorX 0@ FullScreen_And_CursorY 1@ conver to 0@ 1@
0093: 0@ = integer 0@ to_float
0093: 1@ = integer 1@ to_float
printf "%0.1f %0.1f" 2000 0@ 1@
END
END
:getFullScreenXY
2@ = 640.0 // screen X
0A8D: 4@ = read_memory 0xC17044 size 4 virtual_protect 0 // full screen X
0093: 4@ = integer 4@ to_float
0073: 2@ /= 4@
006B: 0@ *= 2@
3@ = 448.0 // screen Y
0A8D: 5@ = read_memory 0xC17048 size 4 virtual_protect 0 // full screen Y
0093: 5@ = integer 5@ to_float
0073: 3@ /= 5@
006B: 1@ *= 3@
0AB2: ret 2 0@ 1@
:GetCursorPos
// 0AB1: call @GetCursorPos 0 3@ 4@
0AA2: 0@ = load_library "user32.dll"
0AA4: 1@ = get_proc_address "GetCursorPos" library 0@
0AC7: 2@ = var 5@ offset
0AA5: call 1@ num_params 1 pop 0 2@
0A8D: 3@ = read_memory 2@ size 4 virtual_protect 0
2@ += 4
0A8D: 4@ = read_memory 2@ size 4 virtual_protect 0
0AB2: ret 2 3@ 4@
[/shcode]
Snippets.:
[shcode=cpp]
:getFullScreenXY
2@ = 640.0 // screen X
0A8D: 4@ = read_memory 0xC17044 size 4 virtual_protect 0 // full screen X
0093: 4@ = integer 4@ to_float
0073: 2@ /= 4@
006B: 0@ *= 2@
3@ = 448.0 // screen Y
0A8D: 5@ = read_memory 0xC17048 size 4 virtual_protect 0 // full screen Y
0093: 5@ = integer 5@ to_float
0073: 3@ /= 5@
006B: 1@ *= 3@
0AB2: ret 2 0@ 1@
:GetCursorPos
// 0AB1: call @GetCursorPos 0 3@ 4@
0AA2: 0@ = load_library "user32.dll"
0AA4: 1@ = get_proc_address "GetCursorPos" library 0@
0AC7: 2@ = var 5@ offset
0AA5: call 1@ num_params 1 pop 0 2@
0A8D: 3@ = read_memory 2@ size 4 virtual_protect 0
2@ += 4
0A8D: 4@ = read_memory 2@ size 4 virtual_protect 0
0AB2: ret 2 3@ 4@
Credits.: @Opcode.eXe
Last edited: