CLEO Help [HELP] ON-OFF

CLEO related
Status
Not open for further replies.

MrChristmas

Expert
Joined
Jul 29, 2014
Messages
563
Reaction score
26
Hi,

Does anyone know the code for let's say when you hold X then script is on but when you release the key X then script goes off?  :watchout:
 

Codex1337

Active member
Joined
Mar 1, 2014
Messages
170
Reaction score
1
{$CLEO}

0000: NOP

:START //our label
wait 0 
if  // we need this to run when we are alive only
0184:  actor $PLAYER_ACTOR health <> 0  // "<>" means not equal , 0 means actor health and 0 = dead , the normal full health is 100 in most of servers
jf  [member=5120]Error[/member] // if actor is dead then jump at ERROR label
  WHILE 0AB0: key_pressed 49 // key 1 // will be explained below don't worry
  wait 0  //we add this to avoid crashing
0851: set_actor $PLAYER_ACTOR decrease_health_by -2 affect_armour 0 // decrease by -2 = increase by 2 , it is math , decrease means negative , and negative negative 2 means positive 2
0ACD: show_text_highpriority "Recovering 2H/ONHOLD" time 1500 
END // to close WHILE statement
jump @START //jump to the label to loop again

:ERROR //our error label
wait 0
0ACD: show_text_highpriority "You're DEAD ...!" time 1500 // this will get printed when you die
jump @START  // after display "You're DEAD" massage it will go to start label to loop again

Thanks to BlackHat
 

MrChristmas

Expert
Joined
Jul 29, 2014
Messages
563
Reaction score
26
Thanks [member=60]Opcode.eXe[/member]


BTW. why when I do code like :

Code:
WHILE TRUE
WAIT 0
IF
0AB0: 2
THEN
BLA BLA BLA BLA BLA BLA BLA BLA
        REPEAT
        WAIT 0
        UNTIL 8AB0: 2
END
END
goto @FIRST

It doesn't jump to first ?
 

ThermaL

Expert
Joined
Oct 23, 2013
Messages
1,593
Reaction score
3
Mr.Christmas link said:
I need to jump into @first coz I'm using on/off with the same key  :face_palm:
Oh, k.
So, END means GOTO to the current label, that's why it doesn't work. You should use low level coding only.
 

MrChristmas

Expert
Joined
Jul 29, 2014
Messages
563
Reaction score
26
Shitttttttttttttt, It doesn't work


Code:
:BASE
wait 0
if  
0ADC: "NOPE"
jf @IF_ON
if
31@ == 0 
then
31@ = 1 
0ACD: show_text_highpriority "NOPE" time 1000 
else
31@ = 0      
0ACD: show_text_highpriority "NOPE" time 1000 
end

:IF_ON
if
31@ == 1
jf @BASE
goto @MOD_ON

:MOD_ON
wait 0
if 
0AB0: 82
jf @MOD_ON
<MY CODE HERE>

:REPEAT
wait 0
if
8AB0: 82
jf @REPEAT
goto @BASE
 

ThermaL

Expert
Joined
Oct 23, 2013
Messages
1,593
Reaction score
3
Code:
{$CLEO}

0000: NOP
31@ = false

:NOPE_1
wait 0
if
0ADC: "nope"
jf @NOPE_1
print "ACTIVATED" 2000
wait 500

:MAIN
wait 0
if
31@ == false
jf @REPEAT
if 
0AB0: 82
jf @NOPE_2
// your code here

:REPEAT
wait 0
31@ = true
if
8AB0: 82
jf @NOPE_2
31@ = false

:NOPE_2
if
0ADC: "nope"
jf @MAIN
print "DEACTIVATED" 2000
wait 500
goto @NOPE_1
 
Status
Not open for further replies.
Top