CLEO Help HEAL HELP

CLEO related
Status
Not open for further replies.

pai1ne13

Active member
Joined
Jan 2, 2019
Messages
59
Reaction score
4
hi, i have a problem with this mod. When my life drops below 20hp I should automatically transfer to virtual word 3, but that doesn't happen. HOW CAN I FIX IT
PHP:
{$CLEO}
0000: NOP
repeat
wait 1000
until 0AFA:  is_samp_available




WHILE TRUE
WAIT 0
             IF 8@ = SAMP.GetActorHandleByPlayerID(0@)
             THEN
            0B25: samp 8@ = get_player_health 0@
                IF
               0@  < 20
             THEN
                 0af9: "/vw 3"
                                    
                            
                                
                            END
                            end
                            end
 

_Safa

Well-known member
Joined
Sep 22, 2019
Messages
295
Reaction score
100
Location
UGBASE
Your code doesn't make sense.

Use:
0B2B: samp 0@ = get_player_id_by_actor_handle $PLAYER_ACTOR
0B25: samp 1@ (your health var now) = get_player_health 0@

IF 1@ < 20
THEN
0AF9: "/vw 3"
END
 

pai1ne13

Active member
Joined
Jan 2, 2019
Messages
59
Reaction score
4
Your code doesn't make sense.

Use:
0B2B: samp 0@ = get_player_id_by_actor_handle $PLAYER_ACTOR
0B25: samp 1@ (your health var now) = get_player_health 0@

IF 1@ < 20
THEN
0AF9: "/vw 3"
END
yeah man, but with this i get crash
 

pai1ne13

Active member
Joined
Jan 2, 2019
Messages
59
Reaction score
4
Show code instead of writing "doesnt work". That won't help anyone.
Code:
{$CLEO .cs}
0000: NOP
repeat
wait 1000
until 0AFA:  is_samp_available

0B2B: samp 0@ = get_player_id_by_actor_handle $PLAYER_ACTOR
0B25: samp 1@ = get_player_health 0@

IF
1@ < 20
THEN
0AF9: "/vw 3"
END
 

_Safa

Well-known member
Joined
Sep 22, 2019
Messages
295
Reaction score
100
Location
UGBASE
...?

My code wasn't a fully-working code obviously, it was just code how to fix your mistakes.

But meh, here some copy-paste for ya:

C++:
{$CLEO .cs}
0000: NOP

REPEAT
WAIT 0
UNTIL 0AFA:

WHILE TRUE
WAIT 0
    0B2B: samp 0@ = get_player_id_by_actor_handle $PLAYER_ACTOR
    0B25: samp 1@ = get_player_health 0@
    IF 1@ < 20
    THEN
        0AF9: "/vw 3"
    END
END
 

pai1ne13

Active member
Joined
Jan 2, 2019
Messages
59
Reaction score
4
...?

My code wasn't a fully-working code obviously, it was just code how to fix your mistakes.

But meh, here some copy-paste for ya:

C++:
{$CLEO .cs}
0000: NOP

REPEAT
WAIT 0
UNTIL 0AFA:

WHILE TRUE
WAIT 0
    0B2B: samp 0@ = get_player_id_by_actor_handle $PLAYER_ACTOR
    0B25: samp 1@ = get_player_health 0@
    IF 1@ < 20
    THEN
        0AF9: "/vw 3"
    END
END

sorry for the inconvenience but you have an idea how to put an anti spam, to say the command only once
 

_Safa

Well-known member
Joined
Sep 22, 2019
Messages
295
Reaction score
100
Location
UGBASE
Well you could make an basic check by creating a bool after 0AFA: and setting it to FALSE. Set the bool var to TRUE after 0AF9: and check IF AND HP < 20 + BOOL == FALSE. Obviously you need to reset the bool if you want to use it multiple times in one session.
 

pai1ne13

Active member
Joined
Jan 2, 2019
Messages
59
Reaction score
4
{$CLEO .cs}
0000: NOP

REPEAT
WAIT 0
UNTIL 0AFA:
0@ = false

WHILE TRUE
WAIT 0
0B2B: samp 0@ = get_player_id_by_actor_handle $PLAYER_ACTOR
0B25: samp 1@ = get_player_health 0@
IF 1@ < 20
0@ == false
THEN

wait 2000
0AF9: "/vw 21"
0@ = true
END
END

Well you could make an basic check by creating a bool after 0AFA: and setting it to FALSE. Set the bool var to TRUE after 0AF9: and check IF AND HP < 20 + BOOL == FALSE. Obviously you need to reset the bool if you want to use it multiple times in one session.
i got error at IF, what i wrong
 

pai1ne13

Active member
Joined
Jan 2, 2019
Messages
59
Reaction score
4
IF AND instead of IF

//edit
When you got an error, paste the error here dude
still don' t work and spamming

Code:
{$CLEO .cs}
0000: NOP

REPEAT
WAIT 0
UNTIL 0AFA:
0@ == FALSE

WHILE TRUE
WAIT 0
0B2B: samp 0@ = get_player_id_by_actor_handle $PLAYER_ACTOR
0B25: samp 1@ = get_player_health 0@
IF and
1@ < 20
0@ == false
THEN

wait 2000
0AF9: "/vw 21"
0@ = true
END
END
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
In your code 0@ was used for 2 different purposes, and it got overwritten by ID instead of holding boolean state.
In the code below 0@ is used to hold ID of player, 2@ is used to prevent the spam. Btw I didn't test the code
Code:
{$CLEO .cs}
0000: NOP

REPEAT
WAIT 0
UNTIL 0AFA:
 
// 2@ = is sending command allowed ?
2@ = true

WHILE TRUE
WAIT 0
    0B2B: samp 0@ = get_player_id_by_actor_handle $PLAYER_ACTOR   
    0B25: samp 1@ = get_player_health 0@
    IF 1@ < 20
    THEN
        IF 2@ == true
        THEN
            0AF9: "/vw 3"
            2@ = false           
        END
    ELSE
        2@ = true // hp is high again, so sending another "/vw 3" command is allowed again
    END
END
 
Status
Not open for further replies.
Top