Player aiming at oher player?
#1



I want to check if player is pressing some key when he's aiming at other player like that(photo). I've seen this in one server, but I don't know how to do it, is there callback or something?
Reply
#2

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    new targetid = GetPlayerTargetPlayer(playerid);

    if (targetid != INVALID_PLAYER_ID)
    {
        // Perform a key check here.
    }
}
Reply
#3

PHP код:
public OnPlayerUpdate(playerid) {
    new 
targetplayer GetPlayerTargetPlayer(playerid);
    if(
GetPlayerTeam(targetplayer) == GetPlayerTeam(playerid) && targetplayer != INVALID_PLAYER_ID)
    {
        
GameTextForPlayer(playerid"~R~do not shoot at team-mates!"50003);
    }

Source: https://sampwiki.blast.hk/wiki/GetPlayerTargetPlayer

Second Source for actors: https://sampwiki.blast.hk/wiki/GetPlayerTargetActor
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)