
   // AMX Mod script.
   //
   // (c) Copyright 2003, Vince1
   // This file is provided as is (no warranties).
   //
   // This will kill anyone alive by the force of gravity, except
   // those that are immune.
   //
   // Usage: amx_gravity_crush
   //
   #include <amxmod>
   #include <amxmisc>
   #define NEG_GRAV                -50.0
   #define CRUSH_GRAV       999999999.0
   #define DELAY                    1.0
   #define RISE_TIME                3.0
   #define FALL_TIME                4.0
   #define SMALL_JUMP              15
   new Float:old_grav          // to remember old grav setting
   new bool:is_in_progress     // to know if there is a crush in progress
   new  thePlayers[32],  nb      //  to  remember which players are being
   crushed
   public grav_crush(id,level,cid)
   {
       // check access rights
       if (!cmd_access(id,level,cid,1))
           return PLUGIN_HANDLED
       // check if there is already a crush
       if (is_in_progress)
       {
           console_print(id,"There is already a crush in progress.")
           return PLUGIN_HANDLED
       }
       // send hud warning
       is_in_progress = true
       show_hudmessage(0, "Now, you will all be crushed !")
       // support for amx_show_activity
       switch (get_cvar_num("amx_show_activity"))
       {
       case 1 :
           client_print(0,  print_chat,  "ADMIN  has  launched  a gravity
   crush !")
       case 2 :
           {
               new name[32]
               get_user_name(id, name, 31)
               client_print(0,  print_chat,  "ADMIN  %s  has  launched  a
   gravity crush !", name)
           }
       }
       // set all tasks
       set_task(DELAY, "begin_jump")
       set_task(DELAY + RISE_TIME, "reverse_grav")
       set_task(DELAY + FALL_TIME, "restore_grav")
       return PLUGIN_HANDLED
   }
   public begin_jump()
   {
       // change gravity
       old_grav = get_cvar_float("sv_gravity")
       set_cvar_float("sv_gravity", NEG_GRAV)
       // make all alive players jump
       get_players(thePlayers,nb,"a")
       new origin[3]
       for(new i=0; i<nb; ++i)
       {
           get_user_origin(thePlayers[i], origin)
           origin[2] += SMALL_JUMP
           set_user_origin(thePlayers[i], origin)
       }

       return PLUGIN_HANDLED
   }
   public reverse_grav()
   {
       // reverse gravity
       set_cvar_float("sv_gravity", CRUSH_GRAV)
       // set all immune alive players in godmode
       get_players(thePlayers,nb,"a")
       for(new i=0; i<nb; ++i)
           if (get_user_flags(thePlayers[i])&ADMIN_IMMUNITY)
               set_user_godmode(thePlayers[i],1)
       return PLUGIN_HANDLED
   }
   public restore_grav()
   {
       // restore gravity
       set_cvar_float("sv_gravity", old_grav)
       // remove godmode for everyone
       get_players(thePlayers,nb)
       for(new i=0; i<nb; ++i)
           if (get_user_godmode(thePlayers[i]))
               set_user_godmode(thePlayers[i])
       is_in_progress = false
       return PLUGIN_HANDLED
   }
   public plugin_init()
   {
       register_plugin("Gravity Crush","0.9.3","Vince1")
       register_concmd("amx_gravity_crush","grav_crush",ADMIN_SLAY)
       is_in_progress = false
       return PLUGIN_CONTINUE
   }
