Hi, I have problem with gait sequence when the player activity is 28 (ACT_ATTACK) but if the player activity is 3 (ACT_IDLE) the gait sequence works fine. I've tried to replace the player activity with idle activity but it blocks the sequence.
The detail video is:
http://youtu.be/jIDXilZxRss
Code:
PHP Code:
HamRegister(Ham_Weapon_PrimaryAttack, "weapon_knife", "OnCBase_KnifeAttack");
OrpheuRegisterHook(OrpheuGetFunction("SetAnimation", "CBasePlayer"), "Orpheu_SetAnimation", OrpheuHookPost);
PHP Code:
public Ham_Weapon_PrimaryAttack(iEnt)
{
get_pdata_cbase(iEnt, 41, 4);
gSeq[iIndex] = 124;
}
public OrpheuHookReturn:Orpheu_SetAnimation(iIndex)
{
if (!is_user_alive(iIndex)) return OrpheuIgnored;
new iWpn = get_user_weapon(iIndex);
if (gPlay[iIndex])
{
Set_PlayerSequence(iIndex, gSeq[iIndex]);
return OrpheuSupercede;
}
return OrpheuIgnored;
}
Set_PlayerSequence(iIndex, iSeq)
{
new iGait = Get_GaitSequence(iIndex);
set_pev(iIndex, pev_sequence, iSeq);
set_pev(iIndex, pev_gaitsequence, iGait);
set_pev(iIndex, pev_frame, 1.0);
set_pev(iIndex, pev_framerate, 1.0);
gPlay[iIndex] = 0;
}
Get_GaitSequence(iIndex)
{
new Float:flVelocity[3];
pev(iIndex, pev_velocity, flVelocity);
new iFlags = pev(iIndex, pev_flags);
new Float:flSpeed = vector_length(flVelocity);
new iWaterLevel = pev(iIndex, pev_waterlevel);
new iMoveType = pev(iIndex, pev_movetype);
if(iWaterLevel > 1)
{
if (flSpeed <= 0.1) return 9;
else return 8;
}
else if (iMoveType == MOVETYPE_FLY)
{
if (iFlags & FL_DUCKING) return 2;
else return 1;
}
else if (iFlags & FL_DUCKING)
{
if (flSpeed <= 0.1) return 2;
else if (!(iFlags & FL_ONGROUND)) return 6;
else return 5;
}
else if (!(iFlags & FL_ONGROUND)) return 6;
else if (0.0 < flSpeed < 100.0) return 3;
else if (flSpeed > 100.0) return 4;
return 1;
}
__________________