MorteAmerica

DisableMachines

Aug 2nd, 2017
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.18 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define MAX_MACHINESSPRUNK 28
  4. #define MAX_MACHINESCANDY  15
  5.  
  6. forward AttOldLife(playerid);
  7.  
  8. new TimerAttLife[MAX_PLAYERS];
  9. new Float:LifePlayer[MAX_PLAYERS];
  10.  
  11. new Float:MachinesSprunk[MAX_MACHINESSPRUNK][3]={
  12.     {1789.21,-1369.27,15.1641},
  13.     {1729.79,-1943.05,12.9453},
  14.     {2060.12,-1897.64,12.9297},
  15.     {1928.73,-1772.45,12.9453},
  16.     {2325.98,-1645.13,14.2109},
  17.     {2352.18,-1357.16,23.7734},
  18.     {1154.73,-1460.89,15.1562},
  19.     {-1350.12,492.289,10.5859},
  20.     {-2118.97,-423.648,34.7266},
  21.     {-2118.62,-422.414,34.7266},
  22.     {-2097.27,-398.336,34.7266},
  23.     {-2092.09,-490.055,34.7266},
  24.     {-2063.27,-490.055,34.7266},
  25.     {-2005.65,-490.055,34.7266},
  26.     {-2034.46,-490.055,34.7266},
  27.     {-2068.56,-398.336,34.7266},
  28.     {-2039.85,-398.336,34.7266},
  29.     {-2011.14,-398.336,34.7266},
  30.     {-1980.79,142.664,27.0703},
  31.     {2319.99,2532.85,10.2188},
  32.     {1520.15,1055.27,10.00},
  33.     {2503.14,1243.7,10.2188},
  34.     {2085.77,2071.36,10.4531},
  35.     {-862.828,1536.61,21.9844},
  36.     {-14.7031,1175.36,18.9531},
  37.     {-253.742,2597.95,62.2422},
  38.     {201.016,-107.617,0.898438},
  39.     {1277.84,372.516,18.9531}
  40. };
  41.  
  42. new Float:MachinesCandy[MAX_MACHINESCANDY][3]={
  43.     {2480.86,-1959.27,12.9609},
  44.     {1634.11,-2237.53,12.8906},
  45.     {2139.52,-1161.48,23.3594},
  46.     {2153.23,-1016.15,62.2344},
  47.     {-1350.12,493.859,10.5859},
  48.     {-2229.19,286.414,34.7031},
  49.     {1659.46,1722.86,10.2188},
  50.     {2647.7,1129.66,10.2188},
  51.     {2845.73,1295.05,10.7891},
  52.     {1398.84,2222.61,10.4219},
  53.     {-1455.12,2591.66,55.2344},
  54.     {-76.0312,1227.99,19.125},
  55.     {662.43,-552.164,15.7109},
  56.     {-253.742,2599.76,62.2422},
  57.     {2271.73,-76.4609,25.9609}
  58. };
  59.  
  60. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  61. {
  62.     if(newkeys & KEY_SECONDARY_ATTACK)
  63.     {
  64.         if(!IsPlayerInAnyVehicle(playerid))
  65.         {
  66.             if(IsPlayerInMachineSprunk(playerid))
  67.             {
  68.                 if(GetPlayerMoney(playerid) > 0)
  69.                 {
  70.                     GetPlayerHealth(playerid, LifePlayer[playerid]);
  71.                     TimerAttLife[playerid] = SetTimerEx("AttOldLife", 2545, false,"d", playerid);
  72.                     //Aqui pode por outras coisas, como se você tiver um sistema de fome e sede, diminuir a sede
  73.                 }
  74.             }
  75.             else if(IsPlayerInMachineCandy(playerid))
  76.             {
  77.                 if(GetPlayerMoney(playerid) > 0)
  78.                 {
  79.                     GetPlayerHealth(playerid, LifePlayer[playerid]);
  80.                     TimerAttLife[playerid] = SetTimerEx("AttOldLife", 2545, false,"d", playerid);
  81.                     //Aqui pode por outras coisas, como se você tiver um sistema de fome e sede, diminuir a fome
  82.                 }
  83.             }
  84.         }
  85.     }
  86.     return 1;
  87. }
  88.  
  89. public OnPlayerDisconnect(playerid, reason)
  90. {
  91.     KillTimer(TimerAttLife[playerid]);
  92.     return 1;
  93. }
  94.  
  95. public OnPlayerDeath(playerid, killerid, reason)
  96. {
  97.     KillTimer(TimerAttLife[playerid]);
  98.     return 1;
  99. }
  100.  
  101. public AttOldLife(playerid)
  102. {
  103.     SetPlayerHealth(playerid, LifePlayer[playerid]);
  104. }
  105.  
  106. stock IsPlayerInMachineSprunk(playerid)
  107. {
  108.     for(new i = 0; i < MAX_MACHINESSPRUNK; i++)
  109.     {
  110.         if(IsPlayerInRangeOfPoint(playerid,2.5,MachinesSprunk[i][0],MachinesSprunk[i][1],MachinesSprunk[i][2])) return 1;
  111.     }
  112.     return 0;
  113. }
  114.  
  115. stock IsPlayerInMachineCandy(playerid)
  116. {
  117.     for(new i = 0; i < MAX_MACHINESCANDY; i++)
  118.     {
  119.         if(IsPlayerInRangeOfPoint(playerid,2.5,MachinesCandy[i][0],MachinesCandy[i][1],MachinesCandy[i][2])) return 1;
  120.     }
  121.     return 0;
  122. }
Add Comment
Please, Sign In to add comment