Raised This Month: $ Target: $400
 0% 

how to use while?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
0920357689
Senior Member
Join Date: Apr 2008
Old 06-28-2010 , 04:49   how to use while?
Reply With Quote #1

PHP Code:
new smoke;
 
smoke find_ent_by_class smoke"toxicsmoke");
 while(
smoke != 0)
 {
  
remove_entity(smoke);
  
smoke find_ent_by_class smoke"toxicsmoke");
 } 
use this will server dead

Last edited by 0920357689; 06-28-2010 at 12:46.
0920357689 is offline
infek
Senior Member
Join Date: May 2009
Location: Behind you
Old 06-28-2010 , 23:25   Re: how to use while?
Reply With Quote #2

Quote:
Originally Posted by 0920357689 View Post
PHP Code:
new smoke;
 
smoke find_ent_by_class smoke"toxicsmoke");
 while(
smoke != 0)
 {
  
remove_entity(smoke);
  
smoke find_ent_by_class smoke"toxicsmoke");
 } 
use this will server dead
what do you mean by "use this will server dead"
__________________
"Domo Arigato, Mr. Roboto!"
PM me if you want to know a secret
infek is offline
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 06-28-2010 , 23:51   Re: how to use while?
Reply With Quote #3

Statement while:
While condition is true, the loop will not stop.
Mxnn is offline
Old 06-28-2010, 23:58
Firippu
This message has been deleted by Firippu. Reason: I'm an idiot.
zwfgdlc
Senior Member
Join Date: May 2006
Old 06-29-2010 , 03:17   Re: how to use while?
Reply With Quote #5

PHP Code:
new smoke = -1;
while((
smoke find_ent_by_class (smoke"toxicsmoke"))
{
        
remove_entity(smoke);

zwfgdlc is offline
FiFiX
Senior Member
Join Date: May 2008
Location: Poland
Old 10-14-2010 , 05:11   Re: how to use while?
Reply With Quote #6

Quote:
Originally Posted by zwfgdlc View Post
PHP Code:
while(find_ent_by_class (-1"toxicsmoke"))
{
        
remove_entity(find_ent_by_class (-1"toxicsmoke"));

But can someone explain me why that doesn't work? It seems to be "faster" and more optimal way..


TO BUGSY EXAMPLE:
And why in condition is -1? If entity haven't been fount, it returns 0, not -1 :/
So if
find ent != -1 (can be 0 - ent not found, and we are still deleting it...)

Last edited by FiFiX; 10-14-2010 at 05:19.
FiFiX is offline
Send a message via Skype™ to FiFiX
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-14-2010 , 18:29   Re: how to use while?
Reply With Quote #7

Quote:
Originally Posted by FiFiX View Post
But can someone explain me why that doesn't work? It seems to be "faster" and more optimal way..
LOL. If it doesn't work then it is neither faster or optimal is it?
__________________
fysiks is offline
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 06-29-2010 , 04:34   Re: how to use while?
Reply With Quote #8

Code:
new smoke = -1
while ( ( smoke = find_ent_by_class ( smoke, "toxicsmoke" ) ) > 0 )
{
    remove_entity ( smoke )
}
__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 06-29-2010 , 04:52   Re: how to use while?
Reply With Quote #9

Maybe he meant:

"Use this while server dead"
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
0920357689
Senior Member
Join Date: Apr 2008
Old 06-29-2010 , 05:01   Re: how to use while?
Reply With Quote #10

Quote:
Originally Posted by GXLZPGX View Post
Maybe he meant:

"Use this while server dead"
yes

my english very bad...sorry

this core is work
PHP Code:
new smoke = -1
smoke 
find_ent_by_class smoke"toxicsmoke" 
while (
smoke )
{
    
remove_entity smoke )
    
smoke find_ent_by_class smoke"toxicsmoke" 


Last edited by 0920357689; 06-29-2010 at 06:47.
0920357689 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:55.


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