
   /*Sprinting Plugin
   Written by {W`C} Bludy
   This plugin allows you to sprint temporarily (run faster than normal)
   This  plugin  is  activated by cvars and is available to anyone on the
   server
   CVARS:
   amx_sprintmode 1 or 0    <---1 is on   0 is off
   amx_sprintspeed  400      <---400  is  default,  this is the amount of
   speed added to the players maximum
   Player Commands:
   amx_sprint      <--- Clients must bind a key to this command to use it
   say /sprinthelp <--- Gives a small description on how to bind a key to
   amx_sprint
   Plugin  Description:  This plugin allows any player to run the command
   amx_sprint which allows the
   user  to  run fast temporarily, Much like in life when you give it all
   you got. You cant really sprint
   in  real  life  when  you have something in your hands (e.g guns - yes
   handguns too because you use 2 hands
   in  this  game) So I made the player automatically switch to his knife
   while sprinting.  There are hud messages
   saying  when  you  use  the  command  when your enery is exhausted and
   recovered.  There is a drawback
   because  I had to make the player switch back to his last inventory in
   order to set the speed back to normal.
   This  can  cause  problems  with gameplay, but once you get used to it
   your timing gets better.
   Known Issues:
   -When  you use the sprint command when the freezetime is counting down
   it allows you to move
   before the counter is finished.
   -When  the player uses the command it will automatically switch to his
   previous weapon when
   his  energy is run out, this can be an inconveinence for gameplay, but
   is there to return
   the  players  speed  back  to normal (for some reason I couldnt set it
   back to normal just by
   using set_user_maxspeed)
   -Other than that Have fun!!
   */
   #include <amxmod>
   new bool:sprinting = false
   new bool:waiting = false
   new pIndex
   public sprint(sprinter,speed)
   {
   engclient_cmd(sprinter,"weapon_knife")
   set_user_maxspeed (sprinter,speed)
   set_hudmessage(255,0,0,0.05,0.85,1,0.01,3.0,0.05,0.01,1)
   show_hudmessage(sprinter,"**Run Like Hell!!**")
   sprinting = true
   //If  you  are  interested in changing sprinting time change the first
   digit after set_task
   //e.g set_task(10.0  <--this number
   //NOTE: This is the number of seconds of the delay
   set_task(5.0,"stop_sprint",1,"",0,"a",0)
   return PLUGIN_CONTINUE
   }
   public user_sprint(id)
   {
   new cvar = get_cvar_num("amx_sprintmode")
   if (cvar == 1)
   {
       if ((sprinting == false) && (waiting == false))
       {
       new Float:speedinc = get_cvar_float("amx_sprintspeed")

       new Float:playerspeed = get_cvar_float("sv_maxspeed")
       new Float:sprintspeed = playerspeed + speedinc
       new name[32]
       get_user_name(id,name,32)
       pIndex = get_user_index(name)

       sprint(pIndex,sprintspeed)
       }
   }
   return PLUGIN_CONTINUE
   }
   public stop_sprint()
   {
   waiting = true
   remove_task(1)
   client_cmd(pIndex,"lastinv")
   client_cmd(pIndex,"lastinv")
   client_cmd(pIndex,"lastinv")
   sprinting = false
   set_hudmessage(255,255,255,0.05,0.85,1,0.01,3.0,0.05,0.01,1)
   show_hudmessage(pIndex,"**Sprinting Energy Depleted**")
   //  If  you  want  to change the energy recovery time change the first
   digit after set_task here
   //NOTE: This is the number of seconds of the delay
   set_task(10.0,"start_wait",2,"",0,"a",0)
   return PLUGIN_CONTINUE
   }
   public start_wait()
   {
   waiting = false
   remove_task(2)
   set_hudmessage(0,255,0,0.05,0.85,1,0.01,3.0,0.05,0.01,1)
   show_hudmessage(pIndex,"**Sprinting Energy Recovered**")
   return PLUGIN_CONTINUE
   }
   public help_motd(id)
   {
   new sprint_motd[1300]
   new temp[768]
   temp = "To sprint you need to bind a key to amx_sprint^n^n\
   - When you use the sprint you will run faster temporarily^n\
   It will switch you to your knife automatically^n\
   When you are done sprinting it will auto-switch^n\
   to your previous weapon. Here is how to bind the key^n^n\"
   add(sprint_motd,1299,temp)
   temp = "1. Open your console with `, choose a key you want^n\
   You can pick most keys on your keyboard^n^n\
   2. Type bind ^"key you want^" ^"amx_sprint^"^n\
   dont forget the double quotes^n^n\
   3. It should look something like this^n\
   bind ^"q^" ^"amx_sprint^"^n\
   of course it will be the key you chose, not just q^n^n\
   4. When that is typed in press enter and the key is bound^n^n\"
   add(sprint_motd,1299,temp)
   temp = "Now you are ready to sprint, Have fun!!!^n^n\
   Written and coded by {W`C} Bludy"
   add(sprint_motd,1299,temp)
   show_motd(id,sprint_motd,"Sprint Run Help:")
   return PLUGIN_CONTINUE
   }
   public plugin_init()
   {
       register_plugin("Sprint Mode","0.9.2","{W`C} Bludy")
       register_clcmd("amx_sprint","user_sprint")
       register_cvar("amx_sprintspeed","400")
       register_cvar("amx_sprintmode","0")
       register_clcmd("say /sprinthelp","help_motd")
       return PLUGIN_CONTINUE
   }
