
   // AMX_GLUE
   // by {HOJ} Batman
   // email johnbroderick@sbcglobal.net
   //  Glue  Players Down Until At Their Original Spawn - So you can help
   someone etc.
   // Uses set_origin instead of setting user_maxspeed since
   // CS & mods reset the speed on the change of a weapon
   // CVAR what level admin do you need
   // amx_glue "a" would mean only "a" could access...
   /*
   Usage:
   amx_glue <CT|T|ALL|(match pattern)>
   amx_unglue <CT|T|ALL|(match pattern)>
   CVARS:
   amx_glue_access b  (set what admin flags can access this command)
   You  could change the access on the fly - now that's a cool highlander
   approach if this was done by all plugins and regulated somehow...
   i.e.
   amx_glue all
   amx_unglue me
   amx_unglue dumbassthatneedshelp
   (cool only me and the dumbass can move)
   */
   #include <amxmod.inc>
   #include <fun.inc>
   public gGluePosition[33][3]
   public bool:gIsGlued[33]
   public gGlueCount=0
   //--------------------------------------------------------------------
   ---------
   public plugin_init()
   {
       register_plugin("amx_glue","1.01","{HOJ} Batman")
       register_event("ResetHUD","newRound","b")
       if ( !cvar_exists("amx_glue_access") )
   register_cvar("amx_glue_access", "b")
       new accessLevel[10]
       get_cvar_string("amx_glue_access", accessLevel, 9)
       register_concmd("amx_glue","adminGlue",read_flags(accessLevel),"am
   x_glue <any tag|part of nick|CT|T|ALL>")
       register_concmd("amx_unglue","adminUnglue",read_flags(accessLevel)
   ,"amx_unglue <any tag|part of nick|CT|T|ALL>")
       set_task(0.25,"glueCheck", 0, "", 0, "b")

       return PLUGIN_CONTINUE
   }
   //--------------------------------------------------------------------
   ---------
   public releaseGlue(id)
   {
     if ( gIsGlued[id] )
     {
       gGlueCount--
       gIsGlued[id]=false
     }
   }
   //--------------------------------------------------------------------
   ---------
   public client_disconnect(id)
   {
     releaseGlue(id)
   }
   //--------------------------------------------------------------------
   ---------
   public newRound(id)
   {
     // Unglue everyone...
     releaseGlue(id)

     new parm[1]
     parm[0]=id
     set_task(1.0,"originCapture", 0, parm, 1)
   }
   //--------------------------------------------------------------------
   ---------
   public originCapture(parm[])
   {
     new id=parm[0]
     get_user_origin( id, gGluePosition[id] )
   }
   //--------------------------------------------------------------------
   ---------
   public setGlue( who[], bool:glue )
   {
     new i, players[32], id

     //OK Who to Glue
     if ( equali(who,"CT") ) get_players(players, i, "ae", "CT")
     else if ( equali(who,"T") ) get_players(players, i, "ae", "T")
     else if ( equali(who,"ALL") ) get_players(players, i, "a", "")
     else get_players(players, i, "af", who )

     for ( new x=0; x<i; x++ )
     {
       id=players[x]
       if ( glue  && !gIsGlued[id]) gGlueCount++
       if ( !glue && gIsGlued[id] ) gGlueCount--

       gIsGlued[id]=glue
       if ( glue )
         client_print(id,print_center,"You  have  been  glued down by the
   administrator")
       else
         client_print(id,print_center,"You  have been unglued down by the
   administrator")
     }
   }
   //--------------------------------------------------------------------
   ---------
   public adminGlue(id)
   {

     new accessLevel[10]
     get_cvar_string("amx_glue_access", accessLevel, 9)
     if (!(get_user_flags(id) & read_flags(accessLevel) ) )
     {
       client_print(id,print_console,"[AMX]  You  have  no access to that
   command")
       return PLUGIN_HANDLED
     }

     new argc = read_argc()
     if (argc != 2)
     {
       client_print(id,print_console,"[AMX] Usage: amx_glue <any tag|part
   of nick|CT|T|ALL>")
       return PLUGIN_HANDLED
     }
     new whoToGlue[32]
     read_argv(1,whoToGlue,31)
     setGlue( whoToGlue, true )
     return PLUGIN_HANDLED
   }
   //--------------------------------------------------------------------
   ---------
   public adminUnglue(id)
   {
     new accessLevel[10]
     get_cvar_string("amx_glue_access", accessLevel, 9)

     if (!(get_user_flags(id) & read_flags(accessLevel) ) )
     {
       client_print(id,print_center,"[AMX]  You  have  no  access to that
   command")
       return PLUGIN_HANDLED
     }

     new argc = read_argc()
     if (argc != 2)
     {
       client_print(id,print_center,"[AMX]    Usage:    amx_unglue   <any
   tag|part of nick|CT|T|ALL>")
       return PLUGIN_HANDLED
     }
     new whoToGlue[32]
     read_argv(1,whoToGlue,31)
     setGlue( whoToGlue, false )
     return PLUGIN_HANDLED
   }
   //--------------------------------------------------------------------
   ---------
   public glueCheck()
   {
     if ( gGlueCount==0 ) return

     //server_print("GLUE COUNT=%d", gGlueCount)

     for ( new id=1; id<=32; id++)
     {
       if ( gIsGlued[id] && is_user_alive(id) )
       {
          new origin[3]
          get_user_origin(id, origin)

          if    (   origin[0]!=   gGluePosition[id][0]   ||   origin[1]!=
   gGluePosition[id][1] || origin[2]!= gGluePosition[id][2] )
          {
            //  don't  need  to  set  a  player  that's not moving - more
   messages.
            set_user_origin(id, gGluePosition[id] )
          }
        }
     }
   }
   //--------------------------------------------------------------------
   ---------
