Raised This Month: $ Target: $400
 0% 

How to change players' speed?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ghostpro1991
Member
Join Date: Aug 2011
Old 01-12-2013 , 15:30   How to change players' speed?
Reply With Quote #1

At first I used "set_user_maxspeed", of cource it doesn't work. Then I searched and used "CurWeapon", but the players even cannot move.
So how to change players movement speed? Please give me an example
ghostpro1991 is offline
Bos93
Veteran Member
Join Date: Jul 2010
Old 01-12-2013 , 16:15   Re: How to change players' speed?
Reply With Quote #2

http://www.amxmodx.org/doc/index.htm...r_maxspeed.htm

+ block Ham_CS_Player_ResetMaxSpeed

not to return to the default speed

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

new g_iSpeed;

public 
plugin_init( )
{
    
register_clcmd("say /speed""CCommand__Speed");

    
RegisterHamHam_CS_Player_ResetMaxSpeed"player""CBasePlayer__ResetMaxSpeed_Pre", .Post false );
}

public 
CCommand__SpeedpPlayer )
{    
    
g_iSpeed = !g_iSpeed;

    
set_user_maxspeedpPlayer 600.0 );
}
    
public 
CBasePlayer__ResetMaxSpeed_PrepPlayer )
{
    return ( 
g_iSpeed ) ? HAM_SUPERCEDE HAM_IGNORED;

__________________

Last edited by Bos93; 01-12-2013 at 16:24.
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
ghostpro1991
Member
Join Date: Aug 2011
Old 01-12-2013 , 20:52   Re: How to change players' speed?
Reply With Quote #3

What is it used for?
PHP Code:
g_iSpeed = !g_iSpeed
and this?
PHP Code:
return ( g_iSpeed ) ? HAM_SUPERCEDE HAM_IGNORED
Edit: I can't compile it.

Last edited by ghostpro1991; 01-12-2013 at 21:19.
ghostpro1991 is offline
guipatinador
SourceMod Donner Party
Join Date: Oct 2009
Location: Poortugal
Old 01-12-2013 , 21:36   Re: How to change players' speed?
Reply With Quote #4

If the player have speed, it will return HAM_SUPERCEDE. If don't have, it will return HAM_IGNORED

You forgot to add this,

Code:
#define Ham_CS_Player_ResetMaxSpeed Ham_Item_PreFrame

Don't know if that code will work. Take a look at this https://forums.alliedmods.net/showpo...6&postcount=10

Last edited by guipatinador; 01-12-2013 at 21:44.
guipatinador is offline
DSASDFGH
Senior Member
Join Date: Jul 2011
Location: Facebook
Old 01-13-2013 , 08:44   Re: How to change players' speed?
Reply With Quote #5

Quote:
Originally Posted by ghostpro1991 View Post
What is it used for?
PHP Code:
g_iSpeed = !g_iSpeed
and this?
PHP Code:
return ( g_iSpeed ) ? HAM_SUPERCEDE HAM_IGNORED
Edit: I can't compile it.
PHP Code:
g_iSpeed = !g_iSpeed
This meaning reverse the variable setting,
When g_iSpeed = true and you try g_iSpeed = !g_iSpeed, g_iSpeed will be false,
false -> true
true -> false

PHP Code:
return ( g_iSpeed ) ? HAM_SUPERCEDE HAM_IGNORED
variable ? if the variable has true : if the variable has false
Example:
PHP Code:
client_print(idprint_chat"Now i am %s"is_user_alive(id)? "Alive" "Dead"
__________________
Learning SourceMod is happy
DSASDFGH is offline
ghostpro1991
Member
Join Date: Aug 2011
Old 01-14-2013 , 12:35   Re: How to change players' speed?
Reply With Quote #6

Thanks, it worked.
ghostpro1991 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 13:22.


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