AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   set user maxspeed (https://forums.alliedmods.net/showthread.php?t=141352)

Tonda 10-23-2010 03:50

set user maxspeed
 
Hi, i have menu. In the menu is TAKE SPEED. After this you have speed better (500.0) But ... if you switch weapon, your speed is normal .. Why? I want speed everytime if you have menu and if your choice SPEED

ConnorMcLeod 10-23-2010 03:52

Re: set user maxspeed
 
Quote:

Originally Posted by Tonda (Post 1332146)
Why?

Reasons are already explained on the forum, search.

SaM.ThE.MaN 10-23-2010 04:23

Re: set user maxspeed
 
yeah ... its already been explained , u have to do it using cur weapon ... use search as connor said

Schwabba 10-23-2010 11:13

Re: set user maxspeed
 
PHP Code:

register_event("CurWeapon""HookCurWeapon""be""1=1" ); 

PHP Code:

public HookCurWeaponid )
{
    if(
iSpeed[id])
    {
        
set_user_maxspeed(id1000.0);
    }



ConnorMcLeod 10-23-2010 12:04

Re: set user maxspeed
 
Quote:

Originally Posted by Schwabba (Post 1332371)
PHP Code:

register_event("CurWeapon""HookCurWeapon""be""1=1" ); 

PHP Code:

public HookCurWeaponid )
{
    if(
iSpeed[id])
    {
        
set_user_maxspeed(id1000.0);
    }



Gonna work but is not the best method, to keep the same maxspeed whatever the weapon, better to hook ResetMaxSpeed.

reinert 10-23-2010 12:44

Re: set user maxspeed
 
Yes, hook ResetMaxSpeed and then set maxspeed with set_pev not set_user_maxspeed

gladius 10-23-2010 12:55

Re: set user maxspeed
 
you can see this

http://forums.alliedmods.net/showpos...2&postcount=11

issen1 10-23-2010 13:22

Re: set user maxspeed
 
Quote:

Originally Posted by reinert (Post 1332428)
Yes, hook ResetMaxSpeed and then set maxspeed with set_pev not set_user_maxspeed

Can you explain why?

ConnorMcLeod 10-23-2010 15:33

Re: set user maxspeed
 
It's quite the same to use set_user_maxspeed.

Here's the snippet.

Check if user is alive so you don't alter spectator speed, and check if maxspeed is not 1.0 so you don't allow players to move during freezetime :

PHP Code:

#include <amxmodx>
#include <engine>
#include <hamsandwich>

#define PLUGIN    "New Plugin"
#define AUTHOR    "Unknown"
#define VERSION    "1.0"

#define Ham_Player_ResetMaxSpeed Ham_Item_PreFrame

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_Player_ResetMaxSpeed,"player","playerResetMaxSpeed",1)
}

public 
playerResetMaxSpeed(id)
{
    if( 
is_user_alive(id) && entity_get_float(idEV_FL_maxspeed) != 1.0 )
    {
        
entity_set_float(idEV_FL_maxspeed1000.0)
    }



Tonda 10-28-2010 04:25

Re: set user maxspeed
 
OK Connor, your method is fine and worked, but if i set maxspeed 700, and player push W (forward) he have speed maybe 400-500? And if he push W+A or W+D (forward+move left(strafe) or forward+move right(strafe) after this he have speed 700, but only forward dont work 700 speed.


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

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