zpos.inc 636 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. SA-MP MapAndreas Include
  3. Copyright © 2011-2012 RyDeR`
  4. */
  5. #if defined _MapAndreas_Included
  6. #endinput
  7. #endif
  8. #define _MapAndreas_Included
  9. stock Float: GetPointZPos(const Float: fX, const Float: fY, &Float: fZ = 0.0) {
  10. if(!((-3000.0 < fX < 3000.0) && (-3000.0 < fY < 3000.0))) {
  11. return 0.0;
  12. }
  13. static
  14. File: s_hMap
  15. ;
  16. if(!s_hMap) {
  17. s_hMap = fopen("SAfull.hmap", io_read);
  18. if(!s_hMap) {
  19. return 0.0;
  20. }
  21. }
  22. new
  23. afZ[1]
  24. ;
  25. fseek(s_hMap, ((6000 * (-floatround(fY, floatround_tozero) + 3000) + (floatround(fX, floatround_tozero) + 3000)) << 1));
  26. fblockread(s_hMap, afZ);
  27. return (fZ = ((afZ[0] >>> 16) * 0.01));
  28. }