AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Movement (https://forums.alliedmods.net/showthread.php?t=131536)

zombieplague 07-06-2010 06:22

Movement
 
What is the proper way of setting a player speed ? Currently, I'm using Prethink I wonder if it will lag using that ??

shuttle_wave 07-06-2010 06:34

Re: Movement
 
Quote:

Originally Posted by zombieplague (Post 1229692)
What is the proper way of setting a player speed ? Currently, I'm using Prethink I wonder if it will lag using that ??

use cur weapon

zombieplague 07-06-2010 10:31

Re: Movement
 
Quote:

Originally Posted by shuttle_wave (Post 1229695)
use cur weapon

Can you show me how ?

drekes 07-06-2010 11:40

Re: Movement
 
PHP Code:

#include <amxmodx>
#include <fun>

#pragma semicolon 1

new cvar_speed;

public 
plugin_init()
{
    
register_plugin("Speed example""1.0""Drekes");
    
    
register_event("CurWeapon""Event_CurWeapon""be","1=1");
    
    
cvar_speed register_cvar("amx_runspeed""400.0");
}

public 
Event_CurWeapon(id)
{
    if(
is_user_alive(id))
        
set_user_maxspeed(idget_pcvar_float(cvar_speed));


Not tested, but should work

Lure.d 07-06-2010 12:50

Re: Movement
 
PHP Code:

public Event_CurWeapon(id)
{
    if(
is_user_alive(id))
        
set_user_maxspeed(idget_pcvar_float(cvar_speed));


:arrow:

PHP Code:

public Event_CurWeaponclient )
{
    if( 
get_cvar_float"sv_maxspeed" ) > get_pcvar_floatcvar_speed ) )
        
set_cvar_float"sv_maxspeed"cvar_speed );
    
    if( 
is_user_aliveclient ) )
        
set_user_maxspeedclientget_pcvar_floatcvar_speed ) );


Remember, if maxspeed is lower than the speed you set up - player will remain at speed of sv_maxspeed ;)

drekes 07-06-2010 12:55

Re: Movement
 
Quote:

Originally Posted by Lure.d (Post 1229957)
PHP Code:

public Event_CurWeapon(id)
{
    if(
is_user_alive(id))
        
set_user_maxspeed(idget_pcvar_float(cvar_speed));


:arrow:

PHP Code:

public Event_CurWeaponclient )
{
    if( 
get_cvar_float"sv_maxspeed" ) > get_pcvar_floatcvar_speed ) )
        
set_cvar_float"sv_maxspeed"cvar_speed );
    
    if( 
is_user_aliveclient ) )
        
set_user_maxspeedclientget_pcvar_floatcvar_speed ) );


Remember, if maxspeed is lower than the speed you set up - player will remain at speed of sv_maxspeed ;)

I didn't know that, thanks for fixing it

DarkGod 07-06-2010 13:44

Re: Movement
 
If you only want it for a specific weapon, you're better of using Ham_Item_Deploy.

zombieplague 07-07-2010 03:13

Re: Movement
 
Can't i use Prethink ?

Mini_Midget 07-07-2010 03:26

Re: Movement
 
No one said you can't.
It's just that PreThink is called 30 times a second or something like that.


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

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