Advertisement
Guest User

Pay' N spray

a guest
Dec 3rd, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.07 KB | None | 0 0
  1. /* SA-MP Include Pay'NSpray
  2.  *
  3.  * (c) by Kaliber, 2016
  4.  *
  5.  */
  6. #if !defined _samp_included
  7.     #include <a_samp>
  8. #endif
  9. #if defined _payNspray
  10.     #endinput
  11. #endif
  12. #define _payNspray
  13. /******************************************************************************/
  14. #define A:: a_S_
  15. /******************************************************************************/
  16. static stock const Float:paynspray[][3] = {
  17.     {1025.05, -1024.23, 32.1}, // LS Temple
  18.     {487.68, -1740.87, 11.13}, // LS Santa Maria
  19.     {-1420.73, 2583.37, 55.56}, // El Quebrados
  20.     {-1904.39, 284.97, 40.75}, // Wang Cars
  21.     {-2425.91, 1022.33, 50.10}, // Juniper Hill
  22.     {1975.60, 2162.16, 10.77}, // LV Redsands
  23.     {2065.38, -1831.51, 13.25}, // Idlewood
  24.     {-99.55, 1118.36, 19.44}, // Fort Carson
  25.     {721.07, -455.94, 16.04}, // Dillimore
  26.     {2393.74, 1493.01, 10.52} // LV Unused (Pyramid)
  27. };
  28. static bool:range[MAX_PLAYERS char];
  29. /******************************************************************************/
  30. public OnGameModeInit()
  31. {
  32.     SetTimer(!"@playerCheck",999,1);
  33.     #if defined a_S_OnGameModeInit
  34.         return A::OnGameModeInit();
  35.     #else
  36.         return 1;
  37.     #endif
  38. }
  39. #if defined a_S_OnGameModeInit
  40.     forward A::OnGameModeInit();
  41. #endif
  42. #if defined _ALS_OnGameModeInit
  43.     #undef OnGameModeInit
  44. #else
  45.     #define _ALS_OnGameModeInit
  46. #endif
  47. #define OnGameModeInit a_S_OnGameModeInit
  48. /******************************************************************************/
  49. static @playerCheck();@playerCheck()
  50. {
  51.     for(new i=GetPlayerPoolSize(); i!=-1; i--)
  52.     {
  53.         if(!IsPlayerConnected(i) || IsPlayerNPC(i)) continue;
  54.         if(!range{i} && isAtPayNSpray(i))
  55.         {
  56.             range{i}=true;
  57.             CallLocalFunction(!"OnPlayerEnterPayNSpray",!"i",i);
  58.         }
  59.         else if(range{i} && !isAtPayNSpray(i))
  60.         {
  61.             range{i}=false;
  62.             CallLocalFunction(!"OnPlayerLeavePayNSpray",!"i",i);
  63.         }
  64.     }
  65.     return 1;
  66. }
  67. static stock isAtPayNSpray(i)
  68. {
  69.     static j;
  70.     for(j=0; j<sizeof(paynspray); j++)
  71.     {
  72.         if(IsPlayerInRangeOfPoint(i,10.0,paynspray[j][0],paynspray[j][1],paynspray[j][2])) return 1;
  73.     }
  74.     return 0;
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement