Help First script.

Joined
Apr 2, 2017
Messages
8
Likes
0
Points
1
#1
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 
[email protected] = Actor.Health($PLAYER_ACTOR)
if and
not [email protected] >= 51
not [email protected] <= 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

Well-Known Member
Joined
Jun 23, 2014
Messages
918
Likes
3
Points
18
#2
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:
[email protected] = 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
 
OP
OP
T
Joined
Apr 2, 2017
Messages
8
Likes
0
Points
1
#3
Code:
{$CLEO}

0000: NOP

repeat
wait 50
until 0AFA: is_samp_available

thread 'Test'

:label_1
wait 0 
[email protected] = Actor.Health($PLAYER_ACTOR)
wait 50
if and
not [email protected] >= 46
not [email protected] <= 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"
 

monday

Well-Known Member
Joined
Jun 23, 2014
Messages
918
Likes
3
Points
18
#5
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
 
OP
OP
T
Joined
Apr 2, 2017
Messages
8
Likes
0
Points
1
#6
{$CLEO}

0000: NOP

repeat
wait 50
until 0AFA: is_samp_available

thread 'Test'

:label_1
wait 0
[email protected] = Actor.Health($PLAYER_ACTOR)
wait 50
if and
not [email protected] >= 46
not [email protected] <= 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
 

kazkaS

Well-Known Member
Joined
Mar 30, 2018
Messages
87
Likes
0
Points
6
#7
Tort926 said:
{$CLEO}

0000: NOP

repeat
wait 50
until 0AFA: is_samp_available

thread 'Test'

:label_1
wait 0
[email protected] = Actor.Health($PLAYER_ACTOR)
wait 50
if and
not [email protected] >= 46
not [email protected] <= 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 
[email protected] = Actor.Health($PLAYER_ACTOR)
if and
not [email protected] >= 46
not [email protected] <= 1
then
wait 950 
say "/drugs" 
end
end // While True
 
Top