Raised This Month: $ Target: $400
 0% 

WeaponSpeed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-07-2013 , 12:04   Re: WeaponSpeed
Reply With Quote #1

gun_speed array is missing a cell
you are using get_pdata_int instead of _cbase for m_pPlayer pdata.

Also, use offsets names, it prevents from making errors and helps a lot for readability.

PHP Code:
const XO_CBASEPLAYERITEM 4;
const 
m_pPlayer 41;
const 
m_iId 43;

new const 
Float:gun_speed[CSW_P90+1] =
{
    
0.0,
    
250.0,    // CSW_P228
    
0.0,
    
260.0,    // CSW_SCOUT
    
250.0,    // CSW_HEGRENADE
    
240.0,    // CSW_XM1014
    
250.0,    // CSW_C4
    
250.0,    // CSW_MAC10
    
240.0,    // CSW_AUG
    
250.0,    // CSW_SMOKEGRENADE
    
250.0,    // CSW_ELITE
    
250.0,    // CSW_FIVESEVEN
    
250.0,    // CSW_UMP45
    
210.0,    // CSW_SG550
    
240.0,    // CSW_GALIL
    
240.0,    // CSW_FAMAS
    
250.0,    // CSW_USP
    
250.0,    // CSW_GLOCK18
    
210.0,    // CSW_AWP
    
250.0,    // CSW_MP5NAVY
    
220.0,    // CSW_M249
    
230.0,    // CSW_M3
    
230.0,    // CSW_M4A1
    
250.0,    // CSW_TMP
    
210.0,    // CSW_G3SG1
    
250.0,    // CSW_FLASHBANG
    
250.0,    // CSW_DEAGLE
    
235.0,    // CSW_SG552
    
221.0,    // CSW_AK47
    
250.0,    // CSW_KNIFE
    
245.0    // CSW_P90
};

new 
Float:L_gun[33][CSW_P90+1]; // use Floats here, it is stupid to float values later...

public Item_GetMaxSpeed(iWeapon)
{
    new 
iId get_pdata_int(iWeaponm_iIdXO_CBASEPLAYERITEM);
    new 
id get_pdata_cbase(iWeaponm_pPlayerXO_CBASEPLAYERITEM);
    if( 
iId && id && get_user_team(id) != )
    {
        
SetHamReturnFloat(gun_speed[iId] + L_gun[id][iId]);
        return 
HAM_SUPERCEDE;
    }
    return 
HAM_IGNORED;
}  

public 
plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" );

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 11-07-2013 at 12:05.
ConnorMcLeod is offline
Reply



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 23:14.


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