Function:
0AB1: @POSITION_TO_RADAR 7 XYZ 0.0 0.0 0.0 RADAR_POS 400 400 DISTANCE_MULTIPLIER 1.5 MAX_DISTANCE 300.0 _STORE_TO 1@ 2@
This function converts 3D position to 2D Radar position like on the Minimap.
You can make things like this:
http://i.san-mp.de/i/26CEA9.webm
Source:
Function code:
0AB1: @POSITION_TO_RADAR 7 XYZ 0.0 0.0 0.0 RADAR_POS 400 400 DISTANCE_MULTIPLIER 1.5 MAX_DISTANCE 300.0 _STORE_TO 1@ 2@
This function converts 3D position to 2D Radar position like on the Minimap.
You can make things like this:
http://i.san-mp.de/i/26CEA9.webm
Source:
Code:
{$CLEO .cs}
0000:
REPEAT
WAIT 0
UNTIL 0AFA: SAMP_IS_READY
0B6D: 5@ = create_font "Arial" height 10 flags 0x4
0BFC: SET_VAR "MadeByOpcodeXe" = 5@
WHILE TRUE
WAIT 0
FOR 31@ = 0 TO 1000
IF
0B23: samp is_player_connected 31@
THEN
IF
0B20: samp 30@ = actor_handle_by_samp_player_id 31@
THEN
0AB1: @GET_BONE_POS 2 FROM_ACTOR $PLAYER_ACTOR BONE 6 _STORE_TO 5@ 6@ 7@ // HEAD
04C4: store_coords_to 8@ 9@ 10@ from_actor 30@ with_offset 0.0 0.0 0.0
0B55: convert_3D_coords 5@ 6@ 7@ to_screen 5@ 6@
0AB1: @POSITION_TO_RADAR 7 XYZ 8@ 9@ 10@ RADAR_POS 5@ 6@ DISTANCE_MULTIPLIER 1.5 MAX_DISTANCE 300.0 _STORE_TO 13@ 14@
0B70: draw_polygon_pos 5@ 6@ size 7 7 corners 7 rotation 0 color 0xFFFFFFFF
0B70: draw_polygon_pos 13@ 14@ size 5 5 corners 5 rotation 90 color 0xFFFFFFFF
0B36: samp 15@ = get_player_nickname 31@
0B37: samp 16@ = get_player_color 31@
0BFD: 5@ = get_global_var "MadeByOpcodeXe"
0B6B: 6@ = font 5@ draw_text 15@ length
0B6C: 7@ = font 5@ draw_height
7@ += 5
6@ /= 2
0062: 13@ -= 6@ // (int)
0062: 14@ -= 7@ // (int)
0B6F: render font 5@ draw_text 15@ pos 13@ 14@ color 16@
END
END
END
END
//0AB1: @GET_BONE_POS 2 FROM_ACTOR $PLAYER_ACTOR BONE 6 _STORE_TO 1@ 2@ 3@ // HEAD
:GET_BONE_POS
0085: 10@ = 0@ // (int)
0085: 15@ = 1@ // (int)
1@ = 0.0 // X offset
2@ = 0.0 // Y offset {THX TO: WESSER}
3@ = 0.0 // Z offset
0A96: 0@ = actor 10@ struct
0AC7: 4@ = var 1@ offset
0AA6: call_method 0x5E01C0 struct 0@ num_params 3 pop 0 bIncludeAnim 1 iBoneID 15@ vOffset 4@ // CPed__getBonePositionWithOffset
0AB2: retn 3 1@ 2@ 3@
//0AB1: @POSITION_TO_RADAR 7 XYZ 0.0 0.0 0.0 RADAR_POS 400 400 DISTANCE_MULTIPLIER 1.5 MAX_DISTANCE 300.0 _STORE_TO 1@ 2@
:POSITION_TO_RADAR
04C4: 10@ 11@ 12@ = XYZ $PLAYER_ACTOR 0.0 0.0 0.0
050A: 13@ = distance_between_XYZ 0@ 1@ 2@ and_XYZ 10@ 11@ 12@
006B: 13@ *= 5@
IF
0025: 13@ > 6@
THEN
0087: 13@ = 6@ // (float)
END
0AB1: @getZAngleBetweenPoints 4 from_XY 10@ 11@ and_XY 0@ 1@ store_to 14@
14@ *= -1.0
0AB1: @getCameraFacingAngle 0 15@
005B: 14@ += 15@
0093: 3@ = integer 3@ to_float
0093: 4@ = integer 4@ to_float
0AB1: @makeCordinate 6 3@ 4@ 0.0 Z_Angle 14@ 0.0 Distance 13@ STORE_TO 16@ 17@
0092: 16@ = float 16@ to_integer
0092: 17@ = float 17@ to_integer
0AB2: 2 16@ 17@
:makeCordinate
3@ *= -1.0
02F6: 6@ = sine 3@
006B: 6@ *= 5@
005B: 0@ += 6@
02F7: 6@ = cosine 3@
006B: 6@ *= 5@
005B: 1@ += 6@
02F7: 6@ = cosine 4@
0073: 5@ /= 6@
02F6: 6@ = sine 4@
006B: 5@ *= 6@
005B: 2@ += 5@
0AB2: 2 0@ 1@
:getCameraFacingAngle
00A0: store_actor $PLAYER_ACTOR position_to 1@ 2@ 3@
0AA6: call_method 0x514970 struct 0xB6F028 num_params 6 pop 0 0xA49994 0xA499A0 3@ 2@ 1@ 20.0
0AB1: call_scm_func @getZAngleBetweenPoints 4 from_XY $13 $14 and_XY 1@ 2@ store_to 4@
0AB2: 1 4@
:getZAngleBetweenPoints
0063: 0@ -= 2@
0063: 1@ -= 3@
0604: get_Z_angle_for_point 0@ 1@ store_to 4@
0AB2: 1 4@
Function code:
Code:
//0AB1: @POSITION_TO_RADAR 7 XYZ 0.0 0.0 0.0 RADAR_POS 400 400 DISTANCE_MULTIPLIER 1.5 MAX_DISTANCE 300.0 _STORE_TO 1@ 2@
:POSITION_TO_RADAR
04C4: 10@ 11@ 12@ = XYZ $PLAYER_ACTOR 0.0 0.0 0.0
050A: 13@ = distance_between_XYZ 0@ 1@ 2@ and_XYZ 10@ 11@ 12@
006B: 13@ *= 5@
IF
0025: 13@ > 6@
THEN
0087: 13@ = 6@ // (float)
END
0AB1: @getZAngleBetweenPoints 4 from_XY 10@ 11@ and_XY 0@ 1@ store_to 14@
14@ *= -1.0
0AB1: @getCameraFacingAngle 0 15@
005B: 14@ += 15@
0093: 3@ = integer 3@ to_float
0093: 4@ = integer 4@ to_float
0AB1: @makeCordinate 6 3@ 4@ 0.0 Z_Angle 14@ 0.0 Distance 13@ STORE_TO 16@ 17@
0092: 16@ = float 16@ to_integer
0092: 17@ = float 17@ to_integer
0AB2: 2 16@ 17@
:makeCordinate
3@ *= -1.0
02F6: 6@ = sine 3@
006B: 6@ *= 5@
005B: 0@ += 6@
02F7: 6@ = cosine 3@
006B: 6@ *= 5@
005B: 1@ += 6@
02F7: 6@ = cosine 4@
0073: 5@ /= 6@
02F6: 6@ = sine 4@
006B: 5@ *= 6@
005B: 2@ += 5@
0AB2: 2 0@ 1@
:getCameraFacingAngle
00A0: store_actor $PLAYER_ACTOR position_to 1@ 2@ 3@
0AA6: call_method 0x514970 struct 0xB6F028 num_params 6 pop 0 0xA49994 0xA499A0 3@ 2@ 1@ 20.0
0AB1: call_scm_func @getZAngleBetweenPoints 4 from_XY $13 $14 and_XY 1@ 2@ store_to 4@
0AB2: 1 4@
:getZAngleBetweenPoints
0063: 0@ -= 2@
0063: 1@ -= 3@
0604: get_Z_angle_for_point 0@ 1@ store_to 4@
0AB2: 1 4@