AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Question Infinite loop (https://forums.alliedmods.net/showthread.php?t=253859)

ghost95v 12-29-2014 14:36

Question Infinite loop
 
Hello, well how can i know, if some parts of code does the infinite loop, anyone can give me an Example of a infinite loop ?, it will be helpfull for me to prevent this. thnx

Kazalu 12-29-2014 14:38

Re: Question Infinite loop
 
for( ; ; )
client_print( 0, print_chat, "LOOOOOPYYYY" );

But I guess that would crash the server or create mad lag.

Or when you make smth like
X = 3

while( x >= 2 )
{
//execute stuff
x++;
}

ghost95v 12-29-2014 14:46

Re: Question Infinite loop
 
Quote:

Originally Posted by Kazalu (Post 2241594)
for( ; ; )
client_print( 0, print_chat, "LOOOOOPYYYY" );

But I guess that would crash the server or create mad lag.

Or when you make smth like
X = 3

while( x >= 2 )
{
//execute stuff
x++;
}

Ok, thnx ... any other example ?

YamiKaitou 12-29-2014 14:49

Re: Question Infinite loop
 
while(true);


This is a generic question with many answers. Give us more specific details about what you are trying to accomplish

Kazalu 12-29-2014 14:49

Re: Question Infinite loop
 
Do you want an example or do you want to know the use of an infinite loop?

ghost95v 12-29-2014 14:58

Re: Question Infinite loop
 
Quote:

Originally Posted by YamiKaitou (Post 2241600)
while(true);


This is a generic question with many answers. Give us more specific details about what you are trying to accomplish

i just want to understand when some part of code will give a infinite loop .Well for eg. on this code below, how it might be to give a infinite loop?

PHP Code:

bool:isInMenu(id)
{
    for (new 
0g_mapVoteNum; ++a)
        if (
id == g_nextName[a])
            return 
true
    
return false



Kazalu 12-29-2014 15:00

Re: Question Infinite loop
 
When g_mapVoteNum < 0 I guess


All times are GMT -4. The time now is 15:29.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.