CLEO Help Check streamed player but...

CLEO related
Status
Not open for further replies.

pepeelpubero

Well-known member
Joined
Jan 21, 2014
Messages
433
Reaction score
1
I want to check the streamed player but without command for example: i want to draw a text on all of the players streamed.

Code:
0B6D: create_font ...

while true
wait 0
if
//check streamed player, what i need to put here?
then
Actor.StorePos($STREAMED, 1@, 2@, 3@)
if 00C2: sphere_onscreen 1@ 2@ 3@ radius 0.0
then
0B55: convert_3D_coords 1@ 2@ 3@ to_screen 4@ 5@                                                     
format 14@ "STREAMED PLAYER"                             
0B6F: render font 25@ draw_text 14@ pos 4@ 5@ color 0xFF1E90FF
end
end
end
 

a10210319

Active member
Joined
Mar 21, 2014
Messages
38
Reaction score
0
pepeelpubero link said:
I want to check the streamed player but without command for example: i want to draw a text on all of the players streamed.

Code:
0B6D: create_font ...

while true
wait 0
if
//check streamed player, what i need to put here?
then
Actor.StorePos($STREAMED, 1@, 2@, 3@)
if 00C2: sphere_onscreen 1@ 2@ 3@ radius 0.0
then
0B55: convert_3D_coords 1@ 2@ 3@ to_screen 4@ 5@                                                     
format 14@ "STREAMED PLAYER"                             
0B6F: render font 25@ draw_text 14@ pos 4@ 5@ color 0xFF1E90FF
end
end
end
Try this

for 1@ = 0 to 100 step 1 // player ID 0~100
    if samp.IsPlayerConnected(1@)
    then
        if 2@ = samp.GetActorHandleByPlayerID(1@)
        then
              //Get all stream in player
        end
    end
end
 

pepeelpubero

Well-known member
Joined
Jan 21, 2014
Messages
433
Reaction score
1
a10210319 link said:
Try this

for 1@ = 0 to 100 step 1 // player ID 0~100
    if samp.IsPlayerConnected(1@)
    then
        if 2@ = samp.GetActorHandleByPlayerID(1@)
        then
              //Get all stream in player
        end
    end
end

I tried previously with that, but it doesn't work.
 
Joined
Feb 18, 2005
Messages
2,963
Reaction score
267
Well you need to add your own conditions and checks for that.

Code:
store.actorPos($random, 0@, 1@, 2@)
store.actorPos($player_actor, 4@, 5@, 6@)
0509: 7@ = distance_between_XY 0@ 1@ and_XY 4@ 5@
if and
    7@ <= 50.0 //is not far
    02CB:   actor $random bounding_sphere_visible //not behind a wall etc
then 
      do whatever
end
 

a10210319

Active member
Joined
Mar 21, 2014
Messages
38
Reaction score
0
pepeelpubero link said:
I tried previously with that, but it doesn't work.

You mean this result?

xw1HTWF.png

6mQAUqF.png
 

pepeelpubero

Well-known member
Joined
Jan 21, 2014
Messages
433
Reaction score
1
a10210319 link said:
You mean this result?

IMG
IMG

No, when i put that in the code, it doesn't draw the text.

springfield link said:
Well you need to add your own conditions and checks for that.

Code:
store.actorPos($random, 0@, 1@, 2@)
store.actorPos($player_actor, 4@, 5@, 6@)
0509: 7@ = distance_between_XY 0@ 1@ and_XY 4@ 5@
if and
    7@ <= 50.0 //is not far
    02CB:   actor $random bounding_sphere_visible //not behind a wall etc
then 
      do whatever
end

Working but not as i want, the text draws on me and others player, and shows it behind a wall too.

EDIT: first problem (text on me) solved, need help with the second problem, i want to don't draw the text if the player is behind a wall.

Code:
{$CLEO .cs}

0000: NOP
                                
alloc 14@ 260                                
0B6D: render 25@ = create_font "Arial" height 9 flags 0x4

while true
wait 0  
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@
Actor.StorePos(31@, 0@, 1@, 2@)
Actor.StorePos($PLAYER_ACTOR, 4@, 5@, 6@)
0509: 7@ = distance_between_XY 0@ 1@ and_XY 4@ 5@
if and
    7@ <= 50.0 //is not far
    02CB:   actor 31@ bounding_sphere_visible
then
Actor.StorePos(31@, 8@, 9@, 10@)
if 00C2: sphere_onscreen 8@ 9@ 10@ radius 0.0
then
0B55: convert_3D_coords 8@ 9@ 10@ to_screen 4@ 5@                                                     
format 14@ "PLAYER"                             
0B6F: render font 25@ draw_text 14@ pos 4@ 5@ color 0xFF1E90FF
end
end
end               
end
end
 
Joined
Feb 18, 2005
Messages
2,963
Reaction score
267
Code:
{$CLEO .cs}

0000: NOP
                                
alloc 14@ 260                                
0B6D: render 25@ = create_font "Arial" height 9 flags 0x4

