Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. stock Float:GetRealDistance(playerid, playerid2, unit)
  2. {
  3. new Float:Pos[3], Float:Pos2[3], Float:converter;
  4. GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  5. GetPlayerPos(playerid2, Pos2[0], Pos2[1], Pos2[2]);
  6.  
  7. Pos[0] -= Pos2[0];
  8. Pos[1] -= Pos2[1];
  9. Pos[2] -= Pos2[2];
  10.  
  11. switch(unit)
  12. {
  13. case 0: converter = 1.0; // Mét
  14. case 1: converter = 1.0/1000.0; // Kilo mét
  15. case 2: converter = (1.0/1000.0)/1.6; // Dặm
  16. case 3: converter = 100.0; // Centi mét
  17. case 4: converter = 39.3701; // Inch
  18. }
  19. return floatsqroot((Pos[0]*Pos[0]) + (Pos[1]*Pos[1]) + (Pos[2]*Pos[2]))*converter;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement