SHARE
TWEET

Untitled

a guest Jan 15th, 2017 2 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include maps\_utility;
  2. #include common_scripts\utility;
  3. #include maps\_zombiemode_utility;
  4.  
  5. init()
  6. {
  7.     PrecacheItem( "zombie_gumball" );
  8. }
  9.  
  10. gum_think()
  11. {  
  12.     self.first_time_triggered = false;
  13.     player = get_players();
  14.    
  15.     for( ;; )
  16.     {
  17.         //self waittill( "trigger", player );      
  18.         // if not first time and they have the weapon give ammo
  19.  
  20.         if( !is_player_valid( player ) )
  21.         {
  22.             player thread ignore_triggers( 0.5 );
  23.             continue;
  24.         }
  25.  
  26.         if( player in_revive_trigger() )
  27.         {
  28.             wait( 0.1 );
  29.             continue;
  30.         }
  31.        
  32.         if( player isThrowingGrenade() )
  33.         {
  34.             wait( 0.1 );
  35.             continue;
  36.         }
  37.  
  38.         if(isdefined(player.is_drinking))
  39.         {
  40.             wait(0.1);
  41.             continue;
  42.         }
  43.        
  44.         if( player isSwitchingWeapons() )
  45.         {
  46.             wait(0.1);
  47.             continue;
  48.         }
  49.  
  50.         if( player GetCurrentWeapon() == "mine_bouncing_betty" )
  51.         {
  52.             wait(0.1);
  53.             continue;
  54.         }
  55.        
  56.         if (player maps\_laststand::player_is_in_laststand() )
  57.         {
  58.             wait(0.1);
  59.             continue;
  60.         }
  61.        
  62.         player give_gumball();
  63.         /*
  64.         player_has_gumball = player SetActionSlot( 5, "weapon", "zombie_gumball" );
  65.  
  66.         if( !player_has_gumball )
  67.         {
  68.             if( player.score >= cost )
  69.             {
  70.                 if( self.first_time_triggered == false )
  71.                 {
  72.                     model = getent( self.target, "targetname" );
  73.                     //model thread gumball_show( player );
  74.                     self.first_time_triggered = true;
  75.                 }
  76.             }
  77.         }
  78.         */
  79.     }
  80. }
  81.  
  82. give_gumball()
  83. {
  84.     self SetActionSlot( 5, "weapon", "zombie_gumball" );
  85.    
  86.     //self.has_altmelee = true;
  87.     index = maps\_zombiemode_weapons::get_player_index(self);
  88.     plr = "plr_" + index + "_";
  89.    
  90.     gun = self do_gumball_flourish_begin();
  91.     //self thread play_gum_pickup_dialog(plr);
  92.     self.is_drinking = 1;
  93.     self waittill_any( "fake_death", "death", "player_downed", "weapon_change_complete" );
  94.  
  95.     // restore player controls and movement
  96.     self do_gumball_flourish_end( gun );
  97.     self.is_drinking = undefined;
  98. }
  99.  
  100. do_gumball_flourish_begin()
  101. {
  102.     self DisableOffhandWeapons();
  103.     self DisableWeaponCycling();
  104.  
  105.     self AllowLean( false );
  106.     self AllowAds( false );
  107.     self AllowSprint( false );
  108.     self AllowProne( false );      
  109.     self AllowMelee( false );
  110.    
  111.     wait( 0.05 );
  112.    
  113.     if ( self GetStance() == "prone" )
  114.     {
  115.         self SetStance( "crouch" );
  116.     }
  117.  
  118.     gun = self GetCurrentWeapon();
  119.     weapon = "zombie_gumball";
  120.  
  121.     self GiveWeapon( weapon );
  122.     self SwitchToWeapon( weapon );
  123.  
  124.     return gun;
  125. }
  126.  
  127. do_gumball_flourish_end( gun )
  128. {
  129.     assert( gun != "zombie_perk_bottle_doubletap" );
  130.     assert( gun != "zombie_perk_bottle_revive" );
  131.     assert( gun != "zombie_perk_bottle_jugg" );
  132.     assert( gun != "zombie_perk_bottle_sleight" );
  133.     assert( gun != "syrette" );
  134.  
  135.     self EnableOffhandWeapons();
  136.     self EnableWeaponCycling();
  137.  
  138.     self AllowLean( true );
  139.     self AllowAds( true );
  140.     self AllowSprint( true );
  141.     self AllowProne( true );       
  142.     self AllowMelee( true );
  143.     weapon = "zombie_gumball";
  144.  
  145.     // TODO: race condition?
  146.     if ( self maps\_laststand::player_is_in_laststand() )
  147.     {
  148.         self TakeWeapon(weapon);
  149.         return;
  150.     }
  151.  
  152.     self TakeWeapon(weapon);
  153.  
  154.     if ( gun != "none" && gun != "mine_bouncing_betty" )
  155.     {
  156.         self SwitchToWeapon( gun );
  157.     }
  158.     else
  159.     {
  160.         // try to switch to first primary weapon
  161.         primaryWeapons = self GetWeaponsListPrimaries();
  162.         if( IsDefined( primaryWeapons ) && primaryWeapons.size > 0 )
  163.         {
  164.             self SwitchToWeapon( primaryWeapons[0] );
  165.         }
  166.     }
  167.    
  168.     self waittill( "weapon_change_complete" );
  169. }
  170. /*
  171. gumball_show( player )
  172. {
  173.     player_angles = VectorToAngles( player.origin - self.origin );
  174.  
  175.     player_yaw = player_angles[1];
  176.     weapon_yaw = self.angles[1];
  177.  
  178.     yaw_diff = AngleClamp180( player_yaw - weapon_yaw );
  179.  
  180.     if( yaw_diff > 0 )
  181.     {
  182.         yaw = weapon_yaw - 90;
  183.     }
  184.     else
  185.     {
  186.         yaw = weapon_yaw + 90;
  187.     }
  188.  
  189.     self.og_origin = self.origin;
  190.     self.origin = self.origin +( AnglesToForward( ( 0, yaw, 0 ) ) * 8 );
  191.  
  192.     wait( 0.05 );
  193.     self Show();
  194.  
  195.     play_sound_at_pos( "weapon_show", self.origin, self );
  196.  
  197.     time = 1;
  198.     self MoveTo( self.og_origin, time );
  199. }
  200.  
  201. play_bowie_pickup_dialog(player_index)
  202. {
  203.     waittime = 0.05;
  204.     if(!IsDefined (self.vox_bowie))
  205.     {
  206.         num_variants = maps\_zombiemode_spawner::get_number_variants(player_index + "vox_bowie");
  207.         self.vox_bowie = [];
  208.         for(i=0;i<num_variants;i++)
  209.         {
  210.             self.vox_bowie[self.vox_bowie.size] = "vox_bowie_" + i;
  211.         }
  212.         self.vox_bowie_available = self.vox_bowie;
  213.     }
  214.     if(!isdefined (level.player_is_speaking))
  215.     {
  216.         level.player_is_speaking = 0;
  217.     }
  218.     sound_to_play = random(self.vox_bowie_available);
  219.     self maps\_zombiemode_spawner::do_player_playdialog(player_index, sound_to_play, waittime);
  220.     self.vox_bowie_available = array_remove(self.vox_bowie_available,sound_to_play);
  221.    
  222.     if (self.vox_bowie_available.size < 1 )
  223.     {
  224.         self.vox_bowie_available = self.vox_bowie;
  225.     }
  226. }
  227. */
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top