Detect if player aiming.
#1

Hi,

How to right check if player aiming? now i'am doing onplayerkeystatechange

Код:
if( PRESSED( KEY_AIM ) )
	{

}
if( RELEASED( KEY_AIM ) )
	{

}
But it'is possible that player press key aim key right mouse button and can cancel a aiming without realising again mouse button?
Reply
#2

pawn Код:
stock IsPlayerAiming(playerid)
{
    new anim = GetPlayerAnimationIndex(playerid);
    if (((anim >= 1160) && (anim <= 1163)) || (anim == 1167) || (anim == 1365) ||
    (anim == 1643) || (anim == 1453) || (anim == 220)) return 1;
    return 0;
}

public OnPlayerUpdate(playerid) // You can put under OnPlayerTakeDamage or others to detect players is aiming
{
        if(IsPlayerAiming(playerid))
        {
                //Your some thing do here
        }
        return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)