AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to change players' speed? (https://forums.alliedmods.net/showthread.php?t=205626)

ghostpro1991 01-12-2013 15:30

How to change players' speed?
 
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 :oops:

Bos93 01-12-2013 16:15

Re: How to change players' speed?
 
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;



ghostpro1991 01-12-2013 20:52

Re: How to change players' speed?
 
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.

guipatinador 01-12-2013 21:36

Re: How to change players' speed?
 
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

DSASDFGH 01-13-2013 08:44

Re: How to change players' speed?
 
Quote:

Originally Posted by ghostpro1991 (Post 1872515)
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"


ghostpro1991 01-14-2013 12:35

Re: How to change players' speed?
 
Thanks, it worked.


All times are GMT -4. The time now is 13:22.

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