[SNIPPET] Send KeyPress via Gta

Code:
0AB1: @FAKE_KEYPRESS 1 _OFFSET_KEY_ 0x3 {W}



 
:FAKE_KEYPRESS
1@ = 0xB73458 
005A: 1@ += 0@  // (int)
0A8C: write_memory 1@ size 1 value 255 virtual_protect 0
0AB2: ret 0

{
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							
}
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,486
Reaction score
227
Location
( ͡° ͜ʖ ͡°)
Re: Send KeyPress via Gta

Example:

You want to aim with key X:

if
0AB0: 88
then
0AB1: @FAKE_KEYPRESS 1 _OFFSET_KEY_ 0xC
end
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,690
Reaction score
104
Re: Send KeyPress via Gta

The forward one does not make cars accelerate. Im trying to make an auto driver cleo mod but i need the car to actually go forward.
 
Joined
Feb 18, 2005
Messages
2,963
Reaction score
267
Re: Send KeyPress via Gta

For vehicle they're different.
http://gtaforums.com/topic/194199-documenting-gta-sa-memory-addresses/?p=1059674630
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,104
Solutions
5
Reaction score
882
Location
Lithuania
Vehicle control alternative w/o opcode 0B56

Code:
0AB1: call_scm_func @PressTurningKey 1 set_game_key_0_state -255 // PRESS LEFT
0AB1: call_scm_func @PressTurningKey 1 set_game_key_0_state 255  // PRESS RIGHT
0AB1: call_scm_func @PressTurningKey 1 set_game_key_0_state 0    // UNPRESS RIGHT
0AB1: call_scm_func @PressBrake 1 set_game_key_6_state 255 // PRESS BRAKE
0AB1: call_scm_func @PressBrake 1 set_game_key_6_state 0   // UNPRESS BRAKE

Snippets.:
Code:
:PressTurningKey
IF
0@ == -255
THEN // PRESS LEFT
    0006: 10@ = 0xB73458
    000A: 10@ += 0x1
    0A8C: write_memory 10@ size 1 value 128 virtual_protect 0
ELSE
    IF
    0@ == 255 
    THEN // PRESS RIGHT
        0006: 10@ = 0xB73458
        000A: 10@ += 0x0
        0A8C: write_memory 10@ size 1 value 128 virtual_protect 0
    ELSE
        IF
        0@ == 0
        THEN // UNPRESS RIGHT
            0006: 10@ = 0xB73458
            000A: 10@ += 0x0
            0A8C: write_memory 10@ size 1 value 0 virtual_protect 0
        END
    END
END
0AB2: ret 0

:PressBrake
IF
0@ == 255
THEN // PRESS BRAKE
    0006: 20@ = 0xB73458
    000A: 20@ += 0x1C
    0A8C: write_memory 20@ size 1 value 255 virtual_protect 0
ELSE
    IF
    0@ == 0 
    THEN // NOT PRESS BRAKE
        0006: 20@ = 0xB73458
        000A: 20@ += 0x8
        0A8C: write_memory 20@ size 1 value 0 virtual_protect 0
    END
END
0AB2: ret 0
 

shanker

Well-known member
Joined
Sep 18, 2016
Messages
291
Reaction score
16
Location
Romania
Vehicle control alternative w/o opcode 0B56

Code:
0AB1: call_scm_func @PressTurningKey 1 set_game_key_0_state -255 // PRESS LEFT
0AB1: call_scm_func @PressTurningKey 1 set_game_key_0_state 255  // PRESS RIGHT
0AB1: call_scm_func @PressTurningKey 1 set_game_key_0_state 0    // UNPRESS RIGHT
0AB1: call_scm_func @PressBrake 1 set_game_key_6_state 255 // PRESS BRAKE
0AB1: call_scm_func @PressBrake 1 set_game_key_6_state 0   // UNPRESS BRAKE

Snippets.:
Code:
:PressTurningKey
IF
0@ == -255
THEN // PRESS LEFT
    0006: 10@ = 0xB73458
    000A: 10@ += 0x1
    0A8C: write_memory 10@ size 1 value 128 virtual_protect 0
ELSE
    IF
    0@ == 255
    THEN // PRESS RIGHT
        0006: 10@ = 0xB73458
        000A: 10@ += 0x0
        0A8C: write_memory 10@ size 1 value 128 virtual_protect 0
    ELSE
        IF
        0@ == 0
        THEN // UNPRESS RIGHT
            0006: 10@ = 0xB73458
            000A: 10@ += 0x0
            0A8C: write_memory 10@ size 1 value 0 virtual_protect 0
        END
    END
END
0AB2: ret 0

:PressBrake
IF
0@ == 255
THEN // PRESS BRAKE
    0006: 20@ = 0xB73458
    000A: 20@ += 0x1C
    0A8C: write_memory 20@ size 1 value 255 virtual_protect 0
ELSE
    IF
    0@ == 0
    THEN // NOT PRESS BRAKE
        0006: 20@ = 0xB73458
        000A: 20@ += 0x8
        0A8C: write_memory 20@ size 1 value 0 virtual_protect 0
    END
END
0AB2: ret 0
since your call func have first var w/ only two options 255 and 0,why you used again if 0@==0... if the first cond is false?(if 0@=255)
 

ini

Well-known member
Joined
Sep 28, 2015
Messages
321
Reaction score
115
opcod pls close dis thread
 
Top