CLEO Help IF statement always false

CLEO related
Status
Not open for further replies.

ItsRobinson

Active member
Joined
Nov 16, 2017
Messages
105
Reaction score
20
I don't have a clue what I'm doing wrong.

PHP:
:resizeHealthBar
0B35: 0@ = get_last_command_params
IF
    0AD4: 30@ = scan_string 0@ format "%d %s" 1@ 4@v //IF and SET
THEN
    say "first check"
    if
        0C14: strcmp string1 4@v string2 "Width"
    then
        say "inside first string check"
        //Then I wanna do my code for resizing the width       
    end   
ELSE
    0AF8: samp add_message_to_chat "{FF0000}USAGE:{FFFFFF} /resizehealth [Amount] [Width/Length]"
END
samp.CmdRet()

If I type in-game
/resizehealth 10 Width
I get "first check" but should get "first check", "inside first string check"
If I type anything other than /resizehealth *int* *string* I get my USAGE message, which is right.

Is it just not possible to do what I'm trying to do?
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,161
Solutions
5
Reaction score
894
Location
Lithuania
PHP:
:resizeHealthBar
0B35: 0@ = get_last_command_params
IF
    0AD4: $NOT_USED = scan_string 0@ format "%d %s" 1@ 4@ //IF and SET
THEN
    say "first check"
    if
    0C29: $NOT_USED = stristr string1 4@ string2 "Width"
    then
        say "inside first string check"
        //Then I wanna do my code for resizing the width       
    end   
ELSE
    0AF8: samp add_message_to_chat "{FF0000}USAGE:{FFFFFF} /resizehealth [Amount] [Width/Length]"
END
samp.CmdRet()
 

ItsRobinson

Active member
Joined
Nov 16, 2017
Messages
105
Reaction score
20
PHP:
0B35: 0@ = get_last_command_params
IF
    0AD4: $NOT_USED = scan_string 0@ format "%d %s" 1@ 4@ //IF and SET
THEN
    say "first check"
    if 1@ > 0
    then
        say "greater than 0"
        if
            0C29: $NOT_USED = stristr string1 4@ string2 "Width"
        then
            say "correct string"
            if 29@ == 1
            then
                say "worked"
                0006: 15@ = 1@
            else
                0006: 17@ = 1@
            end
        end     
    end  
ELSE
    0AF8: samp add_message_to_chat "{FF0000}USAGE:{FFFFFF} /resizehealth [Amount] [Width/Length]"
END
samp.CmdRet()

@Parazitas
Still not catching that string check. I get first check, greater than 0, but not correct string.

EDIT:
Just done a printf for my input and it's picking up the integer but the string is coming back blank.

EDIT EDIT:
I just changed the 4@ to 4@s and it's now working. Thanks dude.
 
Last edited:
Status
Not open for further replies.
Top