Advertisement
Prawy

enableweapon(), disableweapon() zomv12

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