SA-MP Forums Archive
Weird while() loop not finishing run. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Weird while() loop not finishing run. (/showthread.php?tid=297915)



Weird while() loop not finishing run. - Hoborific - 18.11.2011

pawn Код:
new ARRAY[12];


forward WhileTimer();

public WhileTimer()
{
    print("CALL TEH FUNCTION BITCH");
    new VARCOUNTDOWN;
    VARCOUNTDOWN = 12;

    while(VARCOUNTDOWN > 0)
    {
        print("LOOP HAS TEH BEEN CALLED"); // Last Print before it mysteriously stops.
        if(random(2) == 0)
        {
            print("IS IT FUCKED!?!?!?");
            new VAR;
            VAR = random(10);
            ARRAY[VARCOUNTDOWN] = ARRAY[VARCOUNTDOWN] + VAR;
            print("DEBUG MOTHERFUCKER");
           
        }
           
        else

        {
           
            new VAR2;
            new VAR3;
            VAR2 = random(10);
            VAR3 = VAR2 - VAR2 * 2;
            ARRAY[VARCOUNTDOWN] = ARRAY[VARCOUNTDOWN] + VAR3;
            print("DEBUG MOTHERFUCKER #2");
           
        }

        printf("%d : %d",VARCOUNTDOWN,ARRAY[VARCOUNTDOWN]);
        VARCOUNTDOWN--;
        print("DEBUG MOTHERFUCKER #3");
    }
   
}
It worked perfectly as a function but the While would be more efficient, Advice and help would be appreciated.


Re: Weird while() loop not finishing run. - Hoborific - 18.11.2011

EDIT: Well I am a complete noob, Thank you very much for the help ******.

EDIT2: rep++ for you, even though it probably will not make the slightest difference for your nearly 500 rep.