I'm trying to reach the best method of setting a client's maxspeed without hooking a "constant forward". To
1.0 (to block him)
I don't like to hook events (but it's still better than ClientCmdStart or PreThink) so, I tried to use ham hooks and also to hook FM_SetClientMaxspeed but, that didn't work so, i'm sticking with something like:
PHP Code:
register_event("CurWeapon","eventCurWeapon", "be","1=1")
...
public block(id)
{
blocked[id] = true
engfunc(EngFunc_SetClientMaxspeed,id,1.0)
return PLUGIN_HANDLED
}
public eventCurWeapon(id)
{
if(blocked[id])
{
engfunc(EngFunc_SetClientMaxspeed,id,1.0)
}
}
It works and since I don't care about the resetting on round starts it's ok.
Now I want to be able to reset the maxspeed accordingly to the carrier's weapon.
I tried executing Ham_CS_Item_GetMaxSpeed but it returns 0.0 for the weapons I tested.
So my questions are:
Do you have a better way to handle the setting situation?
There is a way of getting the maxspeed related to a weapon without having it in the code?
___
A funny thing that happened to me during this process was that I tried Ham_CS_Item_GetMaxSpeed passing it a player, like:
PHP Code:
ExecuteHam(Ham_CS_Item_GetMaxSpeed,id,maxspeed)
And this spawned from my body:
[IMG]http://img195.**************/img195/3701/deinferno0007c.th.jpg[/IMG]
So I guess that the offset that hamsandwich is using for Ham_CS_Item_GetMaxSpeed is instead for another function
__________________