How to stock ( IfPlayerIsInRangeOfPlayer )
#1

Basically the stock of what I said , It should work while in a vehicle too

_

Proud sponsor of Cosmic hosting and DMCA
Reply
#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
#3

You can use the "IsPlayerInRangeofPoint" function:

pawn Код:
stock PlayerIsInRangeOfPlayer(playerid, otherid, Float:range)
{
    new
        Float: iPos[3];

    GetPlayerPos(otherid, iPos[0], iPos[1], iPos[2]);

    return IsPlayerInRangeOfPoint(playerid, range, iPos[0], iPos[1]);
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)