View Single Post
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 06-20-2009 , 21:41   Re: Setting a client's maxspeed permanently and efficiently
Reply With Quote #11

Just to say one more thing:

in hamsandwich the offsets are relative to the hooked class. So the offset can be mixed for entities. Since the ResetMaxSpeed is 69 we can use another offset with the same value supposed to be used for another entity. It's not a good practice to do this but is better than nothing:

PHP Code:
new Ham:Ham_Player_ResetMaxSpeed Ham_Item_PreFrame 
Example:

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

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

new Ham:Ham_Player_ResetMaxSpeed Ham_Item_PreFrame

new maxSpeedFactorCvar 

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_Player_ResetMaxSpeed,"player","playerResetMaxSpeed",1)
    
    
maxSpeedFactorCvar register_cvar("maxspeed_factor","50.0")
}

public 
playerResetMaxSpeed(id)
{
    static 
Float:maxspeed
    pev
(id,pev_maxspeed,maxspeed)
    
    if(
maxspeed != 1.0)
    {
        
set_pev(id,pev_maxspeed,maxspeed get_pcvar_float(maxSpeedFactorCvar))
    }

__________________

Last edited by joaquimandrade; 06-20-2009 at 22:08.
joaquimandrade is offline