Advertisement
Guest User

Chiri

a guest
Jan 5th, 2010
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.91 KB | None | 0 0
  1. // by Fallout
  2.  
  3.  
  4. #include <a_samp>
  5.  
  6. ////////////////////////////////////////////////////////////////////////////////
  7.  
  8. forward DestroyMoneyPickups(playerid);
  9.  
  10. ////////////////////////////////////////////////////////////////////////////////
  11.  
  12. #define MoneyLossProcent            10  //
  13. #define TimeToDestroyMoneyPickups   10000 //
  14. new NumberOfPickups =               10; //
  15.  
  16. ////////////////////////////////////////////////////////////////////////////////
  17.  
  18. new MoneyLost[MAX_PLAYERS];
  19. new MoneyPickup[MAX_PLAYERS][10];
  20. new bool:PickupsCreated[MAX_PLAYERS];
  21. new DestroyMoneyPickupst[MAX_PLAYERS];
  22.  
  23. ////////////////////////////////////////////////////////////////////////////////
  24.  
  25. public OnFilterScriptExit()
  26. {
  27.     for(new i=0; i<MAX_PLAYERS; i++)
  28.     {
  29.         if(PickupsCreated[i] == true)
  30.         {
  31.             for(new n=0; n<NumberOfPickups; n++)
  32.             {
  33.                 DestroyPickup(MoneyPickup[i][n]);
  34.             }
  35.             KillTimer(DestroyMoneyPickupst[i]);
  36.         }
  37.     }
  38. }
  39.  
  40. ////////////////////////////////////////////////////////////////////////////////
  41.  
  42. public OnPlayerConnect(playerid)
  43. {
  44.     PickupsCreated[playerid] = false;
  45. }
  46.  
  47. ////////////////////////////////////////////////////////////////////////////////
  48.  
  49. public OnPlayerDeath(playerid, killerid, reason)
  50. {
  51.     MoneyLost[playerid] = GetPlayerMoney(playerid)/MoneyLossProcent;
  52.     GivePlayerMoney(playerid, -MoneyLost[playerid]);
  53.     new Float:X, Float:Y, Float:Z;
  54.     GetPlayerPos(playerid, X, Y, Z);
  55.     if(PickupsCreated[playerid] == true)
  56.     {
  57.         for(new n=0; n<NumberOfPickups; n++)
  58.         {
  59.             DestroyPickup(MoneyPickup[playerid][n]);
  60.         }
  61.         KillTimer(DestroyMoneyPickupst[playerid]);
  62.         PickupsCreated[playerid] = false;
  63.     }
  64.  
  65.     if(MoneyLost[playerid] != 0)
  66.     {
  67.         for(new p=0; p<NumberOfPickups; p++)
  68.         {
  69.             MoneyPickup[playerid][p] = CreatePickup(1212,3, X+random(3)-random(3), Y+random(3)-random(3), Z-0.6);
  70.         }
  71.         DestroyMoneyPickupst[playerid] = SetTimerEx("DestroyMoneyPickups", TimeToDestroyMoneyPickups, 0, "i", playerid);
  72.         PickupsCreated[playerid] = true;
  73.     }
  74. }
  75.  
  76. ////////////////////////////////////////////////////////////////////////////////
  77.  
  78. public OnPlayerPickUpPickup(playerid, pickupid)
  79. {
  80.     for(new i=0; i<MAX_PLAYERS; i++)
  81.     {
  82.         if(pickupid == MoneyPickup[i][0] || pickupid == MoneyPickup[i][1] || pickupid == MoneyPickup[i][2] || pickupid == MoneyPickup[i][3]
  83.         || pickupid == MoneyPickup[i][4] || pickupid == MoneyPickup[i][5] || pickupid == MoneyPickup[i][6] || pickupid == MoneyPickup[i][7]
  84.         || pickupid == MoneyPickup[i][8] || pickupid == MoneyPickup[i][9])
  85.         {
  86.             GivePlayerMoney(playerid, MoneyLost[i]/NumberOfPickups);
  87.             DestroyPickup(pickupid);
  88.         }
  89.     }
  90. }
  91.  
  92. ////////////////////////////////////////////////////////////////////////////////
  93.  
  94. public DestroyMoneyPickups(playerid)
  95. {
  96.     for(new n=0; n<NumberOfPickups; n++)
  97.     {
  98.         DestroyPickup(MoneyPickup[playerid][n]);
  99.     }
  100.     PickupsCreated[playerid] = false;
  101. }
  102.  
  103. ////////////////////////////////////////////////////////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement