morphinc.inc 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. new pdistance = 1;
  2. forward NameTimer();
  3. Float:GetPointDistanceToPointExMorph(Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2)
  4. {
  5. new Float:x, Float:y, Float:z;
  6. x = x1-x2;
  7. y = y1-y2;
  8. z = z1-z2;
  9. return floatsqroot(x*x+y*y+z*z);
  10. }
  11. stock SetPDistance(dista)
  12. {
  13. pdistance = dista;
  14. }
  15. stock GetPDistance()
  16. {
  17. return pdistance;
  18. }
  19. stock EnableDistancedNameTag(delay)
  20. {
  21. SetTimer("NameTimer",delay,1);
  22. }
  23. forward NameTimer();
  24. public NameTimer()
  25. {
  26. for(new i = 0;i < MAX_PLAYERS;i++)
  27. {
  28. if(IsPlayerConnected(i))
  29. {
  30. for(new q = 0;q < MAX_PLAYERS;q++)
  31. {
  32. if(IsPlayerConnected(q))
  33. {
  34. new Float:p1x;
  35. new Float:p1y;
  36. new Float:p1z;
  37. new Float:p2x;
  38. new Float:p2y;
  39. new Float:p2z;
  40. if(IsPlayerConnected(i) && IsPlayerConnected(q))
  41. {
  42. GetPlayerPos(i,p1x,p1y,p1z);
  43. GetPlayerPos(q,p2x,p2y,p2z);
  44. if(GetPointDistanceToPointExMorph(p1x,p1y,p1z,p2x,p2y,p2z) < pdistance)
  45. {
  46. ShowPlayerNameTagForPlayer(i,q,1);
  47. }
  48. else
  49. {
  50. ShowPlayerNameTagForPlayer(i,q,0);
  51. }
  52. }}}}}
  53. }