natesmithzombies

shootable door

Dec 29th, 2016
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.89 KB | None | 0 0
  1. function shootable_trigs()
  2. {
  3.     level.shootable_door_count = 0;
  4.     trigs = GetEntArray( "shootable_door", "targetname" );
  5.     level.shootable_door_goal = trigs.size;
  6.     foreach( trig in trigs )
  7.         trig thread wait_for_shoot();
  8. }
  9.  
  10. function wait_for_shoot()
  11. {
  12.     self waittill( "trigger", player );
  13.     player PlayLocalSound( "zmb_cha_ching" );   // Change this to any sound alias you want
  14.     model = GetEnt( self.target, "targetname" );
  15.     level.shootable_door_count++;
  16.     if( level.shootable_door_count == level.shootable_door_goal )
  17.         self open_door();
  18. }
  19.  
  20. function open_door()
  21. {
  22.     doors = GetEntArray( "shootable_door_reward", "targetname" );
  23.    
  24.     foreach( door in doors )
  25.         door PlaySound( "zmb_cha_ching" );
  26.     wait(0.05);
  27.     foreach( door in doors )
  28.         door delete();
  29.    
  30.     flag = doors[0].script_flag;
  31.     level flag::set( flag );
  32. }
  33.  
  34.  
  35. 2) At the top of your mapname.gsc add the following code
Advertisement
Add Comment
Please, Sign In to add comment