
   /* AMX Mod Script
   *
   * de_office
   *
   * 2003 - Lazy < the_lazy_one_09@hotmail.com >
   *
   *  Gameplay  change  for  the map cs_office, terrorists must plant the
   bomb
   * at either one of the hostage rescue points.
   *
   * New CVars: sv_de_office < 1 / 0 >
   *
   * Notes : Requires both Vexd Utilities and XtraFun modules to work
   */
   #include <amxmod>
   #include <vexd_utilities>
   #include <xtrafun>
   public plugin_precache( )
   {
       if ( get_cvar_num( "sv_de_office" ) == 0 )
           return PLUGIN_CONTINUE        /*    Do not precache unless the
   plugin is on        */

       /*    Precache needed items for the bomb since it's only precached
   on de_ maps    */
       precache_model( "models/w_c4.mdl" )
       precache_sound( "weapons/c4_click.wav" )
       precache_sound( "weapons/c4_disarm.wav" )
       precache_sound( "weapons/c4_disarmed.wav" )
       precache_sound( "weapons/c4_explode1.wav" )
       precache_sound( "weapons/c4_plant.wav" )

       return PLUGIN_CONTINUE
   }
   public plugin_init( )
   {
       register_plugin( "de_office", "1.0", "Lazy" )

       register_cvar( "sv_de_office", "1", FCVAR_SERVER )

       if ( get_cvar_num( "sv_de_office" ) == 1 )
       {
           new map[ 128 ]
           get_mapname( map, 128 )

           if ( equali( map, "cs_office" ) )
           {
               set_cvar_num( "mp_c4timer", 30 )
               SpawnMapItems( )
           }
           else
           {
               pause( "a" )
           }
       }

       return PLUGIN_CONTINUE
   }
   public SpawnMapItems( )
   {
       new i = 1

       while ( ( i = find_entity( i, classname, "func_hostage_rescue" ) )
   )
       {
           new bomb = CreateEntity( "func_bomb_target" )

           if ( bomb != 0 )
           {
               new model[ 512 ]
               new Float:mins[ 3 ] = { -1024.0, -1024.0, -1024.0 }
               new Float:maxs[ 3 ] = { 1024.0, 1024.0, 1024.0 }
               new Float:origin[ 3 ]

               Entvars_Get_Vector( i, EV_VEC_origin, origin )

               Entvars_Set_Vector( bomb, EV_VEC_mins, mins )
               Entvars_Set_Vector( bomb, EV_VEC_maxs, maxs )
               Entvars_Set_Int( bomb, EV_INT_solid, 1 )

               DispatchSpawn( bomb )
               Entvars_Get_String( i, EV_SZ_model, model, 512 )

               ENT_SetModel( bomb, model )
               ENT_SetOrigin( bomb, origin )

               RemoveEntity( i )
           }
       }

       i = 1

       while ( ( i = find_entity( i, classname, "hostage_entity" ) ) )
       {
           RemoveEntity( i )
       }

       return PLUGIN_HANDLED
   }
