#1

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
Reply
#2

pawn Код:
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;
}
Untested code. Next time, post in the Script Request Thread when asking for code.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)