CLEO Help Help to add opcode!

CLEO related
Status
Not open for further replies.

GoodMan

Active member
Joined
Jun 4, 2014
Messages
142
Reaction score
0
Dear ugbase.eu members, staff and guests!


I'm trying to add a opcode which shows me IF player has certain weapon.
In this case weapons from STOL 7
to be more specific, the weapons are these:
Rocket  id 36 Slot 7 Model 360
Minigun id 38 Slot 7 Model 362

I have been trying these opcodes:
0491:   actor $PLAYER_ACTOR has_weapon 46
0470: 76@ = actor $PLAYER_ACTOR current_weapon
0491: actor 3@ has_weapon 38
04B8: get_weapon_data_from_actor $PLAYER_ACTOR slot 2 weapon 380@ ammo 381@ model 381@

My goal is to ''scan'' or ''detect streamed players weapon IF they switch to that weapon and let me know it next to others infos you will see here:
Code:
                        end
                    1@ += 14   
                        if 120 >= 16@
                        then
                        04C4: store_coords_to 9@ 10@ 11@ from_actor $PLAYER_ACTOR with_offset 0.0 0.0 0.0
                        04C4: store_coords_to 12@ 13@ 14@ from_actor 31@ with_offset 0.0 0.0 0.0
                        050A: 17@ = distance_between_XYZ 9@ 10@ 11@ and_XYZ 12@ 13@ 14@
                        0B55: convert_3D_coords 9@ 10@ 11@ to_screen 5@ 6@
                        0B55: convert_3D_coords 12@ 13@ 14@ to_screen 7@ 8@
                        0B2B: samp 2@ = get_player_id_by_actor_handle 31@
                        0B36: samp 3@ = get_player_nickname 2@
                        0B37: samp 4@ = get_player_color 2@
                        0B2A: samp 24@ = get_player_ping 2@
                        0B25: samp 27@ = get_player_health 2@
                        0B26: samp 28@ = get_player_armor 2@
// (Here is where ive tryed to place these opcodes but doesn't work..)         
                        0AC8: 20@ = 256
                        0AD3: 20@ = "*%d %s %d %d %d %0.f" 2@ 3@ 24@ 27@ 28@ 17@
                        0B6F: render font 0@ draw_text 20@ pos 15@ 1@ color 4@ 
                        0AC9: 20@
                        end
                        if and
                        02CB:   actor 31@ bounding_sphere_visible
                        803C:   $PLAYER_ACTOR == 31@
                        8118:   actor 31@ dead
                        then

You will see a line like this:
Code:
0AD3: 20@ = "*%d %s %d %d %d %0.f" 2@ 3@ 24@ 27@ 28@ 17@

[font=Monaco, Consolas, Courier, monospace]On this line i place a "%d" or "%s" to set weapon name/number and so i will know if PLAYER HAS THE WEAPON ON HIM(or on his hand/switched)[/font]

[font=Monaco, Consolas, Courier, monospace]If someone can please stick/paste here a opcode to make this work please let me know...[/font]


Code:
   
 0B2B: samp 2@ = get_player_id_by_actor_handle 31@
                        0B36: samp 3@ = get_player_nickname 2@
                        0B37: samp 4@ = get_player_color 2@
                        0B2A: samp 24@ = get_player_ping 2@
                        0B65: samp 23@ = player 30@ score
                        0B25: samp 27@ = get_player_health 2@
                        0B26: samp 28@ = get_player_armor 2@
                        0491: actor $PLAYER_ACTOR has_weapon 24 29@         
                        0AC8: 20@ = 256
                        0AD3: 20@ = "*%d %s {4bff00}$%d {00feff}%d {4bff00}%d %d %s {ff0000}%0.f" 2@ 3@ 23@ 24@ 27@ 28@ 29@ 17@
                        0B6F: render font 0@ draw_text 20@ pos 15@ 1@ color 4@ 
                        0AC9: 20@
                        end
                        if and
                        02CB:   actor 31@ bounding_sphere_visible
                        803C:   $PLAYER_ACTOR == 31@
                        8118:   actor 31@ dead
                        then
                        end
Thats just an example of what i expect to be working but it doesn't...
 
Status
Not open for further replies.
Top