AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [help]How many else can i do in case? (https://forums.alliedmods.net/showthread.php?t=159437)

2reason2kill 06-17-2011 04:15

[help]How many else can i do in case?
 
How many else can i do in case or normal?

drekes 06-17-2011 05:05

Re: [help]How many else can i do in case?
 
Explain what you're trying to do

2reason2kill 06-17-2011 05:20

Re: [help]How many else can i do in case?
 
Quote:

Originally Posted by drekes (Post 1489849)
Explain what you're trying to do



PHP Code:

case 1:
    {
        if(
g_bBoght[id][silver_lighet])
        {
            
ColorChat(idGREEN,"%s You Cant Buy This Item 2 Time's!",PREFIX)
        }
        else
        {
            new 
cost get_pcvar_num(silver_lighet_cost);
            
            if(
money >= cost)
            {
                
cs_set_weapon_ammo(give_item(id,"weapon_deagle")
                
g_bBoght[id][silver_lighet] = true
                cs_set_user_bpammo
(idCSW_DEAGLE1)
                
cs_set_user_money(idmoney -cost)
                
                
ColorChat(idGREEN,"%s You Just Bought a ^x04 silver Light!"PREFIX);
            }
            else
            {
                if(!
is_user_alive(id)
                {
                    
Colorchat(.....)
        }
    }


Im trying to Get how many else u can have


other example

PHP Code:

case 1:
    {
        if(
somting)
        {
            
//somting
        
}
        else
        {
            
//somting
        
}
        else
        {
            
//somting
        
}
        else
        {
            
//somting
        
}
        
    }


can i do it like that?

Devil259 06-17-2011 05:40

Re: [help]How many else can i do in case?
 
Code:
if( ) {     // ... } else if( ) {     // ... } else if( ) {     // ... } else {     // ... }

2reason2kill 06-17-2011 05:45

Re: [help]How many else can i do in case?
 
Quote:

Originally Posted by Devil259 (Post 1489860)
Code:
if( ) { // ... } else if( ) { // ... } else if( ) { // ... } else( ) { // ... }

So the last 1 will be "else"

and the other "else if()"?

Devil259 06-17-2011 06:23

Re: [help]How many else can i do in case?
 
Quote:

Originally Posted by 2reason2kill (Post 1489863)
So the last 1 will be "else"

and the other "else if()"?

Yes.

2reason2kill 06-17-2011 06:54

Re: [help]How many else can i do in case?
 
Quote:

Originally Posted by Devil259 (Post 1489883)
Yes.

Thanx

Exolent[jNr] 06-17-2011 10:59

Re: [help]How many else can i do in case?
 
Quote:

Originally Posted by Devil259 (Post 1489860)
Code:
else {     // ... }

FTFY. The "else" does not have parenthesis.

Devil259 06-17-2011 11:16

Re: [help]How many else can i do in case?
 
Quote:

Originally Posted by Exolent[jNr] (Post 1490052)
FTFY. The "else" does not have parenthesis.

What ?

Exolent[jNr] 06-17-2011 11:19

Re: [help]How many else can i do in case?
 
Quote:

Originally Posted by Devil259 (Post 1490069)
What ?

Fixed That For You.

The "else" statement alone does not have parenthesis after it.
That's only if you are using "else if".


All times are GMT -4. The time now is 23:30.

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