-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_plugin( PLUGIN, VERSION, "ConnorMcLeod" );
RegisterHam(Ham_CS_Player_ResetMaxSpeed, "player", "OnCBasePlayer_ResetMaxSpeed_P", true);
register_forward(FM_SetClientMaxspeed, "OnSetClientMaxspeed_P", true);
}
public OnCBasePlayer_ResetMaxSpeed_P( id )
{
if( is_user_alive(id) )
{
new Float:flMaxSpeed;
pev(id, pev_maxspeed, flMaxSpeed);
if( flMaxSpeed > 1.0 ) // maxspeed is 1.0 at freezetime
{
set_pev(id, pev_maxspeed, 400.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(id, Float:flMaxSpeed)
{
if( flMaxSpeed != 1.0 && is_user_alive(id) ) // should never happen considerating previous comment.
{
set_pev(id, pev_maxspeed, 400.0);
}
}
__________________