Advertisement
Guest User

[FilterScript] item_death

a guest
Apr 23rd, 2012
1,426
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.10 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. /*
  4.  
  5. [- Drop Player's Items On Death -]
  6. [-- Version 1                   -]
  7. [-- Author: pownayge @sa-mp.com -]
  8.  
  9. */
  10.  
  11. #define MONEY_BAG       1550
  12. #define MONEY_STACK     1220
  13.  
  14. new playerPickups[MAX_PICKUPS];
  15.  
  16. public OnFilterScriptInit()
  17. {
  18.     print("\tItem Death loaded\n");
  19.     return 1;
  20. }
  21.  
  22. public OnPlayerDeath(playerid, killerid, reason)
  23. {
  24.    
  25.     if(killerid != INVALID_PLAYER_ID)
  26.     {
  27.         new Float:x, Float:y, Float:z;
  28.         new oldmoney = GetPlayerMoney(playerid);
  29.        
  30.         GetPlayerPos(playerid, x, y, z);
  31.         ResetPlayerMoney(playerid);
  32.        
  33.         //Only drop if the player has atleast $1
  34.         if(oldmoney > 0)
  35.         {
  36.             new object = MONEY_STACK;
  37.            
  38.             if(oldmoney >= 20000)
  39.             {
  40.                 object = MONEY_BAG;
  41.             }
  42.            
  43.             //Create the pickup & return the id
  44.             //Set the id to how much money was dropped
  45.             playerPickups[CreatePickup(object, 2, x, y, z, -1)] = oldmoney;
  46.         }
  47.     }
  48.    
  49.     return 1;
  50. }
  51.  
  52. public OnPlayerPickUpPickup(playerid, pickupid)
  53. {
  54.     if(playerPickups[pickupid] != EOS)
  55.     {
  56.         GivePlayerMoney(playerid, playerPickups[pickupid]);
  57.         DestroyPickup(pickupid);
  58.        
  59.         playerPickups[pickupid] = EOS;
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement