26.06.2011, 05:44
Basically the stock of what I said , It should work while in a vehicle too
_
Proud sponsor of Cosmic hosting and DMCA
_
Proud sponsor of Cosmic hosting and DMCA
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));
}
if(GetDistanceBetweenPlayers(player1, player2) <= /*Range*/)
{
//Player is in range
}
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]);
}