Share Pastebin
Guest
Public paste!

Deathmanthys

By: a guest | Nov 2nd, 2008 | Syntax: C++ | Size: 4.71 KB | Hits: 390 | Expires: Never
Copy text to clipboard
  1. //------------------------------------------------------------------------------
  2. //
  3. //   Drop Weapon Filter Script v1.1
  4. //   Designed for SA-MP v0.2
  5. //
  6. //   Created by Flyin
  7. //   Modified by uncajesse
  8. //
  9. //   http://forum.sa-mp.com/index.php?topic=19969
  10. //
  11. //------------------------------------------------------------------------------
  12.  
  13.  
  14. #include <a_samp>
  15.  
  16. public OnFilterScriptInit()
  17. {
  18.     print("\n**********************\n*Weapon Drop       *\n**********************\n");
  19.         return 1;
  20. }
  21.  
  22. public OnFilterScriptExit()
  23. {
  24.     print("\n**********************\n*Weapon Drop*\n*      UnLoaded      *\n**********************\n");
  25.         return 1;
  26. }
  27.  
  28. // * main defines *
  29.  
  30. new weapmod[600] = {1212,331,333,334,335,336,337,338,339,341,321,322,323,324,
  31. 325,326,342,343,344,345,345,345,346,347,348,349,350,351,352,353,355,356,372,357,
  32. 358,359,360,361,362,363,364,365,366,367,368,369,371};
  33.  
  34.  
  35. new PickUpMoney[101] = {false, ...};
  36. new PickUpMoneyAmmount[101] = {0, ...}; // added by uncajesse
  37. new PickUpWeaponSlot[101] = {0, ...}; // added by uncajesse
  38. new PickUpWeaponAmmo[101] = {0, ...}; // added by uncajesse
  39. new DropPick[101] = {false, ...};
  40.  
  41.  
  42. forward Float:GetPlayerArmourEx(p);
  43. Float:GetPlayerArmourEx(p)
  44. {
  45.         new Float:a;
  46.         GetPlayerArmour(p, a);
  47.         return a;
  48. }
  49.  
  50. // * OnPlayerDeath *
  51. public OnPlayerDeath(playerid, killerid, reason)
  52. {
  53.         // defines
  54.         new Float:X, Float:Y, Float:Z;
  55.         GetPlayerPos(playerid, X, Y, Z);
  56.         new weap[200];
  57.         new ammo;
  58.         new temp;
  59.         new s[256];
  60.         new PX;
  61.         new PY;
  62.         new PickUpMoneyBit = false; // added by uncajesse
  63.         // loop through weapon slots
  64.         for(new i=0;i<15;i++){
  65.                 // placing pickups
  66.                 if(i<12){
  67.                         GetPlayerWeaponData(playerid, i, weap[i], ammo);
  68.                         if(weapmod[weap[i]] == 1212){
  69.                                 PickUpMoneyBit=true; // added by uncajesse
  70.                         } else {
  71.                                 // calculating random pos near to player
  72.                             format(s, 256 ,"%.0f", X);
  73.                                 temp = strval(s);
  74.                                 PX = random((temp+2)-(temp-2))+(temp-2);
  75.                                 format(s, 256 ,"%.0f", Y);
  76.                                 temp = strval(s);
  77.                                 PY = random((temp+2)-(temp-2))+(temp-2);
  78.                                 // create pickup
  79.                             new pickid = CreatePickup(weapmod[weap[i]], 4,PX, PY, Z);
  80.                             PickUpWeaponSlot[pickid]=i;
  81.                             PickUpWeaponAmmo[pickid]=ammo;
  82.                                 DropPick[pickid]=true;
  83.                                 PickUpMoney[pickid]=false; // added by uncajesse
  84.                         }
  85.                 }
  86.                 if(i==13){
  87.                         // health drop, removed
  88.                         // why drop health when the player is dead?
  89.                 }
  90.                 if(i==14){
  91.                         if(GetPlayerArmourEx(playerid)>0.0){
  92.                                 // calculating random pos near to player
  93.                             format(s, 256 ,"%.0f", X);
  94.                                 temp = strval(s);
  95.                                 PX = random((temp+2)-(temp-2))+(temp-2);
  96.                                 format(s, 256 ,"%.0f", Y);
  97.                                 temp = strval(s);
  98.                                 PY = random((temp+2)-(temp-2))+(temp-2);
  99.                                 // create pickup
  100.                             new pickid = CreatePickup(1242, 4,PX, PY, Z);
  101.                             PickUpWeaponSlot[pickid]=14;
  102.                             PickUpWeaponAmmo[pickid]=0;
  103.                                 DropPick[pickid]=true;
  104.                                 PickUpMoney[pickid]=false; // added by uncajesse
  105.                         } else {
  106.                                 PickUpMoneyBit=true; // added by uncajesse
  107.                         }
  108.                 }
  109.                 if(i==15){
  110.                         PickUpMoneyBit=true; // added by uncajesse
  111.                 }
  112.         }
  113.         // create money pickup
  114.         if(PickUpMoneyBit)
  115.         { // added by uncajesse
  116.                 // calculating random pos near to player
  117.             format(s, 256 ,"%.0f", X);
  118.                 temp = strval(s);
  119.                 PX = random((temp+2)-(temp-2))+(temp-2);
  120.                 format(s, 256 ,"%.0f", Y);
  121.                 temp = strval(s);
  122.                 PY = random((temp+2)-(temp-2))+(temp-2);
  123.                 // placing money pickup
  124.                 new pickid = CreatePickup(1212, 4,PX, PY, Z);
  125.                 PickUpMoney[pickid]=true;
  126.                 PickUpMoneyAmmount[pickid]=GetPlayerMoney(playerid);
  127.                 PickUpWeaponAmmo[pickid]=0;
  128.                 DropPick[pickid]=true;
  129.         }
  130.         // end placing pickups
  131.         return 1;
  132. }
  133.  
  134. public OnPlayerPickUpPickup(playerid, pickupid)
  135. {
  136.         if(PickUpMoney[pickupid]){
  137.                 GivePlayerMoney(playerid,PickUpMoneyAmmount[pickupid]); // added by uncajesse
  138.         }
  139.         if(PickUpWeaponAmmo[pickupid]>0){
  140.             new currentslotweapon, currentslotammo;
  141.             GetPlayerWeaponData(playerid,PickUpWeaponSlot[pickupid],currentslotweapon,currentslotammo);
  142.             new newslotammo = currentslotammo + PickUpWeaponAmmo[pickupid];  // added by uncajesse
  143.         SetTimerEx("PlayerPickUpPickupSetAmmo", 500, 0, "d", playerid, PickUpWeaponSlot[pickupid], newslotammo);  // added by uncajesse
  144.         }
  145.         if(DropPick[pickupid]){
  146.             DropPick[pickupid]=false; // added by uncajesse
  147.             PickUpMoney[pickupid]=false; // added by uncajesse
  148.                 SetTimerEx("PickDestroy", 500, 0, "d", pickupid); // Destroying pickups
  149.         }
  150.         return 1;
  151. }
  152.  
  153. // set player's ammo, added by uncajesse
  154. forward PlayerPickUpPickupSetAmmo(playerid, slotid, slotammo);
  155. public PlayerPickUpPickupSetAmmo(playerid, slotid, slotammo)
  156. {
  157.         SetPlayerAmmo(playerid,slotid,slotammo);
  158. }
  159.  
  160. forward PickDestroy(o);
  161. public PickDestroy(o)DestroyPickup(o);  // Destroy pickup ! Muha xD!
  162.  
  163. // the end