Get a random player in range of position using loops
#5

Quote:
Originally Posted by iJumbo
Посмотреть сообщение
I know that goto is not very well handled by the compiler

You mean something like that ?
pawn Код:
stock GetRandomPlayerInRange(Float:X,Float:Y,Float:Z,Float:Range)
{
    new randPlayer;
    do {
        randPlayer = Iter_Random(Player);
        randPlayer = (IsPlayerInRangeOfPoint(randPlayer,Range,X,Y,Z) ? randPlayer : 255;
    }
    while (randPlayer == 255);
    return randPlayer;
}
Never ever used do-while loops
I think that's need to declare 'randPlayer' as 255 or nothing will happen.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)