[REQ, samp] base cleo 4.4 keybinder

Spearhead

Member
Joined
Apr 2, 2022
Messages
11
Reaction score
0
Hello, anyone can make for me base cleo keybinder for samp 0.3.7 R4?
i need Off and on toggle.
the rest ill learn.
thanks.
 

dphome

Well-known member
Joined
Mar 21, 2020
Messages
458
Solutions
9
Reaction score
166
Location
Poland
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~Keybinder~n~~g~Enable" time 1337
    ELSE 0AD1: show_formatted_text_highpriority "~w~Keybinder~n~~r~Disable" time 137
    END
END

IF 30@ == 1
THEN
    IF 0AB0:   is_key_pressed 97 // Numpad 1
    THEN
        0AC8: 0@ = allocate_memory_size 260
        0AD3: 0@ = format "Hello"
        0AB1: @SEND_CMD 2 SampVersionID 5 Text 0@
        WAIT 500
    END
    IF 0AB0:   is_key_pressed 98 // Numpad 2
    THEN
        0AC8: 1@ = allocate_memory_size 260
        0AD3: 1@ = format "/hello"
        0AB1: @SEND_CMD 2 SampVersionID 5 Text 1@
        WAIT 500
    END
    IF 0AB0:   is_key_pressed 99 // Numpad 3
    THEN
        0AC8: 2@ = allocate_memory_size 260
        0AD3: 2@ = format "/pm 0 Hello"
        0AB1: @SEND_CMD 2 SampVersionID 5 Text 2@
        WAIT 500
    END        
END
  
END
0A93: terminate_this_custom_script
 

Spearhead

Member
Joined
Apr 2, 2022
Messages
11
Reaction score
0
Thanks for the respone.
little problem, when i trying to complie it with sanny builder i got this error:
"Label "SEND_CMD" not found."
didnt used any cleo until today so dont have any idea.
 

Spearhead

Member
Joined
Apr 2, 2022
Messages
11
Reaction score
0
Okay, fixed it.
another question:
im interesting to convert this ahk script
Numpad6::
wait = 350 ; Milliseconds
SendInput t/buy{ENTER}
Sleep, %wait%
SendInput {ENTER}
Sleep, %wait%
SendInput {DOWN 5}{ENTER}
Sleep, %wait%
SendInput {DOWN 5}{ENTER}
Sleep, %wait%
SendInput {ESC}
return

Numpad8::
wait = 100 ; Milliseconds

SendInput t/heal{ENTER}
Sleep, %wait%
SendInput t/togpm{ENTER}
Sleep, %wait%
SendInput t/togstatelot{ENTER}
Sleep, %wait%
SendInput t/car spawn{ENTER}
Sleep, %wait%
SendInput {ENTER}
Sleep, %wait%
SendInput t/{ENTER}
return
 

dphome

Well-known member
Joined
Mar 21, 2020
Messages
458
Solutions
9
Reaction score
166
Location
Poland
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~Keybinder~n~~g~Enable" time 1337
    ELSE 0AD1: show_formatted_text_highpriority "~w~Keybinder~n~~r~Disable" time 137
    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 "/buy"
        0AB1: @SEND_CMD 2 SampVersionID 5 Text 1@
        WAIT 0@
        0AB1: @SEND_FAKE_KEYPRESS 1 KeyOffSet 0x0D // VK_RETURN
        0AB1: @STOP_SEND_FAKE_KEYPRESS 1 KeyOffSet 0x0D // VK_RETURN
        WAIT 0@
        0AB1: @SEND_FAKE_KEYPRESS 1 KeyOffSet 0x28 // VK_DOWN
        0AB1: @STOP_SEND_FAKE_KEYPRESS 1 KeyOffSet 0x28 // VK_DOWN        
        WAIT 0@
        0AB1: @SEND_FAKE_KEYPRESS 1 KeyOffSet 0x28 // VK_DOWN
        0AB1: @STOP_SEND_FAKE_KEYPRESS 1 KeyOffSet 0x28 // VK_DOWN          
        WAIT 0@
        0AB1: @SEND_FAKE_KEYPRESS 1 KeyOffSet 0x1B // VK_ESCAPE
        0AB1: @STOP_SEND_FAKE_KEYPRESS 1 KeyOffSet 0x1B // VK_ESCAPE
        WAIT 1337          
    END                
    IF 0AB0:   is_key_pressed 104 // Numpad 8
    THEN
        2@ = 100 // Miliseconds 
        0AC8: 3@ = allocate_memory_size 260
        0AD3: 3@ = format "/heal"
        0AB1: @SEND_CMD 2 SampVersionID 5 Text 3@
        WAIT 2@
        0AC8: 4@ = allocate_memory_size 260
        0AD3: 4@ = format "/togpm"
        0AB1: @SEND_CMD 2 SampVersionID 5 Text 4@
        WAIT 2@        
        0AC8: 5@ = allocate_memory_size 260
        0AD3: 5@ = format "/togstatelot"
        0AB1: @SEND_CMD 2 SampVersionID 5 Text 5@
        WAIT 2@        
        0AC8: 6@ = allocate_memory_size 260
        0AD3: 6@ = format "/car spawn"
        0AB1: @SEND_CMD 2 SampVersionID 5 Text 6@
        WAIT 2@        
        0AB1: @SEND_FAKE_KEYPRESS 1 KeyOffSet 0x0D // VK_RETURN
        0AB1: @STOP_SEND_FAKE_KEYPRESS 1 KeyOffSet 0x0D // VK_RETURN        
        WAIT 2@
        0AC8: 7@ = allocate_memory_size 260
        0AD3: 7@ = format "/"
        0AB1: @SEND_CMD 2 SampVersionID 5 Text 7@        
        WAIT 1337
    END        
