100% - Working without SAMPFUNCS
Example.:
PHP:
{$CLEO .cs}
0000: NOP
WAIT 10000
WHILE TRUE
WAIT 0
IF 0AB0: key_pressed 90 {Z}
THEN
0AB1: @Set_Virtual_Key 2 KeyOffSet 0x57 state 255
WAIT 30
0AB1: @Set_Virtual_Key 2 KeyOffSet 0x57 state 0
END
END
:Set_Virtual_Key
{
255 = true
0 = false
0AB1: @Set_Virtual_Key 2 KeyOffSet 0x57 state 255
}
2@ = 0xB72CC8
0@ *= 2
005A: 2@ += 0@ // (int)
0A8C: write_memory 2@ size 1 value 1@ virtual_protect 0
0AB2: ret 0
Virtual Game key Snippets.:
PHP:
:Set_Virtual_Key
{
255 = true
0 = false
0AB1: @Set_Virtual_Key 2 KeyOffSet 0x57 state 255
}
2@ = 0xB72CC8
0@ *= 2
005A: 2@ += 0@ // (int)
0A8C: write_memory 2@ size 1 value 1@ virtual_protect 0
0AB2: ret 0
:Set_Virtual_Key
// 0AB1: @Set_Virtual_Key 2 KeyOffSet 0x57 time 800
2@ = 0xB72CC8
0@ *= 2
005A: 2@ += 0@ // (int)
0A8C: write_memory 2@ size 1 value 255 virtual_protect 0
wait 1@
0A8C: write_memory 2@ size 1 value 0 virtual_protect 0
0AB2: ret 0
:Set_Virtual_Key
// 0AB1: @Set_Virtual_Key 3 KeyOffSet 0x57 lowerBorder 800 higherBorder 1000
2@ = 0xB72CC8
0@ *= 2
005A: 2@ += 0@ // (int)
0A8C: write_memory 2@ size 1 value 255 virtual_protect 0
0209: 3@ = random_int_in_ranges 1@ 2@
wait 3@
0A8C: write_memory 2@ size 1 value 0 virtual_protect 0
0AB2: ret 0
:Get_Pressed_Virtual_Key
// 0AB1: @Get_Pressed_Virtual_Key 0 _Returned: KeyOffSet 0@ state 1@
FOR 0@ = 0x01 TO 0xFE STEP 0x01
0085: 1@ = 0@
1@ *= 2
1@ += 0xB72CC8
0A8D: 2@ = read_memory 1@ size 1 virtual_protect 0
IF 2@ == 255
THEN
0AB2: ret 2 0@ 2@
END
END
0AB2: ret 0
SOME KEY OFFSET FOR VIRTUL KEYS
PHP:
RIGHT-MOUSE = 0x3CE
LEFT-MOUSE = 0x3D9
ENTER = 0x121
SHIFT = 0x392
CTRL = 0x125
LALT= 0x127
SPACEBAR = 0x20
LEFT ARROW = 0x109
UP ARROW = 0x107
RIGHT ARROW = 0x10A
DOWN ARROW = 0x108
Game key Snippet.:
PHP:
:Set_Game_Key
// 0AB1: @Set_Game_key 2 KeyOffSet 0x57 State 255
2@ = 0xB731A8
0@ *= 2
005A: 2@ += 0@ // (int)
0A8C: write_memory 2@ size 1 value 1@ virtual_protect 0
0AB2: ret 0
:Get_Game_Key
// 0AB1: @Get_Game_key 1 KeyOffSet 0x41 State 0@ // A
2@ = 0xB731A8
0@ *= 2
005A: 2@ += 0@ // (int)
0A8D: 3@ = read_memory 2@ size 1 virtual_protect 0
0AB2: ret 1 3@
Hex Key codes.:
https://docs.microsoft.com/en-us/windows/desktop/inputdev/virtual-key-codes
Last edited: