As an example, I'll use an excerpt from dphome's keybind script from [link=[URL]https://ugbase.eu/threads/req-samp-base-cleo-4-4-keybinder.16961/post-108768]here[/link[/URL]]. How would I make the keybinds (in this case NUMPAD6 and NUMPAD8) to work using AHK's ControlSend?I want to activate the keybinds of a cleo script using AHK's ControlSend, but I can't get it to work. How may I do this?
{$CLEO .cs}
{$USE bitwise}
0000:
WHILE TRUE
WAIT 0
IF 0ADC: test_cheat "BIND"
THEN
0B12: 30@ = 30@ XOR 1
IF 0039: 30@ == 1
THEN 0AD1: show_formatted_text_highpriority "~w~Binder~n~~g~Enabled" time 1337
ELSE 0AD1: show_formatted_text_highpriority "~w~Binder~n~~r~Disabled" time 1337
END
END
IF 30@ == 1
THEN
IF 0AB0: is_key_pressed 102 // NUMPAD 6
THEN
0@ = 350 // Miliseconds
0AC8: 1@ = allocate_memory_size 260
0AD3: 1@ = format "/test1"
0AB1: @SEND_CMD 2 SampVersionID 3 Text 1@
WAIT 0@
END
IF 0AB0: is_key_pressed 104 // NUMPAD 8
THEN
2@ = 100 // Miliseconds
0AC8: 3@ = allocate_memory_size 260
0AD3: 3@ = format "/test2"
0AB1: @SEND_CMD 2 SampVersionID 3 Text 3@
WAIT 2@
END
END
END
0A93: terminate_this_custom_script
To detect key pressing from Windows you need get it by reading windows libraries, not sure just guessing..As an example, I'll use an excerpt from dphome's keybind script from [link=[URL]https://ugbase.eu/threads/req-samp-base-cleo-4-4-keybinder.16961/post-108768]here[/link[/URL]]. How would I make the keybinds (in this case NUMPAD6 and NUMPAD8) to work using AHK's ControlSend?
PHP:{$CLEO .cs} {$USE bitwise} 0000: WHILE TRUE WAIT 0 IF 0ADC: test_cheat "BIND" THEN 0B12: 30@ = 30@ XOR 1 IF 0039: 30@ == 1 THEN 0AD1: show_formatted_text_highpriority "~w~Binder~n~~g~Enabled" time 1337 ELSE 0AD1: show_formatted_text_highpriority "~w~Binder~n~~r~Disabled" time 1337 END END IF 30@ == 1 THEN IF 0AB0: is_key_pressed 102 // NUMPAD 6 THEN 0@ = 350 // Miliseconds 0AC8: 1@ = allocate_memory_size 260 0AD3: 1@ = format "/test1" 0AB1: @SEND_CMD 2 SampVersionID 3 Text 1@ WAIT 0@ END IF 0AB0: is_key_pressed 104 // NUMPAD 8 THEN 2@ = 100 // Miliseconds 0AC8: 3@ = allocate_memory_size 260 0AD3: 3@ = format "/test2" 0AB1: @SEND_CMD 2 SampVersionID 3 Text 3@ WAIT 2@ END END END 0A93: terminate_this_custom_script
I'd just use AHK, but for whatever reason, I can't ControlSend keys such as {ENTER} or {F6} to unfocused SAMP. As such, I thought I could do the command input via a CLEO script (despite having no experience in CLEO) that is activated through an AHK keybind.To detect key pressing from Windows you need get it by reading windows libraries, not sure just guessing..
Can't test this since I'm job.
But why you just not making everything in one cleo code instead using millions programs?
We can make gta not lose focus when minimized or in widows mode,I'd just use AHK, but for whatever reason, I can't ControlSend keys such as {ENTER} or {F6} to unfocused SAMP. As such, I thought I could do the command input via a CLEO script (despite having no experience in CLEO) that is activated through an AHK keybind.
I know that the way I'm approaching this is not really ideal, and I should probably be doing something akin to this script that's been shared here before (without sampfuncs) since what I want to do is to input commands based on chat messages, all while the game runs in the background:We can make gta not lose focus when minimized or in widows mode,
So that shouldn't be problem
{$CLEO}
{$INCLUDE SF}
0000:
repeat
wait 0
until SAMP.Available()
alloc 29@ 256
0BE3: raknet setup_incoming_rpc_hook @auto_chat
while true
wait 0
if and
8B21: samp is_chat_opened
8C7E: is_console_active
then
if
0ADC: test_cheat "JOB"
THEN
if
2@ == 0
then
0ACD: show_text_highpriority "AutoJob ~g~ON" time 1000
018C: play_sound 1083 at 0.0 0.0 0.0
2@ = 1
wait 250
else
0ACD: show_text_highpriority "AutoJob ~r~OFF" time 1000
018C: play_sound 1084 at 0.0 0.0 0.0
2@ = 0
wait 250
end
end
END
END
:looperulee
wait 0
jump @looperulee
:auto_chat
0BE5: raknet 31@ = get_hook_param PARAM_PACKETID
if 31@ == RPC_ScrClientMessage
then
0C11: memset destination 29@ value 0 size 256
0BE5: raknet 31@ = get_hook_param PARAM_BITSTREAM
0BE7: raknet 30@ = bit_stream_read 31@ type BS_TYPE_INT //color
0BE7: raknet 30@ = bit_stream_read 31@ type BS_TYPE_INT //lenght
0BE8: raknet bit_stream 31@ read_array 29@ size 30@ //string
0C0D: struct 29@ offset 30@ size 1 = 0
if or
0C29: $NULL_STIRNG = stristr string1 29@ string2 "Timpul tau de asteptare la job s-a incheiat. Acum poti munci din nou."
0C29: $NULL_STIRNG = stristr string1 29@ string2 "Your job waiting time is over. You can now start working again."
then
if 2@ == 1
then
say "/work"
end
end
end
0BE0: raknet hook_ret true