Raised This Month: $ Target: $400
 0% 

Setting a client's maxspeed permanently and efficiently


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

Ok. Both of Connor's suggestions work. I'm sticking with:

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

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

new PreviousCurWeaponID[33]
new 
blocked[33]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_clcmd("block","block")
    
register_clcmd("unblock","unblock")
    
    
register_event("CurWeapon","eventCurWeapon""be","1=1")
}

public 
eventCurWeapon(id)
{
    if(
blocked[id])
    {
        new 
curWeapon read_data(2)
        
        if(
curWeapon != PreviousCurWeaponID[id])
        {
            
PreviousCurWeaponID[id] = curWeapon
            engfunc
(EngFunc_SetClientMaxspeed,id,1.0)
        }
    }
}  

public 
block(id)
{
    
blocked[id] = true
    
    engfunc
(EngFunc_SetClientMaxspeed,id,1.0)
    
    return 
PLUGIN_HANDLED
}

public 
unblock(id)
{
    
blocked[id] = false;
    
    
cs_reset_user_maxspeed(id);
        
    return 
PLUGIN_HANDLED;
}


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;
    }
    
    
engfunc(EngFunc_SetClientMaxspeed,id,flMaxSpeed);

Thanks Connor. +karma
__________________
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