Advertisement
Guest User

132wqe

a guest
Aug 17th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.13 KB | None | 0 0
  1.             for(entity e = world; (e = nextent(e));)
  2.             {
  3.                
  4.                
  5.                 // make sure the player is solid
  6.                 if(e.classname != "debug_waypoint")
  7.                     continue;
  8.                    
  9.                 vector camera_position = getproperty(VF_ORIGIN);
  10.                 traceline(camera_position, e.origin, MOVE_NOMONSTERS, self);
  11.                 // Did the trace make it to the player before hitting something?
  12.                 if(trace_fraction != 1)
  13.                     continue;
  14.                
  15.        
  16.                    
  17.                     vector vec = project(e.origin + [0, 0, e.maxs_z]);
  18.                 // is he behind us?
  19.                 if(vec_z < 0)
  20.                 {
  21.                     continue;
  22.                 }
  23.                
  24.                
  25.            
  26.                 // make the text size depend on how far the entity is
  27.                 // get the cameras angles
  28.                 makevectors(view_angles);
  29.                 // get position 16 upper left from entity
  30.                 vector topleft = project(e.origin + v_right*-16 + v_up*16);
  31.                 // get position 16 lower right from entity
  32.                 vector bottomright = project(e.origin + v_right*16 + v_up*-16);
  33.                 //whats the difference?
  34.                 vector text_size = bottomright - topleft;
  35.                 // a little adjustment!
  36.                 text_size *= 0.4;
  37.                
  38.                
  39.                
  40.                 drawstring (vec, ftos(e.damage), text_size, RGB_Orange, 1, 0);
  41.                
  42.                        
  43.                        
  44.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement