Advertisement
michalmonday

Cleo get_relative_observable_velocity

Jun 19th, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.77 KB | None | 0 0
  1. {$CLEO}
  2. 0000:
  3. repeat
  4. wait 50
  5. until 0AFA:  is_samp_available
  6.  
  7. while true
  8. wait 0
  9.     if
  10.     0AB1: @GET_TARGET_ACTOR 0 0@
  11.     then
  12.         0AB1: call_scm_func @Get_relative_observable_velocity 2 victim 0@ suspect $PLAYER_ACTOR _ret_velocity 1@
  13.         chatmsg "rel_sid_vel=%.0f" -1 1@      
  14.     end
  15. end
  16.  
  17.  
  18. :Get_relative_observable_velocity
  19.     0AB1: call_scm_func @Get_actor_relative_speed_XYZ 2 main_actor(victim) 0@ actor_to_compare(suspect) 1@ _XYZ_velocity 29@ 30@ 31@   // without this function it would cause false warning if suspect and victim were surfing, + would show warning if suspect was surfing and victim standing
  20.    
  21.     04C4: store_coords_to 26@ 27@ 28@ from_actor 1@ with_offset 0.0 0.0 0.0
  22.     04C4: store_coords_to 23@ 24@ 25@ from_actor 0@ with_offset 0.0 0.0 0.0    
  23.    
  24.     0AB1: @getAngleBetweenPoints 4 from_XY 26@ 27@ and_XY 23@ 24@ store_to 22@ // pos_angle between suspect and victim
  25.     0604: get_Z_angle_for_point 29@ 30@ store_to 21@ // victim direction of movement (angle)
  26.     //chatmsg "pos_angle=%.0f his_mov_dir_angle=%.0f" -1 22@ 21@
  27.    
  28.     0063: 22@ -= 21@  // (float) //pos_angle - dir of movement
  29.     if 22@ < 0.0
  30.     then
  31.     22@ += 360.0
  32.     end
  33.     02F6: 22@ = sine 22@ // (float)
  34.    
  35.     0097: make 29@ absolute_float  
  36.     0097: make 30@ absolute_float
  37.     0097: make 31@ absolute_float
  38.     0097: make 22@ absolute_float
  39.     005B: 29@ += 30@  // (float) added x+y speed
  40.     006B: 29@ *= 22@  // (float) multiplied by sine of pos_angle modified by dir_mov_angle
  41.     005B: 29@ += 31@  // (float) added vertical (z) speed  (not affected by toward/outward movement so it's just added at the end)  
  42. 0AB2: 1 29@
  43.  
  44. :Get_actor_relative_speed_XYZ
  45.     if 0449:   actor 0@ in_a_car
  46.     then
  47.     25@ = Actor.CurrentCar(0@)
  48.     06A2: get_car 25@ velocity_in_direction_XYZ 29@ 30@ 31@
  49.     else
  50.     083D: get_actor 0@ velocity_in_direction_XYZ 29@ 30@ 31@
  51.     end
  52.    
  53.     if 0449:   actor 1@ in_a_car
  54.     then
  55.     24@ = Actor.CurrentCar(1@)
  56.     06A2: get_car 24@ velocity_in_direction_XYZ 26@ 27@ 28@
  57.     else
  58.     083D: get_actor 1@ velocity_in_direction_XYZ 26@ 27@ 28@
  59.     end
  60.    
  61.     0063: 29@ -= 26@
  62.     0063: 30@ -= 27@
  63.     0063: 31@ -= 28@
  64. 0AB2: 3 29@ 30@ 31@
  65.  
  66. :getAngleBetweenPoints
  67.     0063: 0@ -= 2@
  68.     0063: 1@ -= 3@
  69.     0604: get_Z_angle_for_point 0@ 1@ store_to 31@
  70. 0AB2: 1 31@
  71.  
  72.  
  73. //http://ugbase.eu/Thread-SNIPPET-GET-TARGET-ACTOR
  74. //by Opcode.eXe
  75. :GET_TARGET_ACTOR
  76.     28@ = 640.0  
  77.     0A8D: 29@ = read_memory 0xB74490 size 4 virtual_protect 0
  78.     000A: 29@ += 0x4
  79.     0A8D: 29@ = read_memory 29@ size 4 virtual_protect 0
  80.     for 30@ = 0 to 35584 step 0x100
  81.         0A8D: 31@ = read_memory 29@ size 1 virtual_protect 0
  82.         000A: 29@ += 0x1
  83.         if and
  84.             0029:  31@ >= 0x00
  85.             001B:  0x80 > 31@
  86.         then
  87.             005A: 31@ += 30@
  88.             if
  89.             056D:   actor 31@ defined
  90.             then
  91.                 if
  92.                 803C:  $PLAYER_ACTOR == 31@ // (int)
  93.                 then
  94.                     04C4: store_coords_to 27@ 26@ 25@ from_actor 31@ with_offset 0.0 0.0 0.0
  95.                     068D: get_camera_position_to 24@ 23@ 22@
  96.                     if and
  97.                     02CB:   actor 31@ bounding_sphere_visible
  98.                     06BD:   no_obstacles_between 27@ 26@ 25@ and 24@ 23@ 22@ solid 1 car 0 actor 0 object 1 particle 0
  99.                     then
  100.                         0AB1: @getScreenXYFrom3DCoords 3 3D_coords_X 27@ Y 26@ Z 25@ store_screen_X_to 24@ Y_to 23@  
  101.                         0509: 22@ = distance_between_XY 339.0 179.0 and_XY 24@ 23@
  102.                         if
  103.                         0035:   28@ >= 22@ // (float)
  104.                         then
  105.                             0087: 28@ = 22@ // (float)
  106.                             0087: 15@ = 31@ // (float)
  107.                         end
  108.                    
  109.                    
  110.                     end    
  111.                 end
  112.             end
  113.         end
  114.     end
  115.     if
  116.     056D:   actor 15@ defined
  117.     then
  118.         0485:  return_true
  119.     else
  120.         059A:  return_false
  121.     end
  122. 0AB2: 1 15@
  123.  
  124. //0AB1: call_scm_func @getScreenXYFrom3DCoords 3 3D_coords_X 0@ Y 1@ Z 2@ store_screen_X_to 3@ Y_to 4@
  125. :getScreenXYFrom3DCoords
  126.     0AC7: 14@ = var 0@ offset
  127.     0AC7: 15@ = var 3@ offset
  128.     0AC7: 16@ = var 6@ offset
  129.     0AC7: 17@ = var 9@ offset
  130.     0AA5: call 0x70CE30 num_params 6 pop 6 {18@ 18@} 0 0 17@ 16@ 15@ 14@
  131.     0007: 12@ = 640.0
  132.     0007: 13@ = 448.0
  133.     0A8D: 14@ = read_memory 0xC17044 size 4 virtual_protect 0
  134.     0A8D: 15@ = read_memory 0xC17048 size 4 virtual_protect 0
  135.     0093: 14@ = integer 14@ to_float
  136.     0093: 15@ = integer 15@ to_float
  137.     0073: 12@ /= 14@
  138.     0073: 13@ /= 15@
  139.     006B: 3@ *= 12@
  140.     006B: 4@ *= 13@
  141. 0AB2: ret 2 3@ 4@
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement