Advertisement
Whitetigerswt

Map Bug Fix

Dec 15th, 2011
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.67 KB | None | 0 0
  1. #include <a_samp>
  2. #include <mapandreas>
  3.  
  4. // Mode:
  5. // With MAP_ANDREAS_MODE_MINIMAL the only file required in the /scriptfiles/ folder is: SAMapMin.hmap, which is 7 MB.
  6. // With MAP_ANDREAS_MODE_FULL    the only file required in the /scriptfiles/ folder is: SAMapFull.hmap which is 70 MB.
  7.  
  8. // The difference between the modes is small, MAP_ANDREAS_MODE_FULL is 3x more accurate than MAP_ANDREAS_MODE_MINIMAL. but requires a 70 MB file instead of a 7 MBm you decide.
  9. // if you have a good upload speed and can upload 70 MB to your server then i would definetly switch to MAP_ANDREAS_MODE_FULL.
  10. // else use minimal, the difference is very slight.
  11.  
  12. #define MODE MAP_ANDREAS_MODE_MINIMAL
  13. #define DEBUG 0
  14.  
  15. public OnFilterScriptInit() { MapAndreas_Init(MODE); }
  16. public OnFilterScriptExit() { MapAndreas_Unload(); }
  17.  
  18. public OnPlayerUpdate(playerid) {
  19.     #if DEBUG == 1
  20.     new ticks = tickcount();
  21.     #endif
  22.     new Float:X, Float:Y, Float:Z;
  23.     GetPlayerPos(playerid, X, Y, Z);
  24.    
  25.     new Float:vX, Float:vY, Float:vZ;
  26.     GetPlayerVelocity(playerid, vX, vY, vZ);
  27.    
  28.     new Float:targetZ;
  29.     MapAndreas_FindAverageZ(X, Y, targetZ);
  30.     if(Z < targetZ && vZ < -0.4) {
  31.         if(IsPlayerInRangeOfPoint(playerid, 35, 266.405334, 1884.246704, -0.192700) == 1) return 1; // this fixes an issue with the hole at Area 51
  32.         if(IsPlayerInAnyVehicle(playerid)) {
  33.             SetVehiclePos(GetPlayerVehicleID(playerid), X, Y, targetZ+3);
  34.         } else {
  35.             SetPlayerPos(playerid, X+random(5), Y+random(5), targetZ+3);
  36.         }
  37.     }
  38.     #if DEBUG == 1
  39.     new str[128];
  40.     format(str, sizeof(str), "took %d ms", tickcount()-ticks);
  41.     SendClientMessage(playerid, -1, str);
  42.     printf("took: %d ms", tickcount()-ticks);
  43.     #endif
  44.     return 1;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement