|
Veteran Member
Join Date: Aug 2009
Location: Virginia
|
10-21-2011
, 17:11
Re: Weapon Max Shot Distance
|
#11
|
Quote:
Originally Posted by ConnorMcLeod
RegisterCVars function doesn't need to be public
g_szWeaponClassnames shouldn't be global, declare it in RegisterCVars function so memory is free when you exit the function.
i < MAX_WEAPON + 1
i <= MAX_WEAPON would make more sense
Little tip :
PHP Code:
formatex( szCVarName, charsmax( szCVarName ), "max_distance_%s", g_szWeaponClassnames[ i ] );
replace( szCVarName, charsmax( szCVarName ), "weapon_", "" );
->
PHP Code:
formatex( szCVarName, charsmax( szCVarName ), "max_distance_%s", g_szWeaponClassnames[ i ][ 7 ] );
PHP Code:
static Float:flAttackerOrigin[ 3 ];
static Float:flVictimOrigin[ 3 ];
Static is not needed at all there.
Code:
if( !g_pWeaponCVARs[ iWeapon ] ) return HAM_IGNORED;
new iMaxDistance = get_pcvar_num( g_pWeaponCVARs[ iWeapon ] );
You read 2 times the same array, would be better to cache pointer result.
DMG_HEGRENADE check is useless, it will never happen.
|
Fixed.
__________________
Quote:
Originally Posted by DarkGod
nikhilgupta generates his plugins using sheer awesome.
|
If you like my work, please
|
|
|
|