Hello,
I am registering the Ham_CS_Weapon_SendWeaponAnim as a post function, when I am retrieving the player's index using get_pdata_cbase and sending the animation only for spectators, when a player is spectating a CT Player, it is refreshing the animation once to 10 seconds ~, spectating a Terrorist player, seems to working as intended ( refreshing every second ).
Here is the registered function:
PHP Code:
RegisterHam(Ham_CS_Weapon_SendWeaponAnim, "weapon_usp", "Ham_CS_Weapon_SendWeaponAnim_Post", 1);
And here is the function:
PHP Code:
public Ham_CS_Weapon_SendWeaponAnim_Post(iEnt, iAnim, Skiplocal)
{
if(pev_valid(iEnt) != 2)
return HAM_IGNORED;
new iPlayer, weapon;
// OFFSET_WEAPONOWNER 41
// XO_WEAPON 4
iPlayer = get_pdata_cbase(iEnt, OFFSET_WEAPONOWNER, XO_WEAPON);
if(!is_user_alive(iPlayer)) return HAM_IGNORED;
client_print(get_user_index("Adi"), print_chat, "iPlayer: %d", iPlayer)
client_print(get_user_index("Adi"), print_chat, "mWFCiKpHoelOqyWXDkqQcdWKTigEmGl's index: %d", get_user_index("mWFCiKpHoelOqyWXDkqQcdWKTigEmGl"))
return HAM_IGNORED;
}
Screenshot:
http://prntscr.com/1296hlq ( Player mWFCiKpHoelOqyWXDkqQcdWKTigEmGl is CT and player with index 6 is Terrorist )
__________________