[SNIPPET] Send KeyPress

Opcode.eXe

Well-Known Member
Joined
Feb 18, 2013
Messages
1,257
Likes
10
Points
38
Location
( ͡° ͜ʖ ͡°)
Website
www.youtube.com
#1
:keyPress
// [email protected] - key, [email protected] - time
// Example: 0AB1: call @keyPress 2 key [email protected] time [email protected]

if 0AA2: [email protected] = load_library "User32.dll"
then
    if 0AA4: [email protected] = get_proc_address "keybd_event" library [email protected]
    then
        0AA5: call [email protected] num_params 4 pop 0 0 0 0 [email protected]
        wait [email protected]
        0AA5: call [email protected] num_params 4 pop 0 0 0x02 0 [email protected]
    end
end
0AB2: ret 0
 

Parazitas

Well-Known Member
Joined
Jan 2, 2017
Messages
680
Likes
2
Points
18
Location
Lithuania
Website
ugbase.eu
#6
Or this little different , but same method. Here i used virtual key codes.

[shcode=cpp]
Explane:
0AB1: @FAKE_KEYPRESS 1 _OFFSET_KEY_ 0x44 {A}


/// Snippet
:FAKE_KEYPRESS
if 0AA2: [email protected] = load_library "User32.dll"
then
   if 0AA4: [email protected] = get_proc_address "keybd_event" library [email protected]
   then
       0AA5: call [email protected] num_params 4 pop 0 0 0 0 [email protected]
       wait [email protected]
       0AA5: call [email protected] num_params 4 pop 0 0 0x02 0 [email protected]
   end
end
0AB2: ret 0
[/shcode]


Virtual key codes


Offset        Slot    
+ 0x0        Right                        
+ 0x1        Left                            
+ 0x2        Backwards                    
+ 0x3        Forward                        
+ 0x4        Look right                    
+ 0x5        Look left                    
+ 0x6        Look down                        
+ 0x7        Look up                            
+ 0x8        Action            
+ 0xA        Previous weapon/target                
+ 0xC        Aim weapon                    
+ 0xE        Next weapon/target                
+ 0x10        Group CTRL forward                    
+ 0x12        Group CTRL back                        
+ 0x14        Conversation - NO                    
+ 0x16        Conversation - YES                    
+ 0x1A        Change camera                    
+ 0x1C        Jump                            
+ 0x1E        Enter+exit                        
+ 0x20        Sprint                            
+ 0x22        Fire                            
+ 0x24        Crouch                            
+ 0x26        Look behind                        
+ 0x28        Unused                            
+ 0x2A        Walk                            

and more ....
https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx
 

shanker

Well-Known Member
Joined
Sep 18, 2016
Messages
219
Likes
0
Points
16
Location
Romania
#7
Opcode.eXe said:
:keyPress
// [email protected] - key, [email protected] - time
// Example: 0AB1: call @keyPress 2 key [email protected] time [email protected]

if 0AA2: [email protected] = load_library "User32.dll"
then
    if 0AA4: [email protected] = get_proc_address "keybd_event" library [email protected]
    then
        0AA5: call [email protected] num_params 4 pop 0 0 0 0 [email protected]
        wait [email protected]
        0AA5: call [email protected] num_params 4 pop 0 0 0x02 0 [email protected]
    end
end
0AB2: ret 0
is posible to make this func to send the key via the current thread(or gta/samp idk how can i call it) that have been activated?
what i mean is that i want to send fake keys w/ 3GTAs simulantly (anti pause func on)
 

Parazitas

Well-Known Member
Joined
Jan 2, 2017
Messages
680
Likes
2
Points
18
Location
Lithuania
Website
ugbase.eu
#8
doroftel said:
Opcode.eXe said:
:keyPress
// [email protected] - key, [email protected] - time
// Example: 0AB1: call @keyPress 2 key [email protected] time [email protected]

if 0AA2: [email protected] = load_library "User32.dll"
then
     if 0AA4: [email protected] = get_proc_address "keybd_event" library [email protected]
     then
         0AA5: call [email protected] num_params 4 pop 0 0 0 0 [email protected]
         wait [email protected]
         0AA5: call [email protected] num_params 4 pop 0 0 0x02 0 [email protected]
     end
end
0AB2: ret 0
is posible to make this func to send the key via the current thread(or gta/samp idk how can i call it) that have been activated?
what i mean is that i want to send fake keys w/ 3GTAs simulantly (anti pause func on)
You can use this two memory.
GTA/ SA:MP

PHP:
    0A8C: write_memory 747FB6 size 1 value 1 virtual_protect 1
    0A8C: write_memory 74805A size 1 value 1 virtual_protect 1
 
Top