How to make your own Key-binder!

Is it possible to make a keybinder as cleo?
I want to script a cleo cause i dont like exe binder.

How to send the command / input ingame?

For example if i press 1 the cleo should send
t/stats~ 

Ps: ~=Enter
 

xzytro

God
Joined
Apr 1, 2013
Messages
2,294
Reaction score
7
Re: Cleo Keybinder?

Let's make a keybinder that types /stats when we press numpad 5 !

Open Sanny Builder, hit Ctrl + N. Start with this :
Code:
    {$VERSION 3.1.0027}
    {$CLEO .cs}
Without that, i think the cleo won't work. Then, add name to your cleo file like below :
Code:
    thread 'TESTCLEO'
Now that we wrote this as total :
Code:
    {$CLEO .cs}

    thread 'TESTCLEO'
Now we start scripting. To start, put the name you choose for thread as :<yourname>_01, like here:
Code:
    :TESTCLEO_01
    wait 0
I added "wait 0", because the cleo crashes if i don't use the "wait" command at the beginning. Now, we will put whatever we want. What do we want ? We want our character to bleed if we press F12 button. Here we go, we will put "if" command to give our .cs file the condition to work.:arrow: :arrow::arrow:
Code:
    if
Now we add our condition, what was our condition ? It was "if we press F12 button", then our code is "key_pressed":arrow:
Code:
    0AB0:   key_pressed 101
Now, our script is like this :
Code:
    {$CLEO .cs}

    thread 'TESTCLEO'

    :TESTCLEO_01
    wait 0
    if
    0AB0:   key_pressed 101
That "101" is the key for Numpad 5. To learn the keys, use capslockbomber's tutorial
Now, okay we added our condition for the cleo to work, but what if we didn't press Num5 ? We must tell the cleo script to do something if we didn't press Num5 button. Otherwise cleo would barely work ! So here we go :arrow: :arrow::arrow:
Code:
    else_jump @TESTCLEO_01
this allows the cleo script to go back and check again if the player pressed Numpad5, and doesn't do anything until player presses Num5 key.
Now, this is our code :arrow: :arrow::arrow:
Code:
    {$CLEO .cs}

    thread 'TESTCLEO'

    :TESTCLEO_01
    wait 0
    if
    0AB0:   key_pressed 101
    else_jump @TESTCLEO_01
From beginning till the end, this cleo flow means, "You should press Numpad 5, If you don't press Num5, i will check again if you press or not, but if you press the Numpad 5 key, i will do what you want".
Now that we add what we want ! We hit Ctrl + alt + 2 button to open opcode search window, and we type "say", we find "0AF9: samp say_msg "I AM NOOB! LOL". We will use that ! Let's do it :arrow: :arrow::arrow:
Code:
    0AF9: samp say_msg "/stats"
This will do the trick ;D Now, With this cleo till the end, if we press Numpad 5 key, our character will type /stats ;D But now it will work only 1 time, it won't work again. How to tell the cleo to work again ? Here:arrow:
Code:
    jump @TESTCLEO_01
Now, the script will always check if you press Numpad 5 or not. So, it will ask you again after you die too ;D And when you press Numpad 5 after you die, it will work ;D
Finally our entire script (working) :
Code:
    {$CLEO .cs}

    thread 'TESTCLEO'

    :TESTCLEO_01
    wait 0
    if
    0AB0:   key_pressed 101
    else_jump @TESTCLEO_01
    0AF9: samp say_msg "/stats"
    jump @TESTCLEO_01
But we forgot something ! What if we were playing in single player ? Then when we press Numpad 5 it will crash ! We must put 1 more condition, which is, "do not run the script if i am not in samp". Let's add it ! We hit Ctrl + alt + 2 to open opcode search, and type "samp available", we will get "0AFA:  is_samp_structures_available
", let's use it :arrow: :arrow::arrow:

Our condition side was this :
Code:
wait 0
    if
    0AB0:   key_pressed 101
    else_jump @TESTCLEO_01
We will add "0AFA:  is_samp_structures_available" like this :arrow: :arrow::arrow:
Code:
wait 0
    if and
    0AB0:   key_pressed 101
    0AFA:   is_samp_structures_available
    else_jump @TESTCLEO_01
Now our entire code is this :arrow: :arrow::arrow:
Code:
{$CLEO .cs}

thread 'TESTCLEO'

:TESTCLEO_01
wait 0
if and
0AB0:   key_pressed 101
0AFA:   is_samp_structures_available
else_jump @TESTCLEO_01
0AF9: samp say_msg "/stats"
jump @TESTCLEO_01

OHH WAIT ! ALMOST FORGOT OMG ! If you compile this, and if you press Numpad 5 in samp, you will get kicked for command spam lol ! So what to do ? We put "wait 5000" :arrow: :arrow::arrow:

Code:
{$CLEO .cs}

thread 'TESTCLEO'

