CLEO Help First script.

CLEO related
Status
Not open for further replies.

Tort926

Member
Joined
Apr 2, 2017
Messages
10
Reaction score
0
Hey guys, I'm quite new to coding scripts and I don't have much experience, but I tried to make my first script and I ran into some problems.

Code:
{$CLEO}

0000: NOP

wait 10000

thread 'Test'

:label_1
wait 0 
0@ = Actor.Health($PLAYER_ACTOR)
if and
not 0@ >= 51
not 0@ <= 1
then
wait 950                                              
0AF9: samp say_msg "/drugs"      
end                                                                      
This is the code, but when i try to go to the game.
This happens: https://vimeo.com/274850466 (The water blinking and that lag is because of the script).
So can someone tell me what's wrong with the script?
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
hi, take a look at the end of the script, after reaching "end" statement there is nothing which would jump back at label_1, so just use:
jump @label_1

also you could add a small delay after getting players health like:
0@ = Actor.Health($PLAYER_ACTOR)
wait 50

Otherwise it would be called with every frame which possibly could lag the game but idk

Btw because you're using sampfuncs anyway then you could use a cool initialisation delay which checks when you're connected with a server when samp is initialised:
instead of using wait 10000
you could use:

repeat
wait 50
until 0AFA: is_samp_available
 

Tort926

Member
Joined
Apr 2, 2017
Messages
10
Reaction score
0
Code:
{$CLEO}

0000: NOP

repeat
wait 50
until 0AFA: is_samp_available

thread 'Test'

:label_1
wait 0 
0@ = Actor.Health($PLAYER_ACTOR)
wait 50
if and
not 0@ >= 46
not 0@ <= 1
then
wait 950                                              
0AF9: samp say_msg "/drugs"   
jump @label_1   
end        
                         

It still does that weird thing, the screen slowly fades, i always spawn with CJ and it always gives me "Gambling"
 

Ezel

Active member
Joined
Dec 6, 2017
Messages
134
Reaction score
18
Location
Syria
always put a 
Code:
while true
wait 0
end

between cmd and action or in your status, between thread and action.
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
the point is to jump not only if condition is satisfied but also when it isnt, the jump instruction should be after "end", not before
 

Tort926

Member
Joined
Apr 2, 2017
Messages
10
Reaction score
0
{$CLEO}

0000: NOP

repeat
wait 50
until 0AFA: is_samp_available

thread 'Test'

:label_1
wait 0
0@ = Actor.Health($PLAYER_ACTOR)
wait 50
if and
not 0@ >= 46
not 0@ <= 1
while true
wait 0
then
wait 950
0AF9: samp say_msg "/drugs"
jump @label_1
end

i think i added almost everywhere "Wait". Still does the same sh*t
 

Krc

Active member
Joined
Mar 30, 2018
Messages
193
Reaction score
25
Location
Lithuania
Tort926 said:
{$CLEO}

0000: NOP

repeat
wait 50
until 0AFA: is_samp_available

thread 'Test'

:label_1
wait 0
0@ = Actor.Health($PLAYER_ACTOR)
wait 50
if and
not 0@ >= 46
not 0@ <= 1
while true
wait 0
then
wait 950                                              
0AF9: samp say_msg "/drugs"  
jump @label_1  
end                

i think i added almost everywhere "Wait".  Still does the same sh*t

Code:
{$CLEO .cs}
0000: NOP
Thread 'test'
REPEAT
Wait 10000
Until 0AFA: is_samp_structures_available

While True
wait 0 
0@ = Actor.Health($PLAYER_ACTOR)
if and
not 0@ >= 46
not 0@ <= 1
then
wait 950 
say "/drugs" 
end
end // While True
 
Status
Not open for further replies.
Top