Raised This Month: $ Target: $400
 0% 

how do you set faster speed?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
proffs
Senior Member
Join Date: Jul 2013
Old 08-17-2013 , 15:01   how do you set faster speed?
Reply With Quote #1

How can you make that only Ts can run faster?
proffs is offline
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 08-17-2013 , 15:51   Re: how do you set faster speed?
Reply With Quote #2

if you know how you can set all players' speed, you can do that with the exact same way. This time you will need to check players' team with if statement.

Last edited by akcaliberg; 08-17-2013 at 15:52.
akcaliberg is offline
Firippu
Senior Member
Join Date: Jan 2007
Old 08-17-2013 , 15:52   Re: how do you set faster speed?
Reply With Quote #3

Quote:
Originally Posted by proffs View Post
How can you make that only Ts can run faster?
Always? No special condition? Best method is probably hooking player spawn with ham, then check if the player's team is Terrorist with cs_get_user_team(), if so then set a new and higher maximum speed with set_user_maxspeed().

Normal maximum speed is 250.

example
PHP Code:
#define MAX_SPEED 300.0

RegisterHam(Ham_Spawn,"player","fwdPlayerSpawn",1)

public 
fwdPlayerSpawn(id) {
    if(
cs_get_user_team(id)==CS_TEAM_T) {
        
set_user_maxspeed(id,MAX_SPEED)
    }

__________________

Last edited by Firippu; 08-17-2013 at 16:33.
Firippu is offline
proffs
Senior Member
Join Date: Jul 2013
Old 08-17-2013 , 16:38   Re: how do you set faster speed?
Reply With Quote #4

Alright.
So this should work only for Ts?

PHP Code:
else if (cs_get_user_team(id) == CS_TEAM_T)
        {
            
set_user_maxspeed(id400

And for reset
PHP Code:
set_user_maxspeed(id
?

Last edited by proffs; 08-17-2013 at 16:50.
proffs is offline
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 08-17-2013 , 16:55   Re: how do you set faster speed?
Reply With Quote #5

Set_user_maxspeed sets they speed for the current weapon
So i recomend to set speed in curweapon or ham deploy
__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
Firippu
Senior Member
Join Date: Jan 2007
Old 08-17-2013 , 17:06   Re: how do you set faster speed?
Reply With Quote #6

@ironskillz1, yes, i forgot about that. if you switch weapons, it'll reset your speed.

something similar to this will have to be added to the code:
PHP Code:
register_event("CurWeapon","speedb","be","1=1")

public 
speedb(id) {
    if(
cs_get_user_team(id)==CS_TEAM_T) {
        
set_user_maxspeed(id,MAX_SPEED)
    }

__________________
Firippu is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-18-2013 , 05:50   Re: how do you set faster speed?
Reply With Quote #7

-Set maxspeed at spawn is an incorrect method as maxspeed is changed and few occasions such as : weapon change, [un]zoom, [en/dis]able shield, plant bomb, ...

Hook CurWeapon or weapon deploy is not reliable enough since it won't catch all maxspeed changes.


Here is correct way :

First, make sure that you are running update hamsandwich version, you can DL it there : https://forums.alliedmods.net/showpo...9&postcount=34
( If DL link has been removed, it means that the module has been integrated in default amxmodx package, may be for amxx 1.8.3)


Then use this code :

PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >

#pragma semicolon 1

#define PLUGIN "Constant 400 MaxSpeed"
#define VERSION "0.0.1"

#define cm(%0)    ( sizeof(%0) - 1 )

public plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" );

    
RegisterHam(Ham_CS_Player_ResetMaxSpeed"player""OnCBasePlayer_ResetMaxSpeed_P"true);
    
register_forward(FM_SetClientMaxspeed"OnSetClientMaxspeed_P"true);
}

public 
OnCBasePlayer_ResetMaxSpeed_Pid )
{
    if( 
is_user_alive(id) )
    {
        new 
Float:flMaxSpeed;
        
pev(idpev_maxspeedflMaxSpeed);
        if( 
flMaxSpeed 1.0 // maxspeed is 1.0 at freezetime
        
{
            
set_pev(idpev_maxspeed400.0);
        }
    }
}

// this is only (or mainly ?) used on bomb planting and bomb defusing to block player from moving with SetClientMaxspeed(id, 1.0)
public OnSetClientMaxspeed_P(idFloat:flMaxSpeed)
{
    if( 
flMaxSpeed != 1.0 && is_user_alive(id) ) // should never happen considerating previous comment.
    
{
        
set_pev(idpev_maxspeed400.0);
    }

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
proffs
Senior Member
Join Date: Jul 2013
Old 08-18-2013 , 06:11   Re: how do you set faster speed?
Reply With Quote #8

Quote:
Originally Posted by ConnorMcLeod View Post
-Set maxspeed at spawn is an incorrect method as maxspeed is changed and few occasions such as : weapon change, [un]zoom, [en/dis]able shield, plant bomb, ...

Hook CurWeapon or weapon deploy is not reliable enough since it won't catch all maxspeed changes.


Here is correct way :

First, make sure that you are running update hamsandwich version, you can DL it there : https://forums.alliedmods.net/showpo...9&postcount=34
( If DL link has been removed, it means that the module has been integrated in default amxmodx package, may be for amxx 1.8.3)


Then use this code :

PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >

#pragma semicolon 1

#define PLUGIN "Constant 400 MaxSpeed"
#define VERSION "0.0.1"

#define cm(%0)    ( sizeof(%0) - 1 )

public plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" );

    
RegisterHam(Ham_CS_Player_ResetMaxSpeed"player""OnCBasePlayer_ResetMaxSpeed_P"true);
    
register_forward(FM_SetClientMaxspeed"OnSetClientMaxspeed_P"true);
}

public 
OnCBasePlayer_ResetMaxSpeed_Pid )
{
    if( 
is_user_alive(id) )
    {
        new 
Float:flMaxSpeed;
        
pev(idpev_maxspeedflMaxSpeed);
        if( 
flMaxSpeed 1.0 // maxspeed is 1.0 at freezetime
        
{
            
set_pev(idpev_maxspeed400.0);
        }
    }
}

// this is only (or mainly ?) used on bomb planting and bomb defusing to block player from moving with SetClientMaxspeed(id, 1.0)
public OnSetClientMaxspeed_P(idFloat:flMaxSpeed)
{
    if( 
flMaxSpeed != 1.0 && is_user_alive(id) ) // should never happen considerating previous comment.
    
{
        
set_pev(idpev_maxspeed400.0);
    }

So i only need this:

PHP Code:
#include < fakemeta >
#include < hamsandwich >

#pragma semicolon 1 

PHP Code:
public OnSetClientMaxspeed_P(idFloat:flMaxSpeed)
{
    if( 
flMaxSpeed != 1.0 && is_user_alive(id) ) // should never happen considerating previous comment.
    
{
        
set_pev(idpev_maxspeed400.0);
    }

PHP Code:
register_forward(FM_SetClientMaxspeed"OnSetClientMaxspeed_P"true); 
proffs is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-18-2013 , 06:26   Re: how do you set faster speed?
Reply With Quote #9

Are you stupid or are you pulling my leg ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
proffs
Senior Member
Join Date: Jul 2013
Old 08-18-2013 , 06:31   Re: how do you set faster speed?
Reply With Quote #10

Quote:
Originally Posted by ConnorMcLeod View Post
Are you stupid or are you pulling my leg ?
I will use it for another plugin.
Well i only need that right?
proffs is offline
Reply



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 15:52.


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