PlayerToPlayerDistance - 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: PlayerToPlayerDistance (
/showthread.php?tid=313956)
PlayerToPlayerDistance -
Ballu Miaa - 28.01.2012
Hello everyone,
I wanted to make up a function with which i can calculate distance between two Players? Like there is a SAMP function Called GetPlayerDistanceFromPoint but its for getting distance from a point to the playerid but not between two players?
If you have function which has that , callback , include , FS or anything which can do it. Please post it over here. Or if you can make me a stock or a custom function for that , will be fucking awesome!
Thanks
Ballu Miaa
Re: PlayerToPlayerDistance -
Ballu Miaa - 28.01.2012
PS :
I think there is no given function to get the Distance between two player's at the moment? or is it?
If not someone please code me a custom function/stock if you can! Thanks alot
Re: PlayerToPlayerDistance -
Joe Staff - 28.01.2012
pawn Код:
stock IsPlayerNearPlayer(playerid,nearplayerid,Float:distance)
{
new Float:x,Float:y,Float:z;
GetPlayerPos(nearplayerid,x,y,z);
return IsPlayerInRangeOfPoint(playerid,distance,x,y,z);
}
stock Float:GetPlayerDistanceToPlayer(playerid,nearplayerid)
{
new Float:x,Float:y,Float:z;
GetPlayerPos(nearplayerid,x,y,z);
return GetPlayerDistanceFromPoint(playerid,x,y,z);
}
Re: PlayerToPlayerDistance -
Ballu Miaa - 28.01.2012
Quote:
Originally Posted by Joe Staff
pawn Код:
stock IsPlayerNearPlayer(playerid,nearplayerid,Float:distance) { new Float:x,Float:y,Float:z; GetPlayerPos(nearplayerid,x,y,z); return IsPlayerInRangeOfPoint(playerid,distance,x,y,z); } stock Float:GetPlayerDistanceToPlayer(playerid,nearplayerid) { new Float:x,Float:y,Float:z; GetPlayerPos(nearplayerid,x,y,z); return GetPlayerDistanceFromPoint(playerid,x,y,z); }
|
Awesome! Thanks alot. Im sure it will work!