GetPlayerTargetPlayer - Doesn't work with sniper -
Yashas - 18.04.2015
GetPlayerTargetPlayer(playerid)
Doesn't work with sniper no matter how close or far away you are!
Doesn't work even when I am just a unit away from the player.
Re: GetPlayerTargetPlayer - Doesn't work with sniper -
Abagail - 18.04.2015
That's because sniper's don't lock on to the player(and the green target indicator isn't there). This only returns a player if a green target indicating is showing.
Re: GetPlayerTargetPlayer - Doesn't work with sniper -
Pottus - 18.04.2015
Quote:
Originally Posted by Abagail
That's because sniper's don't lock on to the player(and the green target indicator isn't there). This only returns a player if a green target indicating is showing.
|
That is correct this isn't a bug at all.
Re: GetPlayerTargetPlayer - Doesn't work with sniper -
Write - 18.04.2015
It's still a bug if it dosen't work for snipers ph.
Re: GetPlayerTargetPlayer - Doesn't work with sniper -
Pottus - 18.04.2015
Quote:
Originally Posted by Write
It's still a bug if it dosen't work for snipers ph.
|
Sniped players are not targeted therefore this is not a bug at all..... Use a line/sphere intersection function.
Code:
// This checks to see if a line intersects a sphere
stock RaySphere(Float:p1[3],Float:p2[3],Float:sc[3],Float:r)
{
new Float:dist, Float:sdist1, Float:sdist2;
dist = getdist3d(p1[0], p1[1], p1[2], p2[0], p2[1], p2[2]);
sdist1 = getdist3d(sc[0], sc[1], sc[2], p1[0], p1[1], p1[2]);
sdist2 = getdist3d(sc[0], sc[1], sc[2], p2[0], p2[1], p2[2]);
// Make sure player is between the points if so check if the sphere intersects
if(dist > sdist1 && dist > sdist2)
{
new Float:a, Float:b, Float:c, Float:bb4ac, Float:dp[3];
dp[0] = p2[0] - p1[0];
dp[1] = p2[1] - p1[1];
dp[2] = p2[2] - p1[2];
a = dp[0] * dp[0] + dp[1] * dp[1] + dp[2] * dp[2];
b = 2 * (dp[0] * (p1[0] - sc[0]) + dp[1] * (p1[1] - sc[1]) + dp[2] * (p1[2] - sc[2]));
c = sc[0] * sc[0] + sc[1] * sc[1] + sc[2] * sc[2];
c += p1[0] * p1[0] + p1[1] * p1[1] + p1[2] * p1[2];
c -= 2 * (sc[0] * p1[0] + sc[1] * p1[1] + sc[2] * p1[2]);
c -= r * r;
bb4ac = b * b - 4 * a * c;
if(bb4ac < 0) return 0;
return 1;
}
return 0;
}
Re: GetPlayerTargetPlayer - Doesn't work with sniper -
Yashas - 18.04.2015
There is no way one can decide if its a bug or not.
https://sampwiki.blast.hk/wiki/GetPlayerTargetPlayer
If you follow the description of the function then this is a bug.
Quote:
Sniped players are not targeted therefore this is not a bug at all
|
What is targeted and non-targeted?
Re: GetPlayerTargetPlayer - Doesn't work with sniper -
Pottus - 18.04.2015
It's not a bug the PLAYER IS NOT TARGETED! There is no internal mechanism that does this like the the other weapons get it through your head you can't get a targeted player if no player is targeted.
Re: GetPlayerTargetPlayer - Doesn't work with sniper -
Tamer - 18.04.2015
It's not a bug, but is it sad that we can't know if a player is targeting a player with a sniper or not, yes it is!
Although, you can do some vectoral checks and know if the player is targeting a player with their sniper. But this requires checks at the server side, would it be better if we had functions to do it? Yes it would be!
Re: GetPlayerTargetPlayer - Doesn't work with sniper -
arakuta - 19.04.2015
There is a function since 0.3.7 called GetPlayerCameraTargetPlayer
It returns the player that you're
looking at. Give it a try for snipers!
Re: GetPlayerTargetPlayer - Doesn't work with sniper -
Tamer - 19.04.2015
Quote:
Originally Posted by arakuta
There is a function since 0.3.7 called GetPlayerCameraTargetPlayer
It returns the player that you're looking at. Give it a try for snipers!
|
It's range is like 30 units or something, it doesn't work at long distances.
Re: GetPlayerTargetPlayer - Doesn't work with sniper -
Yashas - 21.04.2015
Quote:
Originally Posted by Tamer
It's range is like 30 units or something, it doesn't work at long distances.
|
Doesn't work even if I am 5 units away from the player.
Re: GetPlayerTargetPlayer - Doesn't work with sniper -
Crayder - 21.04.2015
Quote:
Originally Posted by Yashas
Doesn't work even if I am 5 units away from the player.
|
GetPlayerTargetPlayer or GetPlayerCameraTargetPlayer, sniper or no sniper. Explain your procedure.