[Snippet] Get Cursor Position

Parazitas

Well-Known Member
Joined
Jan 2, 2017
Messages
677
Likes
2
Points
18
Location
Lithuania
Website
ugbase.eu
#1
With this two snippets you can get Cursor Position.

Explane.:
[shcode=cpp]
{$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 [email protected] [email protected]
    0AB1: @getFullScreenXY 2 FullScreen_And_CursorX [email protected] FullScreen_And_CursorY [email protected] conver to [email protected] [email protected]
    0093: [email protected] = integer [email protected] to_float
    0093: [email protected] = integer [email protected] to_float
    printf "%0.1f %0.1f" 2000 [email protected] [email protected]
END

END

:getFullScreenXY
[email protected] = 640.0 // screen X
0A8D: [email protected] = read_memory 0xC17044 size 4 virtual_protect 0 // full screen X
0093: [email protected] = integer [email protected] to_float
0073: [email protected] /= [email protected]
006B: [email protected] *= [email protected]
[email protected] = 448.0 // screen Y
0A8D: [email protected] = read_memory 0xC17048 size 4 virtual_protect 0 // full screen Y
0093: [email protected] = integer [email protected] to_float
0073: [email protected] /= [email protected]
006B: [email protected] *= [email protected]
0AB2: ret 2 [email protected] [email protected]

:GetCursorPos
// 0AB1: call @GetCursorPos 0 [email protected] [email protected]
0AA2: [email protected] = load_library "user32.dll"
0AA4: [email protected] = get_proc_address "GetCursorPos" library [email protected]
0AC7: [email protected] = var [email protected] offset
0AA5: call [email protected] num_params 1 pop 0 [email protected]
0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
[email protected] += 4
0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
0AB2: ret 2 [email protected] [email protected]
[/shcode]

Snippets.:
[shcode=cpp]

:getFullScreenXY
[email protected] = 640.0 // screen X
0A8D: [email protected] = read_memory 0xC17044 size 4 virtual_protect 0 // full screen X
0093: [email protected] = integer [email protected] to_float
0073: [email protected] /= [email protected]
006B: [email protected] *= [email protected]
[email protected] = 448.0 // screen Y
0A8D: [email protected] = read_memory 0xC17048 size 4 virtual_protect 0 // full screen Y
0093: [email protected] = integer [email protected] to_float
0073: [email protected] /= [email protected]
006B: [email protected] *= [email protected]
0AB2: ret 2 [email protected] [email protected]

:GetCursorPos
// 0AB1: call @GetCursorPos 0 [email protected] [email protected]
0AA2: [email protected] = load_library "user32.dll"
0AA4: [email protected] = get_proc_address "GetCursorPos" library [email protected]
0AC7: [email protected] = var [email protected] offset
0AA5: call [email protected] num_params 1 pop 0 [email protected]
0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
[email protected] += 4
0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
0AB2: ret 2 [email protected] [email protected]

[/shcode]


Credits.: @Opcode.eXe
 
Top