How to use loop and return
#2

Stop the loop at end of checks? e.g
pawn Код:
for (new i; i < 1000; ++ i)
{
    if (IsPlayerConnected(i))
    {
        if (cool[i] == true)
        {
            if (hax0r[i] == false)
            {
                DoSomething();
                break; // End the loop as player is found
            }
            else
            {
                Ban(i);
                continue; // Skip current "i" to continue looping to search the correct player.
            }
        }
        else
        {
            cool[i] = true;
            continue; // Skip current "i" to continue looping to search the correct player.
        }
    }
    return 1;
}
I don't know if that really helps, but what I see your problem is you didn't end the loop when the player has found the right house.
Reply


Messages In This Thread
How to use loop and return - by Dziugsas - 04.07.2014, 13:30
Re: How to use loop and return - by greentarch - 04.07.2014, 14:07

Forum Jump:


Users browsing this thread: 1 Guest(s)