CLEO Help Loop

CLEO related
Status
Not open for further replies.

Badonga

Active member
Joined
Aug 5, 2013
Messages
71
Reaction score
0
Hello, can anyone show me an example script which loops through all streamed players because I want to put something in it. For example:

Code:
if players_are_streamed
if their_radius_is_20_from_me
LOOP_ALL_THESE_CLOSE_PLAYERS
//do something. Leave blank for this part
end_loop

Does anyone here has the knowledge to help me do this?
 

blackHat

Expert
Joined
Jul 28, 2013
Messages
930
Reaction score
2
here you go:
Code:
{$CLEO}

0000:

:START
wait 0
if and
056D:   actor $PLAYER_ACTOR defined
key_down 49 //1
then
0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to $nouse closest_ped_to 0@
if 
056D:   actor 0@ defined
then
actor.StorePos($PLAYER_ACTOR, 1@ , 2@ ,3@)
actor.StorePos(0@, 4@ , 5@ ,6@)
0509: 7@ = distance_between_XY 1@ 2@ and_XY  4@ 5@
if 
7@ < 20.0
then
REPEAT //this will repeat the code below it 
wait 0 
//do something here 
UNTIL key_down 48  // if you clicked 0 the loop will stop
end
end
end
jump @START


learn about loop/repeat here:
http://ugbase.eu/tutorials/repeat-statement-tut/
 

Badonga

Active member
Joined
Aug 5, 2013
Messages
71
Reaction score
0
BlackHat link said:
here you go:
Code:
{$CLEO}

0000:

:START
wait 0
if and
056D:   actor $PLAYER_ACTOR defined
key_down 49 //1
then
0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to $nouse closest_ped_to 0@
if 
056D:   actor 0@ defined
then
actor.StorePos($PLAYER_ACTOR, 1@ , 2@ ,3@)
actor.StorePos(0@, 4@ , 5@ ,6@)
0509: 7@ = distance_between_XY 1@ 2@ and_XY  4@ 5@
if 
7@ < 20.0
then
REPEAT //this will repeat the code below it 
wait 0 
//do something here 
UNTIL key_down 48  // if you clicked 0 the loop will stop
end
end
end
jump @START


learn about loop/repeat here:
http://ugbase.eu/tutorials/repeat-statement-tut/

Hey! Thanks a lot, but can you do it based on this code?
http://ugbase.eu/snippets/for-all-peds/

I don't want it to have to press a key to do it, I want it to be automatic and live.
The code in that link is perfect except:

I don't know how to loop through the streamed players and 'do something'

Can you do what I told you in the first post based on that link?
 

blackHat

Expert
Joined
Jul 28, 2013
Messages
930
Reaction score
2
here you go:

Code:
{$CLEO}

0000:

:START
wait 0
if
056D:   actor $PLAYER_ACTOR defined
then
WHILE TRUE
wait 0
// FOR ALL PEDS     
0A8D: 29@ = read_memory 0xB74490 size 4 virtual_protect 0
000A: 29@ += 0x4
0A8D: 29@ = read_memory 29@ size 4 virtual_protect 0
for 30@ = 0 to 35584 step 0x100
    0A8D: 31@ = read_memory 29@ size 1 virtual_protect 0
    000A: 29@ += 0x1
    if and
        0029:  31@ >= 0x00 
        001B:  0x80 > 31@
    then 
        005A: 31@ += 30@
if 
056D:   actor 31@ defined
then
actor.StorePos($PLAYER_ACTOR, 1@ , 2@ ,3@)
actor.StorePos(31@, 4@ , 5@ ,6@)
0509: 7@ = distance_between_XY 1@ 2@ and_XY  4@ 5@
if 
7@ < 20.0
then
//do something here 

end
end
end
end
end
END
jump @START
 

blackHat

Expert
Joined
Jul 28, 2013
Messages
930
Reaction score
2
Badonga link said:
Does this loop to every player instead of just getting one player? Which is the player IDs handle?

this will register all players around you(streamed) to 31@'
but here:
Code:
actor.StorePos(31@, 4@ , 5@ ,6@)
0509: 7@ = distance_between_XY 1@ 2@ and_XY  4@ 5@
if 
7@ < 20.0
then
//do something here
this will make a rule , which is only if player is "less than 20.0" the script below will run
 

Badonga

Active member
Joined
Aug 5, 2013
Messages
71
Reaction score
0
BlackHat link said:
this will register all players around you(streamed) to 31@'
but here:
Code:
actor.StorePos(31@, 4@ , 5@ ,6@)
0509: 7@ = distance_between_XY 1@ 2@ and_XY  4@ 5@
if 
7@ < 20.0
then
//do something here
this will make a rule , which is only if player is "less than 20.0" the script below will run

Thank you so much, you are a true helper.  :yesyes:
 
Status
Not open for further replies.
Top