Raised This Month: $ Target: $400
 0% 

Setting a client's maxspeed permanently and efficiently


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-10-2009 , 00:53   Re: Setting a client's maxspeed permanently and efficiently
Reply With Quote #6

For entity id, you do it right.

To set player maxspeed :
PHP Code:
    set_user_maxspeed(idflMaxSpeed
Then to prevent it to change, you have to hook Ham_CS_Item_GetMaxSpeed for every items, then retrieve the owner (either with weapon m_pPlayer offset either with pev_owner) and to supercede it returning a stored by plugin value)
Other solution is to post hook Item_Deploy and to send here set_user_maxspeed.
Last solution is to filter CurWeapon to determinate when a player switch weapon.
Basically something like this should be enough :
PHP Code:
public Event_CurWeapon_Activeid )
{
    new 
iCurWeapon read_data(2)
    if( 
iCurWeapon != g_iCurWeapon[id] )
    {
        
g_iCurWeapon[id] = iCurWeapon
        
new Float:flCustomMaxSpeed g_flCustomMaxSpeed[id]
        if( 
flCustomMaxSpeed != 0.0 )
        {
            
set_user_maxspeed(idflCustomMaxSpeed)
        }
    }

Also, to reset player speed you can use this :
PHP Code:
cs_reset_user_maxspeed(id)
{
    new 
Float:flMaxSpeed;
    switch ( 
get_user_weapon(id) )
    {
        case 
CSW_SG550CSW_AWPCSW_G3SG1 flMaxSpeed 210.0;
        case 
CSW_M249 flMaxSpeed 220.0;
        case 
CSW_AK47 flMaxSpeed 221.0;
        case 
CSW_M3CSW_M4A1 flMaxSpeed 230.0;
        case 
CSW_SG552 flMaxSpeed 235.0;
        case 
CSW_XM1014CSW_AUGCSW_GALILCSW_FAMAS flMaxSpeed 240.0;
        case 
CSW_P90 flMaxSpeed 245.0;
        case 
CSW_SCOUT flMaxSpeed 260.0;
        default : 
flMaxSpeed 250.0;
    }
    
set_user_maxspeed(idflMaxSpeed);

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 06-10-2009 at 01:07.
ConnorMcLeod 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