Raised This Month: $ Target: $400
 0% 

how do you set faster speed?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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