CLEO Help Error in conditional "if" or string variable

CLEO related

Yisus321

New member
Joined
Jan 15, 2022
Messages
2
Reaction score
0
Location
México
Gets into the "else" statement when the variable $name_usr is equal to "Jack".
I always get as a result: "I'm not a person".

Why doesn't it validate correctly? I have an error in the initialization of the variable?

PHP:
{$CLEO .cs}

0000:
var
$name_usr : String = 'Jack'
end


while true
    wait 1000 ms
    if
    0AD2: 0@ = player $PLAYER_CHAR targeted_actor
    then
        if
        $name_usr == 'Jack'
        then
        0AD1: show_text "I'm person" 1000
        else
        0AD1: show_text "I'm not person" 1000
        end
    end
end
0A93: terminate_this_custom_script
 

Yisus321

New member
Joined
Jan 15, 2022
Messages
2
Reaction score
0
Location
México
what you want to do?

When I target a player, show me a text if this is a person allied or belonging to my gang. But the point is that the conditional doesn't let me validate the name. I have also tried to validate "integer" variables but it is not validated correctly. Sorry, I'm not used to this kind of low-level language.
 

HaroldGnomo

Well-known member
Joined
Jun 20, 2021
Messages
211
Reaction score
59
Location
Sahara Desert
When I target a player, show me a text if this is a person allied or belonging to my gang. But the point is that the conditional doesn't let me validate the name. I have also tried to validate "integer" variables but it is not validated correctly. Sorry, I'm not used to this kind of low-level language.
Im gonna try help you
 

Fr0z3n

Well-known member
Joined
Nov 20, 2019
Messages
301
Reaction score
36
Location
Srbija
If i understood corectly, you just randomly put if $name_usr == 'Jack', your stored variable is 0@ so you need to compare with that value, use @ajom snippet for that...
 

0x73616D

Active member
Joined
Apr 18, 2021
Messages
135
Solutions
1
Reaction score
68
Location
0x73616D
Gets into the "else" statement when the variable $name_usr is equal to "Jack".
I always get as a result: "I'm not a person".

Why doesn't it validate correctly? I have an error in the initialization of the variable?

PHP:
{$CLEO .cs}

0000:
var
$name_usr : String = 'Jack'
end


while true
    wait 1000 ms
    if
    0AD2: 0@ = player $PLAYER_CHAR targeted_actor
    then
        if
        $name_usr == 'Jack'
        then
        0AD1: show_text "I'm person" 1000
        else
        0AD1: show_text "I'm not person" 1000
        end
    end
end
0A93: terminate_this_custom_script
PHP:
{$CLEO .cs}

0000: NOP

while true
    wait 1000 ms
    if
    0AD2: 0@ = player $PLAYER_CHAR targeted_actor
    then
        0B2B: samp 1@ = get_player_id_by_CHAR_handle 0@
        0B36: samp 2@ = get_player_nickname 1@
        if
        0C14: strcmp string1 2@ string2 "Jack"
        then
        0AD1: show_text "I'm person" 1000
        else
        0AD1: show_text "I'm not person" 1000
        end
    end
end
0A93: terminate_this_custom_script
 
Top