View Single Post
JusTGo
Veteran Member
Join Date: Mar 2013
Old 05-23-2016 , 15:33   Re: Sprint Plugin For CS:CZ
Reply With Quote #9

Quote:
Originally Posted by Doctros View Post
Thanks Guy's the plugin loads and I have bound my key but it does not do anything. Also there is no cvar to adjust speed.
try this one:
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(PLUGINVERSIONAUTHOR)
    
register_clcmd("+sprint""sprint_handler")
    
register_clcmd("-sprint""sprint_handler")
    
RegisterHam(Ham_Player_ResetMaxSpeed,"player","ham_player_resetmaxspeed",1);
}

public 
sprint_handler(idlevelcid)
{
    
    if(!
is_user_connected(id))
        return 
PLUGIN_HANDLED
    
    
static cmd[2]
    
read_argv(0cmd1)
    
    switch(
cmd[0])
    {
        case 
'+'
        {
            if(
is_user_alive(id))
            {
                
is_sprinting[id] = true
                set_user_maxspeed
(idSPRINT_SPEED);
            }
        }
        case 
'-'
        {
            
is_sprinting[id] = false
            ExecuteHam
(Ham_Player_ResetMaxSpeedid);
        }
    }
    return 
PLUGIN_HANDLED
}

// movement speed is changed
public ham_player_resetmaxspeed(id)
{
    if(
is_sprinting[id])
    {
        
set_user_maxspeed(idSPRINT_SPEED);
    }
    return 
HAM_IGNORED;

i didn't add a cvar for speed yet for now you can change speed by changin the define and recompile again:
PHP Code:
#define SPRINT_SPEED 300.0 
__________________

Last edited by JusTGo; 05-23-2016 at 15:34.
JusTGo is offline