Prawy

disableWeapon() , enableWeapon() functions for Call of Duty 1.1 ( Made by Prawy )

May 27th, 2021 (edited)
140
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.39 KB | None
  1. disableWeapon() {
  2.  
  3. if( isDefined(self.disabled) )
  4. return;
  5.  
  6. self.disabled = true;
  7.  
  8. self.pers["storeweapon"]["currentweapon"] = self getcurrentweapon();
  9.  
  10. //Storing primary weapon and it's ammo in var
  11. self.pers["storeweapon"]["primary"] = self getWeaponSlotWeapon("primary");
  12. self.pers["storeweapon"]["primary_clipammo"] = self getWeaponSlotClipAmmo( "primary" );
  13. self.pers["storeweapon"]["primary_ammo"] = self getWeaponSlotAmmo( "primary" );
  14.  
  15. //Storing primaryb weapon and it's ammo in var
  16. self.pers["storeweapon"]["primaryb"] = self getWeaponSlotWeapon("primaryb");
  17. self.pers["storeweapon"]["primaryb_clipammo"] = self getWeaponSlotClipAmmo( "primaryb" );
  18. self.pers["storeweapon"]["primaryb_ammo"] = self getWeaponSlotAmmo( "primaryb" );
  19.  
  20. //Storing pistol weapon and it's ammo in var
  21. self.pers["storeweapon"]["pistol"] = self getWeaponSlotWeapon("pistol");
  22. self.pers["storeweapon"]["pistol_clipammo"] = self getWeaponSlotClipAmmo( "pistol" );
  23. self.pers["storeweapon"]["pistol_ammo"] = self getWeaponSlotAmmo( "pistol" );
  24.  
  25. //Storing grenade and it's ammo in var
  26. self.pers["storeweapon"]["grenade"] = self getWeaponSlotWeapon("grenade");
  27. self.pers["storeweapon"]["grenade_clipammo"] = self getWeaponSlotClipAmmo( "grenade" );
  28. self.pers["storeweapon"]["grenade_ammo"] = self getWeaponSlotAmmo( "grenade" );
  29.  
  30. //Storing smokegrenade and it's ammo in var
  31. self.pers["storeweapon"]["smokegrenade"] = self getWeaponSlotWeapon("smokegrenade");
  32. self.pers["storeweapon"]["smokegrenade_clipammo"] = self getWeaponSlotClipAmmo( "smokegrenade" );
  33. self.pers["storeweapon"]["smokegrenade_ammo"] = self getWeaponSlotAmmo( "smokegrenade" );
  34.  
  35. self takeallweapons();
  36. }
  37.  
  38. enableWeapon() {
  39.  
  40. self.disabled = undefined;
  41.  
  42. //Giving primary's weapon and it's ammo
  43. self setWeaponSlotWeapon( "primary", self.pers["storeweapon"]["primary"] );
  44. self setWeaponSlotClipAmmo( "primary", self.pers["storeweapon"]["primary_clipammo"]);
  45. self setWeaponSlotAmmo( "primary", self.pers["storeweapon"]["primary_ammo"]);
  46.  
  47. //Giving primaryb's weapon and it's ammo
  48. self setWeaponSlotWeapon( "primaryb", self.pers["storeweapon"]["primaryb"] );
  49. self setWeaponSlotClipAmmo( "primaryb", self.pers["storeweapon"]["primaryb_clipammo"]);
  50. self setWeaponSlotAmmo( "primaryb", self.pers["storeweapon"]["primaryb_ammo"]);
  51.  
  52. //Giving pistol's weapon and it's ammo
  53. self setWeaponSlotWeapon( "pistol", self.pers["storeweapon"]["pistol"] );
  54. self setWeaponSlotClipAmmo( "pistol", self.pers["storeweapon"]["pistol_clipammo"]);
  55. self setWeaponSlotAmmo( "pistol", self.pers["storeweapon"]["pistol_ammo"]);
  56.  
  57. //Giving grenade's and it's ammo
  58. self setWeaponSlotWeapon( "grenade", self.pers["storeweapon"]["grenade"] );
  59. self setWeaponSlotClipAmmo( "grenade", self.pers["storeweapon"]["grenade_clipammo"]);
  60. self setWeaponSlotAmmo( "grenade", self.pers["storeweapon"]["grenade_ammo"]);
  61.  
  62. //Giving smokegrenade's and it's ammo
  63. self setWeaponSlotWeapon( "smokegrenade", self.pers["storeweapon"]["smokegrenade"] );
  64. self setWeaponSlotClipAmmo( "smokegrenade", self.pers["storeweapon"]["smokegrenade_clipammo"]);
  65. self setWeaponSlotAmmo( "smokegrenade", self.pers["storeweapon"]["smokegrenade_ammo"]);
  66.  
  67. if( isDefined( self.pers["team"] ) && self.pers["team"] == "allies" )
  68. self switchToWeapon( self.pers["storeweapon"]["currentweapon"] );
  69. else
  70. self switchToWeapon( self.pers["storeweapon"]["currentweapon"] );
  71. }
RAW Paste Data Copied