CLEO Help Command with multiple parameters

CLEO related
Status
Not open for further replies.

KamikazeSripterul

Well-known member
Joined
Jun 30, 2019
Messages
353
Reaction score
23
So I need a command that can take multiple parameters. I'm not 100% sure how to make this but im certain that what i've tried isn't working. Imagine you have a command [/test <string> <integer>]. String beind either 'info' showing a dialog or 'start' which then requiers you to also enter an integer, that being the player ID. Unless the string is 'start', it shouldnt ask for an integer.
This is what i've tried
Code:
{$CLEO}
{$INCLUDE SF}
0000:
thread "TesterCMD"

repeat
wait 0
until SAMP.Available()

10@ = 0

chatmsg "{1fab60}TesterCMD by {8258cc}Kristler" -1
chatmsg "{1fab60}Use [/tester <help>] to get started!" -1

Dialog.Create(0@, "Live Dialog")
Dialog.SetRECT(0@, 1470, 250, 400, 500)
Dialog.AddStatic(0@, 1, 20@, 125, 0, 150, 50)
Dialog.AddStatic(0@, 2, 21@, 150, 0, 150, 50)
Dialog.SetVisible(0@, 0)

0B34: "tester" @tester

WHILE TRUE
WAIT 0
    
END

:tester
IF SAMP.IsCommandTyped(20@)
THEN
    IF 0C14: 20@ "start"
    THEN
        IF 0AD4: 20@ = scan_string 20@ format "%d" 5@
        THEN
            10@ = 1
            IF SAMP.IsPlayerConnected(5@)
            THEN
                0B36: samp 2@ = get_player_nickname 5@
                0AF5: write_string "new string value" to_ini_file "cleo\TesterCMD.ini" section "Player" key "playerN"
                chatmsg "%s" -1 2@
            ELSE
                chatmsg "[TesterCMD]: {1fab60}Use /tester start <id>" -1
            END
        ELSE
            IF 0C14: 20@ "help"
            THEN
                0AC6: 4@ = label @info offset
                SAMP.ShowDialog(1000, "Info TesterCMD", 4@, "Close", "", 0)
            END
        END
    ELSE
        chatmsg "[TesterCMD]: {1fab60}Use /tester <help / start>" -1
    END
END
SAMP.CmdRet()

:info
HEX
END
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
PHP:
:tester
0B35: samp 0@ = get_last_command_params
IF 0AD4: $NOT_USED = scan_string 0@ format "start %d" 1@
THEN
    0B36: samp 2@ = get_player_nickname 1@
    0AF5: write_string 2@ to_ini_file "cleo\TesterCMD.ini" section "Player" key "playerN"
    chatmsg "%s" -1 2@
ELSE
    chatmsg "[TesterCMD]: {1fab60}Use /tester start <id>" -1
END

IF 0C14: 0@ "help"
THEN
    0AC6: 3@ = label @info offset
    SAMP.ShowDialog(1000, "Info TesterCMD", 3@, "Close", "", 0)
ELSE
    chatmsg "[TesterCMD]: {1fab60}Use /tester <help / start>" -1
END
SAMP.CmdRet()
 
Status
Not open for further replies.
Top