END
  
END
0A93: terminate_this_custom_script
 

Attachments

  • Script.cs
    22.1 KB · Views: 20

dphome

Well-known member
Joined
Mar 21, 2020
Messages
458
Solutions
9
Reaction score
166
Location
Poland
For what?

I checked again and script working perfectly, there is my example.
PHP:
    IF 0AB0:   is_key_pressed 102 // Numpad 6
    THEN
        0@ = 350 // Miliseconds
        0AC8: 1@ = allocate_memory_size 260
        0AD3: 1@ = format "/ustawienia"
        0AB1: @SEND_CMD 2 SampVersionID 3 Text 1@ // 3, because my SA:MP Version is 0.3.DL
        WAIT 0@
        0AB1: @SEND_FAKE_KEYPRESS 1 KeyOffSet 0x28 // VK_DOWN
        0AB1: @STOP_SEND_FAKE_KEYPRESS 1 KeyOffSet 0x28 // VK_DOWN        
        WAIT 0@
        0AB1: @SEND_FAKE_KEYPRESS 1 KeyOffSet 0x28 // VK_DOWN
        0AB1: @STOP_SEND_FAKE_KEYPRESS 1 KeyOffSet 0x28 // VK_DOWN          
        WAIT 0@
        0AB1: @SEND_FAKE_KEYPRESS 1 KeyOffSet 0x28 // VK_DOWN
        0AB1: @STOP_SEND_FAKE_KEYPRESS 1 KeyOffSet 0x28 // VK_DOWN 
        WAIT 0@
        0AB1: @SEND_FAKE_KEYPRESS 1 KeyOffSet 0x26 // VK_UP
        0AB1: @STOP_SEND_FAKE_KEYPRESS 1 KeyOffSet 0x26 // VK_UP 
        WAIT 0@
        0AB1: @SEND_FAKE_KEYPRESS 1 KeyOffSet 0x26 // VK_UP
        0AB1: @STOP_SEND_FAKE_KEYPRESS 1 KeyOffSet 0x26 // VK_UP 
        WAIT 0@
        0AB1: @SEND_FAKE_KEYPRESS 1 KeyOffSet 0x26 // VK_UP
        0AB1: @STOP_SEND_FAKE_KEYPRESS 1 KeyOffSet 0x26 // VK_UP
        WAIT 0@
        0AB1: @SEND_FAKE_KEYPRESS 1 KeyOffSet 0x1B // VK_ESCAPE
        0AB1: @STOP_SEND_FAKE_KEYPRESS 1 KeyOffSet 0x1B // VK_ESCAPE
        WAIT 1337          
    END
 

Spearhead

Member
Joined
Apr 2, 2022
Messages
11
Reaction score
0
well, after /car spawn the dialog opens and thats all. i need to press enter
 

dphome

Well-known member
Joined
Mar 21, 2020
Messages
458
Solutions
9
Reaction score
166
Location
Poland
2@ = 100 // Miliseconds
TO
2@ = 400 // Miliseconds

or

0AB1: @SEND_FAKE_KEYPRESS 1 KeyOffSet 0x0D // VK_RETURN
0AB1: @STOP_SEND_FAKE_KEYPRESS 1 KeyOffSet 0x0D // VK_RETURN
WAIT 2@
0AB1: @SEND_FAKE_KEYPRESS 1 KeyOffSet 0x0D // VK_RETURN
0AB1: @STOP_SEND_FAKE_KEYPRESS 1 KeyOffSet 0x0D // VK_RETURN
WAIT 2@
 

dphome

Well-known member
Joined
Mar 21, 2020
Messages
458
Solutions
9
Reaction score
166
Location
Poland
Server IP?
Where is your dialog after /buy?
Or send complete video
 

dphome

Well-known member
Joined
Mar 21, 2020
Messages
458
Solutions
9
Reaction score
166
Location
Poland
Can you try explain step by step what you can do?
Better than primitive FakeKeyPress use functions like thats isDialogOpen, Set_current_dialog_list_item, CloseCurrentDialogWithButton
 

Spearhead

Member
Joined
Apr 2, 2022
Messages
11
Reaction score
0
I thought it will be easy convert ahk script to cleo
Maybe better keep use ahk much easy.
thanks for help.
 
Top