public plugin_init( ){
register_forward( FM_UpdateClientData, "FM_Hook_UpdateClientData_Post", ._post = 1 );
}
public FM_Hook_UpdateClientData_Post( iPlayer, SendWeapons, CD_Handle ){
enum{
SPEC_MODE,
SPEC_TARGET,
SPEC_END
};
static aSpecInfo[ 33 ][ SPEC_END ];
static Float: flGameTime;
static Float: flLastEventCheck;
static iTarget;
static iSpecMode;
static iActiveItem;
static iId;
iTarget = (iSpecMode = get_entvar(iPlayer, var_iuser1)) ? get_entvar(iPlayer, var_iuser2) : iPlayer;
iActiveItem = get_member(iTarget, m_pActiveItem);
if(iActiveItem == NULLENT) return FMRES_IGNORED;
iId = get_member(iActiveItem, m_iId);
flGameTime = get_gametime();
flLastEventCheck = get_member(iActiveItem, m_flLastEventCheck);
if( iId == CSW_AK47 ){
if( iSpecMode ){
if( aSpecInfo[ iPlayer ][ SPEC_MODE ] != iSpecMode ){
aSpecInfo[ iPlayer ][ SPEC_MODE ] = iSpecMode;
aSpecInfo[ iPlayer ][ SPEC_TARGET ] = 0;
}
if( iSpecMode == OBS_IN_EYE && aSpecInfo[ iPlayer ][ SPEC_TARGET ] != iTarget ){
aSpecInfo[ iPlayer ][ SPEC_TARGET ] = iTarget;
SendWeaponAnim( iPlayer, AK47_DUMMY, g_iCurBody[ iTarget ] );
}
}
if( !flLastEventCheck ){
set_cd( CD_Handle, CD_flNextAttack, flGameTime + 0.001 );
set_cd( CD_Handle, CD_WeaponAnim, AK47_DUMMY );
return FMRES_HANDLED;
}
if( flLastEventCheck <= flGameTime ){
SendWeaponAnim( iTarget, AK47_DRAW, g_iCurBody[ iTarget ] );
set_member( iActiveItem, m_flLastEventCheck, 0.0 );
}
}
return FMRES_IGNORED;
}