untested:
bind key +sprint
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fun>
#define PLUGIN "Sprint"
#define VERSION "1.0"
#define AUTHOR "JustGo"
#define SPRINT_SPEED 300.0
#define MAX_PLAYERS 32
#define Ham_Player_ResetMaxSpeed Ham_Item_PreFrame
new bool:is_sprinting[MAX_PLAYERS+1]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("+sprint", "sprint_handler")
register_clcmd("-sprint", "sprint_handler")
RegisterHam(Ham_Player_ResetMaxSpeed,"player","ham_player_resetmaxspeed",1);
}
public sprint_handler(id, level, cid)
{
if(!is_user_connected(id))
return PLUGIN_HANDLED
static cmd[2]
read_argv(0, cmd, 1)
switch(cmd[0])
{
case '+': is_sprinting[id] = true
case '-':
{
is_sprinting[id] = false
ExecuteHam(Ham_Player_ResetMaxSpeed, id);
}
}
return PLUGIN_HANDLED
}
// movement speed is changed
public ham_player_resetmaxspeed(id)
{
if(is_sprinting[id])
{
set_user_maxspeed(id, SPRINT_SPEED);
}
return HAM_IGNORED;
}
__________________