How to know where player aiming to another player coordinates?
#1

Hi,

Who can create function, i need to know a coordinates, when you are aiming to another player. It'is like OnPlayerWeaponShoot, fX,fY,fZ coordinates, if in middle 0.0,0.0,0.0 and so on.. But i need when player is aiming not when shoot a bullet to another player.
Reply
#2

Ask if you don't understand something...
Reply
#3

Can you test this? im not sure, since i haven't used GetPlayerCameraFrontVector function before
pawn Код:
stock IsPlayerAming(playerid)
{
    new Float:AX, Float:AY, Float:AZ;
    GetPlayerCameraFrontVector(playerid, AX, AY, AZ);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        new Float:iX, Float:iY, Float:iZ;
        GetPlayerPos(i, iX, iY, iZ);
        if(AX > (iX+5) && AY > (iY+5) && AZ > (iZ+5)) return 1;
    }
    return 0;
}
Reply
#4

For is aiming is function GetPlayerTargetID, i need get coordinates
Reply
#5

I don't really understand; you mean you want to get the player id the player is aiming at? or that player coordinates?
Reply
#6

So if you have such function as GetPlayerTargetID, then you can easily do:
pawn Код:
new Float: pX, Float: pY, Float: pZ;
GetPlayerPos(GetPlayerTargetID(playerid), pX, pY, pZ);
Reply
#7

Man, Use this
https://sampwiki.blast.hk/wiki/GetPlayerTargetPlayer
Reply
#8

I don't need getplayerpos, i need to get a point.

Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
   if( hittype == BULLET_HIT_TYPE_PLAYER && hitid != INVALID_PLAYER_ID )
  {
// And what is fX,fY,fZ it'is a position get with GetPlayerPos ?
}
}
Reply
#9

BUMP
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)