Custom IsPlayerInRangeOfPoint - 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: Custom IsPlayerInRangeOfPoint (
/showthread.php?tid=545922)
Custom IsPlayerInRangeOfPoint -
Anuris - 11.11.2014
Hello.
I've founded in some script this function:
pawn Код:
stock PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
if(IsPlayerConnected(playerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
return 0;
}
It seems that it's the same as IsPlayerInRangeOfPoint.
So, is there any point of using this custom function, or it's really stupid? (I think it is.)
Sorry for my English.
Re: Custom IsPlayerInRangeOfPoint -
M0HAMMAD - 11.11.2014
pawn Код:
PlayerToPoint(Float:radius, playerid, Float:X, Float:Y, Float:Z)
{
new Float:oldpos[3], Float:temppos[3];
GetPlayerPos(playerid, oldpos[0], oldpos[1], oldpos[2]);
temppos[0] = (oldpos[0] -X);
temppos[1] = (oldpos[1] -Y);
temppos[2] = (oldpos[2] -Z);
if(((temppos[0] < radius) && (temppos[0] > -radius)) && ((temppos[1] < radius) && (temppos[1] > -radius)) && ((temppos[2] < radius) && (temppos[2] > -radius)))
{
return true;
}
return false;
//=============
if(PlayerToPoint(10.0, playerid, x,y,z))
Or...
pawn Код:
if(IsPlayerInRangeOfPoint(playerid , range, x,y,z))
Re: Custom IsPlayerInRangeOfPoint -
Vince - 11.11.2014
Quote:
Originally Posted by Anuris
So, is there any point of using this custom function
|
No. The function IsPlayerInRangeOfPoint was only added in SA-MP 0.3a; people used the function mentioned above to fill in this void in earlier versions.
Re: Custom IsPlayerInRangeOfPoint -
Anuris - 11.11.2014
But it's woold be betther, if I change it to IsPlayerInRangeOfPoint? Faster, for example?
Re: Custom IsPlayerInRangeOfPoint -
Vince - 11.11.2014
Native functions are always faster than custom functions, yes.
Re: Custom IsPlayerInRangeOfPoint -
Anuris - 11.11.2014
Thank you.
Re: Custom IsPlayerInRangeOfPoint -
Xdrime - 26.05.2016
Quote:
Originally Posted by Vince
No. The function IsPlayerInRangeOfPoint was only added in SA-MP 0.3a; people used the function mentioned above to fill in this void in earlier versions.
|
is there any similair function to use in 0.3x ?