SA-MP Forums Archive
Infinite Loop! - 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: Infinite Loop! (/showthread.php?tid=503179)



Infinite Loop! - TheBosss - 28.03.2014

Hello,

Anybody knows a quick method to find an infinte loop?
Please tell me,anything that you know about it..


Re: Infinite Loop! - Kyle - 28.03.2014

Look at your while loops and for, you should count the iterations, if over x, stop it.


Re: Infinite Loop! - Schocc - 28.03.2014

search on ******

It is not necessary to use endless iterations


Re: Infinite Loop! - Vince - 28.03.2014

Add print before loop, add print after loop. If the server hangs, you'll know.


Re: Infinite Loop! - TheBosss - 28.03.2014

I think that i will check all my loops,because this infinte loop comes rarely out..
Anyway if anybody has got a better solution,don't forget to tell me!


Re: Infinite Loop! - Schocc - 28.03.2014

Look for i++ while for do

The term will not have MAX_PLAYERS or MAX_VEHICLES.

Start looking for the function that starts the loop.


Re: Infinite Loop! - TheBosss - 28.03.2014

Thanks for the answers,but i can't find it with my eyes..Any new ideas?


Re: Infinite Loop! - TheBosss - 29.03.2014

Is this stock a problem?:
pawn Код:
stock date(timestamp, &f_day, &f_month, &f_year, &f_hour, &f_min, &f_sec)
{
    new s_year=1970, s_day=0, s_month=0, s_hour=0, s_mins=0;
    new days_of_month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

    while(timestamp > 31622400)
    {
        timestamp -= 31536000;
        if(((s_year % 4 == 0) && (s_year % 100 != 0)) || (s_year % 400 == 0))  timestamp -= 86400;
        s_year++;
    }

    if(((s_year % 4 == 0) && (s_year % 100 != 0)) || (s_year % 400 == 0))
    {
        days_of_month[1] = 29;
    }
    else
    {
        days_of_month[1] = 28;
    }

    while(timestamp > 86400)
    {
        timestamp -= 86400, s_day++;
        if(s_day == days_of_month[s_month]) s_day=0, s_month++;
    }

    while(timestamp>60)
    {
        timestamp -= 60, s_mins++;
        if(s_mins == 60) s_mins=0, s_hour++;
    }

    f_day = s_day + 1;
    f_month = s_month + 1;
    f_year = s_year;
    f_hour = s_hour;
    f_min = s_mins;
    f_sec = timestamp;

    return true;
}