View Single Post
JusTGo
Veteran Member
Join Date: Mar 2013
Old 05-22-2016 , 10:12   Re: Sprint Plugin For CS:CZ
Reply With Quote #2

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(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 
'+'is_sprinting[id] = true
        
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;

__________________

Last edited by JusTGo; 05-22-2016 at 10:17.
JusTGo is offline