So i am trying to improve this script because the original one cannot read mods if there are spaces in the name.
The problem is with the opcode 0AAB: file_exists "cleo.asi"
I need to check if the file i entered exists because if i enter an invalid file the game will crash, but i can't make this opcode work to read the input file name.
i tried 0AAB: file_exists "cleo/%s" but it doesn't work. And if i don't apply this opcode as condition it also doesn't work, so the only work around i found was to check if "cleo.asi" exists then it loads the scripts with spaces in the name successfully. The problem, as i said, is that if i type an invalid file name the game will crash. Any solutions?
[font=Monaco, Consolas, Courier, monospace]Edit: [/font]
[font=Monaco, Consolas, Courier, monospace]Problem solved, script is now avaliable to download.[/font]
The problem is with the opcode 0AAB: file_exists "cleo.asi"
I need to check if the file i entered exists because if i enter an invalid file the game will crash, but i can't make this opcode work to read the input file name.
i tried 0AAB: file_exists "cleo/%s" but it doesn't work. And if i don't apply this opcode as condition it also doesn't work, so the only work around i found was to check if "cleo.asi" exists then it loads the scripts with spaces in the name successfully. The problem, as i said, is that if i type an invalid file name the game will crash. Any solutions?
Code:
{$CLEO}
0000: NOP
wait 100
0B34: samp register_client_command "cleo" to_label @LOAD
:LOOP
wait 0
goto @LOOP
:LOAD
wait 0
SAMP.IsCommandTyped(2@)
jf @NotExists
0B35: samp 2@ = get_last_command_params
if
0AAB: file_exists "cleo.asi"
jf @NotExists
0A92: create_custom_thread 2@
0AF8: samp add_message_to_chat "{FF0000}Cleo mod '%s' has been loaded" color -1 2@
SAMP.CmdRet()
:NotExists
wait 0
0AF8: samp add_message_to_chat "{FF0000}The cleo mod name you entered is not valid" color -1
0AF8: samp add_message_to_chat "{BFBFBF}Usage: /cleo <File Name.cs>" color -1
SAMP.CmdRet()
[font=Monaco, Consolas, Courier, monospace]Problem solved, script is now avaliable to download.[/font]