Erro switch -
Marllun - 01.11.2017
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);
}
}
}
}
Re: Erro switch -
C4rtm4n - 01.11.2017
Vocк esta usando switch de forma errada.
https://sampforum.blast.hk/showthread.php?tid=240470
Re: Erro switch -
DelK - 01.11.2017
@edit
Jб vi o erro, se ajudei um rep faz bem kk.
PHP код:
forward InicioCorrida();
public InicioCorrida()
{
for(new i = 0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
case 0:
{
if(correndo[i] == 1)
{
GameTextForPlayer(i, "5", 1001, 5);
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
}
}
case 1:
{
if(correndo[i] == 1)
{
GameTextForPlayer(i, "4", 1001, 5);
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
}
}
SetTimer("InicioCorrida3", 1000, false);
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, "3", 1001, 5);
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
}
}
SetTimer("InicioCorrida3", 1000, false);
case 4:
{
if(correndo[i] == 1)
{
GameTextForPlayer(i, "2", 1001, 5);
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
}
}
SetTimer("InicioCorrida3", 1000, false);
case 5:
{
if(correndo[i] == 1)
{
GameTextForPlayer(i, "1", 1001, 5);
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
}
}
SetTimer("InicioCorrida3", 1000, false);
case 6:
{
if(correndo[i] == 1)
{
GameTextForPlayer(i, "GO", 1001, 5);
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
}
}
SetTimer("InicioCorrida3", 1000, false);
}
}
return 1;
}
Re: Erro switch -
IlanZ - 02.11.2017
Falta o switch.
PHP код:
switch(variavel) //por exemplo
Re: Erro switch -
MrEdu - 02.11.2017
Enfim, que variбvel vocк quer aplicar o switch?
Код:
new variavel;
switch(variavel)
Re: Erro switch -
Marllun - 02.11.2017
Obrigado