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(iWeapon, m_iId, XO_CBASEPLAYERITEM);
new id = get_pdata_cbase(iWeapon, m_pPlayer, XO_CBASEPLAYERITEM);
if( iId && id > 0 && get_user_team(id) != 1 )
{
SetHamReturnFloat(gun_speed[iId] + L_gun[id][iId]);
return HAM_SUPERCEDE;
}
return HAM_IGNORED;
}
public plugin_init()
{
register_plugin( PLUGIN, VERSION, "ConnorMcLeod" );
}
__________________