:TESTCLEO_01
wait 0
if and
0AB0:   key_pressed 101
0AFA:   is_samp_structures_available
else_jump @TESTCLEO_01
0AF9: samp say_msg "/stats"
wait 5000
jump @TESTCLEO_01
Finitto ! ! ! Let's save it as .cs file ! Press F6, it will show you a window and it will ask you where to save. From the window go to "GTA San AndreasCLEO" and then in the name, put whatever you want, i put "testnumpad5". But don't add any extensions ! In name area, only name should be there. In extension area below, .txt will stay. Now, press OK
zcxvarwqr_zpsaa29518b.png

DONE !
It will work ;D
With this way you can make whatever you want as a keybind ! You were too lazy ? Download it from the attachment below.
Have fun !
Regards,
xzytro
 

Attachments

  • testnumpad5.rar
    6.5 KB · Views: 312

NeverSayDie

New member
Joined
May 29, 2013
Messages
4
Reaction score
0
Re: [TUTORIAL]Make Your Own Keybinder !

Thx :D :D:D
which version of sampfuncs does i need?
cause my samp crashs when i connect
 

xzytro

God
Joined
Apr 1, 2013
Messages
2,294
Reaction score
7
Re: [TUTORIAL]Make Your Own Keybinder !

I am not sure, i have cleo 4, and sampfunctions v2.4, so it works (tried in-game before posting the thread)
 

MarinxX

Member
Joined
Aug 1, 2013
Messages
13
Reaction score
0
Re: [TUTORIAL]Make Your Own Keybinder !

Useful but I'll still use SA-MP Keybinder it rocks :D :D:D
 

undiscovered

Active member
Joined
May 3, 2013
Messages
76
Reaction score
0
Re: [TUTORIAL]Make Your Own Keybinder !

wait 5000 so 5 secs? Which means that it will still spam?
 

xzytro

God
Joined
Apr 1, 2013
Messages
2,294
Reaction score
7
Re: [TUTORIAL]Make Your Own Keybinder !

it will not spam, it will do /stats, will wait 5 seconds, and then it will check if you pressed numpad 5 or not, so it will not keep doing /stats each 5 seconds. Think of it as uh... something like... a cooldown time.
 

xzytro

God
Joined
Apr 1, 2013
Messages
2,294
Reaction score
7
Re: [TUTORIAL]Make Your Own Keybinder !

Is it possible to make a keybinder as cleo?
I want to script a cleo cause i dont like exe binder.
Use my keybinder, haha
:meh: :meh::meh:

Numpad5.cs makes my game crash :( :(:(

:tongue: :tongue::tongue: you probably have a problem with samp functions, because whenever you script something with samp say_msg opcode you get crashed. It's because the opcode which you wrote isn't supported on it's own as it doesn't exist in anywhere. But by installing samp functions it will work.
 

Monstercat

Well-known member
Joined
Feb 26, 2013
Messages
281
Reaction score
5
Re: [TUTORIAL]Make Your Own Keybinder !

Here with this its easier to make a Keybinder in CLEO

I think its understandable:

Code:
{$CLEO .cs}
THREAD "KEYBINDER"

if 
  8AF7: get_samp_base_to 0@
then 
    0A93: end_custom_thread
end
repeat 
    wait 400
until 0AFA: is_samp_structures_available


WHILE TRUE
WAIT 0
    if
    0ADC:   test_cheat "KeyBinder"
    THEN
        if
        31@ == 0 
        then
        0ACD: show_text_highpriority "KeyBinder on." time 1337
        018C: play_sound 1083 at 0.0 0.0 0.0
        31@ = 1 
        else
        0ACD: show_text_highpriority "KeyBinder off." time 1337
        018C: play_sound 1084 at 0.0 0.0 0.0  
        31@ = 0 
        end
    END
    if
    31@ == 1
    then      
        if and
        0AB0:   key_pressed 49
        8B21: not  samp is_chat_opened
        then
            0AF9: samp say_msg "Test 1"
            wait 200 
        end
        
        if and
        0AB0:   key_pressed 50
        8B21: not  samp is_chat_opened
        then
            0AF9: samp say_msg "Test 2"
            wait 200
        end
        
        if and
        0AB0:   key_pressed 51
        8B21: not  samp is_chat_opened
        then
            0AF9: samp say_msg "Test 3"
            wait 200
        end                                            
    end
END
 

inZ

Well-known member
Joined
Apr 6, 2013
Messages
270
Reaction score
1
Re: [TUTORIAL]Make Your Own Keybinder !

What's the rar password xzytro?
 

iAnthony

Moderator
Moderator
Joined
Nov 15, 2013
Messages
590
Reaction score
3
Re: [TUTORIAL]Make Your Own Keybinder !

Party Rock link said:
What's the rar password xzytro?
try ugbase.eu



xzytro is the best admin here, his answers are always straight forward.
even a newbie like me understands
 

xzytro

God
Joined
Apr 1, 2013
Messages
2,294
Reaction score
7
Re: [TUTORIAL]Make Your Own Keybinder !

iAnthony link said:
xzytro is the best admin here, his answers are always straight forward.
even a newbie like me understands
:dont_care:
:eek:h_stop_it_u:
 

Codex1337

Active member
Joined
Mar 1, 2014
Messages
170
Reaction score
1
Re: [TUTORIAL]Make Your Own Keybinder !

ok i get that, but how can i make more binds in a cleo?
 
Top