while true
wait 0  
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 803C: $PLAYER_ACTOR == 31@ //don't draw text on player
    then 
    Actor.StorePos(31@, 0@, 1@, 2@)
    Actor.StorePos($PLAYER_ACTOR, 4@, 5@, 6@)
    0509: 7@ = distance_between_XY 0@ 1@ and_XY 4@ 5@
    if and
        06BD:   no_obstacles_between 0@ 1@ 2@ and 4@ 5@ 6@ solid 1 car 0 actor 0 object 0 particle 0 //behind walls, objects etc
        7@ <= 50.0
    then
    Actor.StorePos(31@, 8@, 9@, 10@)
    if 00C2: sphere_onscreen 8@ 9@ 10@ radius 0.0
    then
    0B55: convert_3D_coords 8@ 9@ 10@ to_screen 4@ 5@                                                     
    format 14@ "PLAYER"                             
    0B6F: render font 25@ draw_text 14@ pos 4@ 5@ color 0xFF1E90FF
end
end
end
end               
end
end
 

pepeelpubero

Well-known member
Joined
Jan 21, 2014
Messages
433
Reaction score
1
Yes, i solved my first problem with 803C and thanks, the second one is working.

Now i have other question, how to check if the armor of the other player is 0? If it's 0 don't dont something, for example: don't draw the text "ARMOR %d"
 

pepeelpubero

Well-known member
Joined
Jan 21, 2014
Messages
433
Reaction score
1
How to add that in this code?: if 31@ don't have armor don't render the format with "ARMOR: %d"

Code:
{$CLEO .cs}

0000: NOP
                                
alloc 14@ 260                                
0B6D: render 25@ = create_font "Arial" height 9 flags 0x4

while true
wait 0  
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 803C: $PLAYER_ACTOR == 31@ //don't draw text on player
    then 
    Actor.StorePos(31@, 0@, 1@, 2@)
    Actor.StorePos($PLAYER_ACTOR, 4@, 5@, 6@)
    0509: 7@ = distance_between_XY 0@ 1@ and_XY 4@ 5@
    if and
    06BD:   no_obstacles_between 0@ 1@ 2@ and 4@ 5@ 6@ solid 1 car 0 actor 0 object 0 particle 0 //behind walls, objects etc
    7@ <= 50.0
    then
    0B2B: samp 32@ = get_player_id_by_actor_handle 31@
    0B36: samp 26@ = get_player_nickname 32@
    0B25: samp 24@ = get_player_health 32@
    0B26: samp 15@ = get_player_armor 32@
    Actor.StorePos(31@, 8@, 9@, 10@)
    if 00C2: sphere_onscreen 8@ 9@ 10@ radius 0.0
    then
    0B55: convert_3D_coords 8@ 9@ 10@ to_screen 4@ 5@                                                     
    format 14@ "PLAYER: %s (%d) - ARMOR: %d - HEALTH: %d" 26@ 32@ 15@ 24@                            
    0B6F: render font 25@ draw_text 14@ pos 4@ 5@ color 0xFF1E90FF
end
end
end
end               
end
end
 
Joined
Feb 18, 2005
Messages
2,963
Reaction score
267
Code:
{$CLEO .cs}

0000: NOP
                                
alloc 14@ 260                                
0B6D: render 25@ = create_font "Arial" height 9 flags 0x4

while true
wait 0  
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 803C: $PLAYER_ACTOR == 31@ //don't draw text on player
    then 
    Actor.StorePos(31@, 0@, 1@, 2@)
    Actor.StorePos($PLAYER_ACTOR, 4@, 5@, 6@)
    0509: 7@ = distance_between_XY 0@ 1@ and_XY 4@ 5@
    if and
        06BD:   no_obstacles_between 0@ 1@ 2@ and 4@ 5@ 6@ solid 1 car 0 actor 0 object 0 particle 0 //behind walls, objects etc
        7@ <= 50.0
    then
        if 00C2: sphere_onscreen 0@ 1@ 2@ radius 0.0
        then
            0B2B: samp 20@ = get_player_id_by_actor_handle 31@
            0B36: samp 21@ = get_player_nickname 20@           
            0B26: samp 22@ = get_player_armor 20@
            0B25: samp 23@ = get_player_health 20@
            0B55: convert_3D_coords 0@ 1@ 2@ to_screen 4@ 5@ 
            if 22@ > 0
            then                                                    
                format 14@ "PLAYER %s (%d) - ARMOR: %d - HEALTH: %d" 21@ 20@ 22@ 23@                            
                0B6F: render font 25@ draw_text 14@ pos 4@ 5@ color 0xFF1E90FF
            else
                format 14@ "PLAYER %s (%d) - HEALTH: %d" 21@ 20@ 23@                            
                0B6F: render font 25@ draw_text 14@ pos 4@ 5@ color 0xFF1E90FF
            end
        end
    end
end
end
end
end             
 
Joined
Feb 18, 2005
Messages
2,963
Reaction score
267
Use the above example using a switch,

Code:
0B34: register_cmd "turnon" @on
0B34: register_cmd "turfoff" @off


:main_script
if 31@ == 1//script has been activated using 'turnon' cmd.
then DO_STUFF
end
jump @main_script


:on
0B35: $nouse
if 31@ == 0
then 31@ = 1
end
0B43: cmd_ret

:off
0B35: $nouse
if 31@ == 1
then 31@ = 0
end
0B43: cmd_ret
 
Status
Not open for further replies.
Top