CLEO Help Script Help

CLEO related
Status
Not open for further replies.

Fr0z3n

Well-known member
Joined
Nov 20, 2019
Messages
294
Reaction score
36
Location
Srbija
what I did wrong

Code:
//-------------Main---------------
0000: NOP

:Algoritam_2
wait 50
   SAMP.Available
jf @Algoritam_2
0B34: samp register_client_command "algoritamzg" to_label @Algoritam_3
0B34: samp register_client_command "bayside" to_label @Algoritam_4
0B34: samp register_client_command "spawn" to_label @Algoritam_5
0B34: samp register_client_command "teren" to_label @Algoritam_6
0B34: samp register_client_command "kosac" to_label @Algoritam_7
0B34: samp register_client_command "gradiliste" to_label @Algoritam_8
wait 300
chatmsg "{F7F694}Algoritam by: {0033CC}Fr0z3n {F7F694}& {00CC00}GodFelaz"
wait 300

:Algoritam_3
wait 0
chatmsg "{F7F694}A{FF4800}l{00C8FF}g{D900FF}o{1EFF00}r{FFFFFF}i{F7F694}TamZG by: {0033CC}Fr0z3n {F7F694}& {00CC00}GodFelaz komande:" -1
chatmsg "{FFFFFF}/bayside (Predikcija ako je paketic bio bayside)"   
chatmsg "{FFFFFF}/spawn   (Predikcija ako je paketic bio spawn/centar)" 
chatmsg "{FFFFFF}/teren   (Predikcija ako je paketic bio kod terena/ispod znaka)" 
chatmsg "{FFFFFF}/kosac   (Predikcija ako je paketic bio kosac trave)" 
chatmsg "{FFFFFF}/gradiliste (Predikcija ako je paketic bio gradiliste/vip baza )"
chatmsg "{FFFFFF}/teritorije (Oznacava gde su teritorije na kojima se spawna paketic u izgradnji)"   
SAMP.CmdRet

:Algoritam_4
wait 0 
chatmsg "{FFFFFF}Mogucnost: Zg sa " -1
chatmsg "{FFFFFF}Mogucnost: Granica ZG-SA " 
SAMP.CmdRet

:Algoritam_5
wait 0 
chatmsg "{FFFFFF}Mogucnost: SK  " -1
chatmsg "{FFFFFF}Mogucnost: Centar "
SAMP.CmdRet

:Algoritam_6
wait 0 
chatmsg "{FFFFFF}Mogucnost: Drugi Test   "  -1
chatmsg "{FFFFFF}Mogucnost: Drugi Test "
SAMP.CmdRet

:Algoritam_7
wait 0 
chatmsg "{FFFFFF}Mogucnost: Veliki Test "  -1
chatmsg "{FFFFFF}Mogucnost: Veliki Test "

SAMP.CmdRet

:Algoritam_8
wait 0 
chatmsg "{FFFFFF}Mogucnost: Test " -1
chatmsg "{FFFFFF}Mogucnost: Test "
chatmsg "{FFFFFF}Mogucnost: Test  " 
SAMP.CmdRet
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,692
Reaction score
105
Written in low level syntax badly.

Your samp.available check is done wrong (see every single sampfuncs cleo here if you don't get it).
For command only CLEOs like this you need a "main" loop, even if it contains nothing it needs to be there.

Made an example, not the most technically correct but it's good enough.
C++:
{$CLEO .cs}

THREAD 'CMDEXAMPLE'

// Waits until samp has started.
REPEAT
    WAIT 0
UNTIL 0AFA: // simplified version of samp.Available()

// Once samp is confirmed to be available you can begin intialising samp related stuff.

// CMD funcs in particular execute a function at a label and return when that command has been input.
0B34: samp register_client_command "CMD1" to_label @CMD1
0B34: samp register_client_command "CMD2" to_label @CMD2

// Main loop is required as cmd functions need to jump back to somewhere.
WHILE TRUE
    WAIT 0
END

// CMD labels/funcs can go here like scmfuncs.

:CMD1
CHATMSG "CMD1" -1
SAMP.CmdRet()

:CMD2
CHATMSG "CMD2" -1
SAMP.CmdRet()
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,692
Reaction score
105
It's just the way CLEO works as the game can't read past the "end of the script" so it probably goes on for infinity and crashes so you basically just have it constantly reading something in the middle of the script so it can't go past that point.
 
Status
Not open for further replies.
Top