CLEO HELP Restart CMD

KamikazeSripterul

Well-Known Member
Joined
Jun 30, 2019
Messages
325
Likes
25
Points
33
#1
I tried making a code in-game so I don't have to keep quiting the game and re-enter and so on so my question is, why doesn't this work?

Code:
{$CLEO}
{$INCLUDE SF}
0000:
thread "TestsCMD"

repeat
wait 0
until SAMP.Available()

0B34: "restart" @restart


WHILE TRUE
WAIT 0

END

:restart
SAMP.IsCommandTyped([email protected])
0459: end_thread_named "%s.cs" [email protected]
0C62: exec_console_command "cs %s.cs" [email protected]
SAMP.CmdRet()
 
Last edited:

ajom

Well-Known Member
Joined
Apr 14, 2020
Messages
71
Likes
36
Points
18
Location
Pluto
#3
I tried making a code in-game so I don't have to keep quiting the game and re-enter and so on so my question is, why doesn't this work?

Code:
{$CLEO}
{$INCLUDE SF}
0000:
thread "TestsCMD"

repeat
wait 0
until SAMP.Available()

0B34: "restart" @restart


WHILE TRUE
WAIT 0

END

:restart
SAMP.IsCommandTyped([email protected])
0459: end_thread_named "%s.cs" [email protected]
0C62: exec_console_command "cs %s.cs" [email protected]
SAMP.CmdRet()
As how I understand your statement, you want an Auto-Reconnect Script .

Also, at your script, I don't get the sense Why you are trying to restart a certain Cleo thread.
 
OP
OP
KamikazeSripterul

KamikazeSripterul

Well-Known Member
Joined
Jun 30, 2019
Messages
325
Likes
25
Points
33
#4
As how I understand your statement, you want an Auto-Reconnect Script .

Also, at your script, I don't get the sense Why you are trying to restart a certain Cleo thread.
If you are testing something and don't want to keep quit the game and enter again for the cleo to update, I tried updating from in game however I wanted to make a command that has the parameter as the name of the file instead of putting this command in every cleo i will create at one point.
 
Joined
Mar 17, 2014
Messages
17
Likes
3
Points
108
#6
0B34: samp register_client_command "reload" to_label @Noname_132 - top of script right after SAMP.Available loop

:Noname_132 - bottom of script
chatmsg "reloading" -1
0A92: create_custom_thread "test.cs"
0A93: end_custom_thread
0B43: samp cmd_ret

make sure you rename test.cs to w/e u wanna call ur cleo.
 
OP
OP
KamikazeSripterul

KamikazeSripterul

Well-Known Member
Joined
Jun 30, 2019
Messages
325
Likes
25
Points
33
#7
0B34: samp register_client_command "reload" to_label @Noname_132 - top of script right after SAMP.Available loop

:Noname_132 - bottom of script
chatmsg "reloading" -1
0A92: create_custom_thread "test.cs"
0A93: end_custom_thread
0B43: samp cmd_ret

make sure you rename test.cs to w/e u wanna call ur cleo.
So I will have to put this in all scripts?
 

ajom

Well-Known Member
Joined
Apr 14, 2020
Messages
71
Likes
36
Points
18
Location
Pluto
#9
So I will have to put this in all scripts?
It is not necessary to put that code on all of your scripts. Only put that code on the script that you are currently testing. I expect that you test one script at a time, so when you are finished testing. Remove/comment that debugging code.

You might also consider creating one script which job is to restart a specific thread/script when needed. So that you wouldn't need to put that debugging code on all scripts, but only change the target script that needs to be restarted via INI File...
 
OP
OP
KamikazeSripterul

KamikazeSripterul

Well-Known Member
Joined
Jun 30, 2019
Messages
325
Likes
25
Points
33
#10
It is not necessary to put that code on all of your scripts. Only put that code on the script that you are currently testing. I expect that you test one script at a time, so when you are finished testing. Remove/comment that debugging code.

You might also consider creating one script which job is to restart a specific thread/script when needed. So that you wouldn't need to put that debugging code on all scripts, but only change the target script that needs to be restarted via INI File...
That is what I explained in the description of the post but I guess I just explained it badly because I already have @SpnKO 's suggestion. I am struggling on this idea of having a main code that restarts the written one but I don't understand why it doesn't work.
 

ajom

Well-Known Member
Joined
Apr 14, 2020
Messages
71
Likes
36
Points
18
Location
Pluto
#11
That is what I explained in the description of the post but I guess I just explained it badly because I already have @SpnKO 's suggestion. I am struggling on this idea of having a main code that restarts the written one but I don't understand why it doesn't work.
Here is an example of how it can be done, this code will only work on scripts with a filename of 7 characters below. Kinda sucks but it is just a demonstration of mine, also I haven't tested it since I only coded it by phone, you can improve it further if you are interested:
Code:
{$CLEO .cs}
0000: cleo restarter

{
 usage:
 /cleorestart test.cs
 
 NOTE: last parameter must be 7 characters below. above 7 characters will not work according to its documentary
}

REPEAT
 wait 0
UNTIL 0AFA: is_samp_available

0B34: samp register_client_command "cleorestart" to_label @manualrestart

0BDE: pause_thread 0 // We don't need an infinite loop, so just pause the script

:manualrestart
 0B35: samp [email protected] = get_last_command_params
 05DD: end_custom_thread_named [email protected]
 05DE: create_custom_thread [email protected]
0B43: samp cmd_ret
 
Top