Guest User

Untitled

a guest
Sep 16th, 2011
557
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.95 KB | None | 0 0
  1. /* GetDistanceToPoint (Kilometers, Meters)
  2. Author: TheArcher(aka Anthony_prince)
  3. Big Thanks to. Ryder (for function and formula), Gamer93(Learned a lot from him),
  4. ,[HiC]TheKiller(Fixed Float mistakes).
  5.  
  6. Version@ 1.0
  7. */
  8.  
  9. /*
  10.  
  11. native SetKilometersFromPlayer(pointid, Float: x, Float: y, Float: z);
  12. native SetMetersFromPlayer(pointid, Float: x, Float: y, Float: z);
  13. native GetKilometersFromPlayer(pointid);
  14. native GetMetersFromPlayer(pointid);
  15.  
  16. */
  17.  
  18. #if defined _DistancePoint
  19. #endinput
  20. #endif
  21. #define _DistancePoint
  22.  
  23. #if !defined FILTERSCRIPT
  24. public OnGameModeInit()
  25. {
  26. print(" Distance Loaded ");
  27. return CallLocalFunction("D_OnGameModeInit","");
  28. }
  29.  
  30. public OnGameModeExit()
  31. {
  32. print(" Distance UnLoaded ");
  33. return CallLocalFunction("D_OnGameModeExit","");
  34. }
  35. #else
  36. public OnFilterScriptInit()
  37. {
  38. print(" Distance Loaded ");
  39. return CallLocalFunction("D_OnFilterScriptInit","");
  40. }
  41.  
  42. public OnFilterScriptExit()
  43. {
  44. print(" Distance UnLoaded ");
  45. return CallLocalFunction("D_OnFilterScriptExit","");
  46. }
  47. #endif
  48.  
  49. stock Float: SetKilometersFromPlayer(pointid,Float:x2,Float:y2,Float:z2)
  50. {
  51. new playerid;
  52. new Float:x,Float:y,Float:z;
  53. GetPlayerPos(playerid, x,y,z);
  54. CallLocalFunction("Float:SetKilometersFromPlayer", "ifffd", pointid,Float:x2,Float:y2,Float:z2,playerid);
  55. return floatsqroot(((x -= x2) * x) + ((y -= y2) * y) + ((z -= z2) * z))/1000;
  56. }
  57.  
  58. stock Float: SetMetersFromPlayer(pointid,Float:x2,Float:y2,Float:z2)
  59. {
  60. new playerid;
  61. CallLocalFunction("Float:SetMetersFromPlayer", "ifffd", pointid,Float:x2,Float:y2,Float:z2,playerid);
  62. return SetKilometersFromPlayer(pointid,Float:x2,Float:y2,Float:z2)*1000;
  63. }
  64.  
  65. stock Float: GetKilometersFromPlayer(pointid)
  66. {
  67. new playerid;
  68. new Float:x2,Float:y2,Float:z2;
  69. CallLocalFunction("Float:GetKilometersFromPlayer", "ifffd", pointid,Float:x2,Float:y2,Float:z2,playerid);
  70. return SetKilometersFromPlayer(pointid,Float:x2,Float:y2,Float:z2);
  71. }
  72.  
  73. stock Float: GetMetersFromPlayer(pointid)
  74. {
  75. new playerid;
  76. new Float:x2,Float:y2,Float:z2;
  77. CallLocalFunction("Float:GetMetersFromPlayer", "ifffd", pointid,Float:x2,Float:y2,Float:z2,playerid);
  78. return SetMetersFromPlayer(pointid,Float:x2,Float:y2,Float:z2);
  79. }
  80.  
  81. #if !defined FILTERSCRIPT
  82. #if defined _ALS_OnGameModeInit
  83. #undef OnGameModeInit
  84. #else
  85. #define _ALS_OnGameModeInit
  86. #endif
  87. #define OnGameModeInit D_OnGameModeInit
  88. forward OnGameModeInit();
  89.  
  90. #if defined _ALS_OnGameModeExit
  91. #undef OnGameModeExit
  92. #else
  93. #define _ALS_OnGameModeExit
  94. #endif
  95. #define OnGameModeExit D_OnGameModeExit
  96. forward OnGameModeExit();
  97. #else
  98. #if defined _ALS_OnFilterScriptInit
  99. #undef OnFilterScriptInit
  100. #else
  101. #define _ALS_OnFilterScriptInit
  102. #endif
  103. #define OnFilterScriptInit D_OnFilterScriptInit
  104. forward OnFilterScriptInit();
  105.  
  106. #if defined _ALS_OnFilterScriptExit
  107. #undef OnFilterScriptExit
  108. #else
  109. #define _ALS_OnFilterScriptExit
  110. #endif
  111. #define OnFilterScriptExit D_OnFilterScriptExit
  112. forward OnFilterScriptExit();
  113. #endif
Advertisement
Add Comment
Please, Sign In to add comment