Raised This Month: $12 Target: $400
 3% 

Sprint Plugin For CS:CZ


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Doctros
AlliedModders Donor
Join Date: Apr 2011
Location: Chicago ILL. USA
Old 05-22-2016 , 09:24   Sprint Plugin For CS:CZ
Reply With Quote #1

Hello,

I was wondering if anyone could make a plugin for Counter Strike : Condition Zero that could be bound to any key so that when you are running forward and you hit that key it would allow you to run a little faster as long as you hold that key (Key bind and speed amount setting by config file or config settings). I will gladly pay/donate for the plugin!

Thanks!

Last edited by Doctros; 05-22-2016 at 09:30.
Doctros is offline
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
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 05-22-2016 , 16:59   Re: Sprint Plugin For CS:CZ
Reply With Quote #3

add also !is_user_alive(id) , you can't sprint while being dead.
siriusmd99 is offline
JusTGo
Veteran Member
Join Date: Mar 2013
Old 05-22-2016 , 17:12   Re: Sprint Plugin For CS:CZ
Reply With Quote #4

Quote:
Originally Posted by siriusmd99 View Post
add also !is_user_alive(id) , you can't sprint while being dead.
well if you hold the key then when you die and stop pressing it it will not reset your speed and you would have speed for ever on next spawn.
__________________
JusTGo is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 05-22-2016 , 17:17   Re: Sprint Plugin For CS:CZ
Reply With Quote #5

then:

PHP Code:
case '+': if(is_user_alive(id)) is_sprinting[id] = true 
        
case '-':  
        { 
            
is_sprinting[id] = false;
           if(
is_user_alive(id))
            
ExecuteHam(Ham_Player_ResetMaxSpeedid); 
        } 
siriusmd99 is offline
JusTGo
Veteran Member
Join Date: Mar 2013
Old 05-22-2016 , 17:33   Re: Sprint Plugin For CS:CZ
Reply With Quote #6

Quote:
Originally Posted by siriusmd99 View Post
then:

PHP Code:
case '+': if(is_user_alive(id)) is_sprinting[id] = true 
        
case '-':  
        { 
            
is_sprinting[id] = false;
           if(
is_user_alive(id))
            
ExecuteHam(Ham_Player_ResetMaxSpeedid); 
        } 
i think it should be like this or your speed will not reset:
PHP Code:
case '+': if(is_user_alive(id)) is_sprinting[id] = true 
        
case '-':  
        { 
            
is_sprinting[id] = false;
            
ExecuteHam(Ham_Player_ResetMaxSpeedid); 
        } 
__________________
JusTGo is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 05-23-2016 , 00:40   Re: Sprint Plugin For CS:CZ
Reply With Quote #7

speed is reseted itself by the game on new client spawn.
siriusmd99 is offline
Doctros
AlliedModders Donor
Join Date: Apr 2011
Location: Chicago ILL. USA
Old 05-23-2016 , 12:57   Re: Sprint Plugin For CS:CZ
Reply With Quote #8

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.

Last edited by Doctros; 05-23-2016 at 12:57.
Doctros is offline
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
Doctros
AlliedModders Donor
Join Date: Apr 2011
Location: Chicago ILL. USA
Old 05-23-2016 , 20:23   Re: Sprint Plugin For CS:CZ
Reply With Quote #10

Nice! Works GREAT!

Thank You!!!
Doctros is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:18.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode