SA-MP Forums Archive
how to detect if a player aiming a npc - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: how to detect if a player aiming a npc (/showthread.php?tid=660740)



how to detect if a player aiming a npc - 3417512908 - 12.11.2018

it's possible?


Re: how to detect if a player aiming a npc - ReD_HunTeR - 12.11.2018

yes
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_AIM) //When player aims
    {
        new targetplayer = GetPlayerTargetPlayer(playerid); //this functions helps us to find out that if player is aiming other player or NPC
        if(IsPlayerNPC(targetplayer)) //if target player is npc
        {
            //Blabla
        }
    }
    return 1;
}