How to stock ( IfPlayerIsInRangeOfPlayer )
#2

You could use GetDistanceBetweenPlayers
pawn Код:
stock Float:GetDistanceBetweenPlayers(player1, player2)
{
    new Float:X, Float:Y, Float:Z, Float:PointX, Float:PointY, Float:PointZ;
    GetPlayerPos(player1, X, Y, Z);
    GetPlayerPos(player2, PointX, PointY, PointZ);
    return floatsqroot(floatpower(floatsub(X, PointX), 2.0) + floatpower(floatsub(Y, PointY), 2.0) + floatpower(floatsub(Z, PointZ), 2.0));
}
Then do this:

pawn Код:
if(GetDistanceBetweenPlayers(player1, player2) <= /*Range*/)
{
    //Player is in range
}
Reply


Messages In This Thread
How to stock ( IfPlayerIsInRangeOfPlayer ) - by CosmicHosting - 26.06.2011, 05:44
Re: How to stock ( IfPlayerIsInRangeOfPlayer ) - by [HiC]TheKiller - 26.06.2011, 05:56
Re: How to stock ( IfPlayerIsInRangeOfPlayer ) - by [L3th4l] - 26.06.2011, 06:10

Forum Jump:


Users browsing this thread: 1 Guest(s)