18.09.2011, 03:36
hello my question is how I can make a command / darmoney but the command to work when a player is 5 meters of another player
COMMAND:darmoney(playerid, params[])
{
new
Float: pPos[3],
foundPlayer = -1;
for( new i, j = GetMaxPlayers(); i < j; i++ )
{
if(!IsPlayerConnected(i) || i == playerid) continue;
GetPlayerPos(i, pPos[0], pPos[1], pPos[2]);
if(IsPlayerInRangeOfPoint(playerid, 5, pPos[0], pPos[1], pPos[2]))
{
foundPlayer = i;
break;
}
}
if(foundPlayer != -1)
{
// They're in range of a player
// Place rest of code here
}
else
{
// Not in range of player
}
return 1;
}