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 :
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:
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:
Now we add our condition, what was our condition ? It was "if we press F12 button", then our code is "key_pressed":arrow:
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:
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:
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
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