Raised This Month: $ Target: $400
 0% 

Setting a client's maxspeed permanently and efficiently


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 06-10-2009 , 00:30   Setting a client's maxspeed permanently and efficiently
Reply With Quote #1

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
__________________

Last edited by joaquimandrade; 06-10-2009 at 00:34.
joaquimandrade 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 13:49.


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