Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public UpdateClientData(iPlayer, SendWeapons, CD_Handle)
- {
- if(is_user_bot(iPlayer) || !is_user_connected(iPlayer))
- return FMRES_SUPERCEDE;
- 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 id;
- static kGun;
- iTarget = (iSpecMode = pev(iPlayer, pev_iuser1)) ? pev(iPlayer, pev_iuser2) : iPlayer;
- iActiveItem = get_pdata_cbase(iTarget, m_pActiveItem, XO_PLAYER);
- if(iActiveItem == NULLENT)
- return FMRES_IGNORED;
- id = get_pdata_int(iActiveItem, m_iId, XO_WEAPON);
- kGun = get_user_weapon(iTarget, _, _);
- flGameTime = get_gametime();
- flLastEventCheck = get_pdata_float(iActiveItem, m_flLastEventCheck, XO_WEAPON);
- if(id)
- {
- if(iSpecMode)
- {
- if(aSpecInfo[iPlayer][SPEC_MODE] != iSpecMode)
- {
- aSpecInfo[iPlayer][SPEC_MODE] = iSpecMode;
- aSpecInfo[iPlayer][SPEC_TARGET] = FALSE;
- }
- if(iSpecMode == OBS_IN_EYE && aSpecInfo[iPlayer][SPEC_TARGET] != iTarget)
- {
- aSpecInfo[iPlayer][SPEC_TARGET] = iTarget;
- static iTaskData[2];
- iTaskData[0] = iActive[bUsingGuns[iPlayer][kGun]];
- iTaskData[1] = WEAPON_IDLE;
- // Because once pushing LMB u will immediately move to OBS_IN_EYE, the anim message may skip, so let's make delay
- set_task(0.1, "SPEC_OBS_IN_EYE", iPlayer, iTaskData, sizeof(iTaskData)); // Delay 0.1, because with high ping this may skip this 99%
- }
- }
- if(!flLastEventCheck)
- {
- set_cd(CD_Handle, CD_flNextAttack, get_gametime() + 0.001);
- set_cd(CD_Handle, CD_WeaponAnim, IDLE_ANIM);
- return FMRES_HANDLED;
- }
- if(flLastEventCheck <= flGameTime)
- {
- SendWeaponAnim(iTarget, GetWeaponDrawAnim(iActiveItem), iActive[bUsingGuns[iTarget][kGun]]);
- set_pdata_float(iActiveItem, m_flLastEventCheck, 0.0, XO_WEAPON);
- }
- }
- return FMRES_HANDLED;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement