[Ajuda] Erro switch
#1

Estou tentando fazer sу que dar erro

Код:
forward InicioCorrida();


public InicioCorrida()
{
for(new i = 0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
case:1
{
if(correndo[i] == 1)
{
GameTextForPlayer(i, "5", 1001, 5);
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
}
case:2
{
if(correndo[i] == 1)
{
GameTextForPlayer(i, "4", 1001, 5);
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
}
}
}
SetTimer("InicioCorrida3", 1000, false);
case:3
{
if(correndo[i] == 1)
{
GameTextForPlayer(i, "4", 1001, 5);
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
}
}
}
SetTimer("InicioCorrida3", 1000, false);
case:4
{
if(correndo[i] == 1)
{
GameTextForPlayer(i, "3", 1001, 5);
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
}
}
}
SetTimer("InicioCorrida3", 1000, false);
case:5
{
if(correndo[i] == 1)
{
GameTextForPlayer(i, "2", 1001, 5);
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
}
}
}
SetTimer("InicioCorrida3", 1000, false);
case:6
{
if(correndo[i] == 1)
{
GameTextForPlayer(i, "1", 1001, 5);
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
}
}
}
SetTimer("InicioCorrida3", 1000, false);
case:7
{
if(correndo[i] == 1)
{
GameTextForPlayer(i, "GO", 1001, 5);
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
}
}
}
SetTimer("InicioCorrida3", 1000, false);
}
}
}
}
Reply
#2

Vocк esta usando switch de forma errada.

https://sampforum.blast.hk/showthread.php?tid=240470
Reply
#3

@edit
Jб vi o erro, se ajudei um rep faz bem kk.
PHP код:
forward InicioCorrida();
public 
InicioCorrida()
{
    for(new 
0i<MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
            case 
0:
            {
                if(
correndo[i] == 1)
                {
                    
GameTextForPlayer(i"5"10015);
                    
PlayerPlaySound(i10560.00.00.0);
                }
            }
            case 
1:
            {
                if(
correndo[i] == 1)
                {
                    
GameTextForPlayer(i"4"10015);
                    
PlayerPlaySound(i10560.00.00.0);
                }
            }
            
SetTimer("InicioCorrida3"1000false);
            case 
2:
            {
                if(
correndo[i] == 1)
                {
                    
GameTextForPlayer(i"4"10015);
                    
PlayerPlaySound(i10560.00.00.0);
                }
            }
            
SetTimer("InicioCorrida3"1000false);
            case 
3:
            {
                if(
correndo[i] == 1)
                {
                    
GameTextForPlayer(i"3"10015);
                    
PlayerPlaySound(i10560.00.00.0);
                }
            }
            
SetTimer("InicioCorrida3"1000false);
            case 
4:
            {
                if(
correndo[i] == 1)
                {
                    
GameTextForPlayer(i"2"10015);
                    
PlayerPlaySound(i10560.00.00.0);
                }
            }
            
SetTimer("InicioCorrida3"1000false);
            case 
5:
            {
                if(
correndo[i] == 1)
                {
                    
GameTextForPlayer(i"1"10015);
                    
PlayerPlaySound(i10560.00.00.0);
                }
            }
            
SetTimer("InicioCorrida3"1000false);
            case 
6:
            {
                if(
correndo[i] == 1)
                {
                    
GameTextForPlayer(i"GO"10015);
                    
PlayerPlaySound(i10560.00.00.0);
                }
            }
            
SetTimer("InicioCorrida3"1000false);
        }
    }
    return 
1;

Reply
#4

Falta o switch.

PHP код:
switch(variavel//por exemplo 
Reply
#5

Enfim, que variбvel vocк quer aplicar o switch?
Код:
new variavel;
switch(variavel)
Reply
#6

Obrigado
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)