error 014: invalid statement; not in switch
#1

D:\server\gamemodes\ruleta.pwn(693) : error 014: invalid statement; not in switch

Код:
public RouletteGame1()
{
  if(RouletteTime2 == 10 && podkrut == 0) prohod = random(55);
  else if(RouletteTime2 == 10 && podkrut != 0) prohod = podkrut;
  step ++;
  switch(prohod)
  {
   case 0..25:
   {
   switch(step)
   {
    case 1: prohodtime = SetTimer("TextDrawProhod1", 450, true),TextDrawSetString(CasinoDraw[11], "Rolling roulette..");
    case 10:
    {
    {
    foreach(new i:Player)
    {
     HideCasino(i);
     TextDrawBoxColor(CasinoDraw[1], 0xFF0000AA),TextDrawBoxColor(CasinoDraw[2], 0x000000AA),TextDrawBoxColor(CasinoDraw[3], 0xFF0000AA),TextDrawBoxColor(CasinoDraw[4], 0x000000AA),TextDrawBoxColor(CasinoDraw[5], 0xFF0000AA),TextDrawBoxColor(CasinoDraw[6], 0x000000AA),TextDrawBoxColor(CasinoDraw[7], 0xFF0000AA);
     ShowCasino(i);
     if(betplayer[i] == 10)
     {
      SendClientMessage(i,-1,"?? ???????? x2 ??????. ??????? ?????? ????.");
      GivePlayerMoney(i,betsumma[i]*2),PlayerPlaySound(i,43001,0.0,0.0,0.0);
     }
     else if(betplayer[i] == 14 || betplayer[i] == 4) SendClientMessage(i,-1,"?? ?????????. ??????? ?????? ????."),PlayerPlaySound(i,1085,0.0,0.0,0.0);
     betsumma[i] = 0,betplayer[i] = 0,PlayerTextDrawSetString(i,CasinoDrawPlayer[i][1], "BET: NONE");
    }
    RouletteTime = 20,RouletteStatus = 0,TotalBet = 0,step = 0,step2 = 0,step3 = 0,podkrut = 0;
    for(new i; i<3; i++) totalbet[i] = 0;
    for(new i; i<3; i++) totalsumma[i] = 0;
    KillTimer(playtime),KillTimer(prohodtime);
    TextDrawSetString(CasinoDraw[11], "Win black");
    TextDrawSetString(CasinoDraw[13], "0 users total 0$");
    TextDrawSetString(CasinoDraw[15], "0 users total 0$");
    TextDrawSetString(CasinoDraw[17], "0 users total 0$");
    return true;
    }
    }
	}
   case 26..28:
   {
   switch(step)
    {
     case 1: prohodtime = SetTimer("TextDrawProhod2", 450, true),TextDrawSetString(CasinoDraw[11], "Rolling roulette..");
     case 10:
     {
      foreach(new i:Player)
      {
       HideCasino(i);
       TextDrawBoxColor(CasinoDraw[1], 0x000000AA),TextDrawBoxColor(CasinoDraw[2], 0xFF0000AA),TextDrawBoxColor(CasinoDraw[3], 0x000000AA),TextDrawBoxColor(CasinoDraw[4], 0x00FF00AA),TextDrawBoxColor(CasinoDraw[5], 0xFF0000AA),TextDrawBoxColor(CasinoDraw[6], 0x000000AA),TextDrawBoxColor(CasinoDraw[7], 0xFF0000AA);
       ShowCasino(i);
       if(betplayer[i] == 4)
       {
        SendClientMessage(i,-1,"?? ???????? x4 ??????. ??????? ??????? ????.");
        GivePlayerMoney(i,betsumma[i]*4),PlayerPlaySound(i,43001,0.0,0.0,0.0);
       }
       else if(betplayer[i] == 10 || betplayer[i] == 14) SendClientMessage(i,-1,"?? ?????????. ??????? ??????? ????."),PlayerPlaySound(i,1085,0.0,0.0,0.0);
       betsumma[i] = 0,betplayer[i] = 0,PlayerTextDrawSetString(i,CasinoDrawPlayer[i][1], "BET: NONE");
      }
      RouletteTime = 20,TotalBet = 0,RouletteStatus = 0,step = 0,step2 = 0,step3 = 0,podkrut = 0;
      for(new i; i<3; i++) totalbet[i] = 0;
      for(new i; i<3; i++) totalsumma[i] = 0;
      KillTimer(playtime),KillTimer(prohodtime);
      TextDrawSetString(CasinoDraw[11], "Win Green");
      TextDrawSetString(CasinoDraw[13], "0 users total 0$");
      TextDrawSetString(CasinoDraw[15], "0 users total 0$");
      TextDrawSetString(CasinoDraw[17], "0 users total 0$");
      return true;
     }
    }
   }
Reply
#2

I have no idea how the script above actually compiles and pawno does not crash since you have alot of brackets { } which are on the incorrect place or even duplicated or missing.
First of all your indentation sucks. How can you even read trough this yourself? Try to order your code more nicely. Try this and let me know if it worked:

PHP код:
public RouletteGame1()
{
  if(
RouletteTime2 == 10 && podkrut == 0prohod random(55);
  else if(
RouletteTime2 == 10 && podkrut != 0prohod podkrut;
  
step ++;
  switch(
prohod)
  {
    case 
0..25:
    {
      switch(
step)
      {
        case 
1prohodtime SetTimer("TextDrawProhod1"450true),TextDrawSetString(CasinoDraw[11], "Rolling roulette..");
        case 
10:
        {
          foreach(new 
i:Player)
          {
            
HideCasino(i);
            
TextDrawBoxColor(CasinoDraw[1], 0xFF0000AA),TextDrawBoxColor(CasinoDraw[2], 0x000000AA),TextDrawBoxColor(CasinoDraw[3], 0xFF0000AA),TextDrawBoxColor(CasinoDraw[4], 0x000000AA),TextDrawBoxColor(CasinoDraw[5], 0xFF0000AA),TextDrawBoxColor(CasinoDraw[6], 0x000000AA),TextDrawBoxColor(CasinoDraw[7], 0xFF0000AA);
            
ShowCasino(i);
            if(
betplayer[i] == 10)
            {
              
SendClientMessage(i,-1,"?? ???????? x2 ??????. ??????? ?????? ????.");
              
GivePlayerMoney(i,betsumma[i]*2),PlayerPlaySound(i,43001,0.0,0.0,0.0);
            }
            else if(
betplayer[i] == 14 || betplayer[i] == 4SendClientMessage(i,-1,"?? ?????????. ??????? ?????? ????."),PlayerPlaySound(i,1085,0.0,0.0,0.0);
            
betsumma[i] = 0,betplayer[i] = 0,PlayerTextDrawSetString(i,CasinoDrawPlayer[i][1], "BET: NONE");
          }
          
RouletteTime 20,RouletteStatus 0,TotalBet 0,step 0,step2 0,step3 0,podkrut 0;
          for(new 
ii<3i++) totalbet[i] = 0;
          for(new 
ii<3i++) totalsumma[i] = 0;
          
KillTimer(playtime),KillTimer(prohodtime);
          
TextDrawSetString(CasinoDraw[11], "Win black");
          
TextDrawSetString(CasinoDraw[13], "0 users total 0$");
          
TextDrawSetString(CasinoDraw[15], "0 users total 0$");
          
TextDrawSetString(CasinoDraw[17], "0 users total 0$");
          return 
true;
        }
      }
      }
   case 
26..28:
   {
      switch(
step)
      {
        case 
1prohodtime SetTimer("TextDrawProhod2"450true),TextDrawSetString(CasinoDraw[11], "Rolling roulette..");
        case 
10:
        {
          foreach(new 
i:Player)
          {
            
HideCasino(i);
            
TextDrawBoxColor(CasinoDraw[1], 0x000000AA),TextDrawBoxColor(CasinoDraw[2], 0xFF0000AA),TextDrawBoxColor(CasinoDraw[3], 0x000000AA),TextDrawBoxColor(CasinoDraw[4], 0x00FF00AA),TextDrawBoxColor(CasinoDraw[5], 0xFF0000AA),TextDrawBoxColor(CasinoDraw[6], 0x000000AA),TextDrawBoxColor(CasinoDraw[7], 0xFF0000AA);
            
ShowCasino(i);
            if(
betplayer[i] == 4)
            {
              
SendClientMessage(i,-1,"?? ???????? x4 ??????. ??????? ??????? ????.");
              
GivePlayerMoney(i,betsumma[i]*4),PlayerPlaySound(i,43001,0.0,0.0,0.0);
            }
            else if(
betplayer[i] == 10 || betplayer[i] == 14SendClientMessage(i,-1,"?? ?????????. ??????? ??????? ????."),PlayerPlaySound(i,1085,0.0,0.0,0.0);
            
betsumma[i] = 0,betplayer[i] = 0,PlayerTextDrawSetString(i,CasinoDrawPlayer[i][1], "BET: NONE");
          }
        }
        
RouletteTime 20,TotalBet 0,RouletteStatus 0,step 0,step2 0,step3 0,podkrut 0;
        for(new 
ii<3i++) totalbet[i] = 0;
        for(new 
ii<3i++) totalsumma[i] = 0;
        
KillTimer(playtime),KillTimer(prohodtime);
        
TextDrawSetString(CasinoDraw[11], "Win Green");
        
TextDrawSetString(CasinoDraw[13], "0 users total 0$");
        
TextDrawSetString(CasinoDraw[15], "0 users total 0$");
        
TextDrawSetString(CasinoDraw[17], "0 users total 0$");
        return 
true;
      }
    } 
  }

You were missing and duplicating alot of brackets.
Reply
#3

D:\server\gamemodes\ruleta.pwn(712) : error 002: only a single statement (or expression) can follow each "case"
D:\server\gamemodes\ruleta.pwn(712) : error 029: invalid expression, assumed zero
D:\server\gamemodes\ruleta.pwn(712) : warning 215: expression has no effect

Line 712: RouletteTime = 20,TotalBet = 0,RouletteStatus = 0,step = 0,step2 = 0,step3 = 0,podkrut = 0;

D:\server\gamemodes\ruleta.pwn(724) : error 054: unmatched closing brace ("}")

Код:
 RouletteTime = 20,TotalBet = 0,RouletteStatus = 0,step = 0,step2 = 0,step3 = 0,podkrut = 0;
        for(new i; i<3; i++) totalbet[i] = 0;
        for(new i; i<3; i++) totalsumma[i] = 0;
        KillTimer(playtime),KillTimer(prohodtime);
        TextDrawSetString(CasinoDraw[11], "Win Green");
        TextDrawSetString(CasinoDraw[13], "0 users total 0$");
        TextDrawSetString(CasinoDraw[15], "0 users total 0$");
        TextDrawSetString(CasinoDraw[17], "0 users total 0$");
        return true;
      }
    } 
  }
}  
Reply
#4

Try changing RouletteTime = 20,TotalBet = 0,RouletteStatus = 0,step = 0,step2 = 0,step3 = 0,podkrut = 0;
to this:
PHP код:
RouletteTime 20;
TotalBet 0;
RouletteStatus 0;
step 0;
step2 0;
step3 0;
podkrut 0
Remove the last bracket you marked red. That one is my fault. :P

Also why do you loop twice on i?
PHP код:
for(new ii<3i++) totalbet[i] = 0;
        for(new 
ii<3i++) totalsumma[i] = 0
The second loop will just override the first one i think.
Reply
#5

D:\server\gamemodes\ruleta.pwn(712) : error 002: only a single statement (or expression) can follow each "case"

Line: RouletteTime = 20;

Im just trying to do this.. http://pawn-wiki.ru/index.php?%2Ftop...csgo-v-samp%2F
Reply
#6

PHP код:
public RouletteGame1() 

    if(
RouletteTime2 == 10 && podkrut == 0prohod random(55); 
    else if(
RouletteTime2 == 10 && podkrut != 0prohod podkrut
    
step ++; 
    switch(
prohod
    { 
        case 
0..25
        { 
            switch(
step
            { 
                case 
1prohodtime SetTimer("TextDrawProhod1"450true),TextDrawSetString(CasinoDraw[11], "Rolling roulette.."); 
                case 
10
                { 
                    foreach(new 
i:Player
                    { 
                        
HideCasino(i); 
                        
TextDrawBoxColor(CasinoDraw[1], 0xFF0000AA),TextDrawBoxColor(CasinoDraw[2], 0x000000AA),TextDrawBoxColor(CasinoDraw[3], 0xFF0000AA),TextDrawBoxColor(CasinoDraw[4], 0x000000AA),TextDrawBoxColor(CasinoDraw[5], 0xFF0000AA),TextDrawBoxColor(CasinoDraw[6], 0x000000AA),TextDrawBoxColor(CasinoDraw[7], 0xFF0000AA); 
                        
ShowCasino(i); 
                        if(
betplayer[i] == 10
                        { 
                            
SendClientMessage(i,-1,"?? ???????? x2 ??????. ??????? ?????? ????."); 
                            
GivePlayerMoney(i,betsumma[i]*2),PlayerPlaySound(i,43001,0.0,0.0,0.0); 
                        } 
                        else if(
betplayer[i] == 14 || betplayer[i] == 4SendClientMessage(i,-1,"?? ?????????. ??????? ?????? ????."),PlayerPlaySound(i,1085,0.0,0.0,0.0); 
                        
betsumma[i] = 0,betplayer[i] = 0,PlayerTextDrawSetString(i,CasinoDrawPlayer[i][1], "BET: NONE"); 
                    }             
                    
RouletteTime 20,RouletteStatus 0,TotalBet 0,step 0,step2 0,step3 0,podkrut 0
                    for(new 
ii<3i++) totalbet[i] = 0
                    for(new 
ii<3i++) totalsumma[i] = 0
                    
KillTimer(playtime),KillTimer(prohodtime); 
                    
TextDrawSetString(CasinoDraw[11], "Win black"); 
                    
TextDrawSetString(CasinoDraw[13], "0 users total 0$"); 
                    
TextDrawSetString(CasinoDraw[15], "0 users total 0$"); 
                    
TextDrawSetString(CasinoDraw[17], "0 users total 0$"); 
                    return 
true
                } 
            } 
        } 
        case 
26..28
        { 
            switch(
step
            { 
                case 
1prohodtime SetTimer("TextDrawProhod2"450true),TextDrawSetString(CasinoDraw[11], "Rolling roulette.."); 
                case 
10
                { 
                    foreach(new 
i:Player
                    {             
                        
HideCasino(i); 
                        
TextDrawBoxColor(CasinoDraw[1], 0x000000AA),TextDrawBoxColor(CasinoDraw[2], 0xFF0000AA),TextDrawBoxColor(CasinoDraw[3], 0x000000AA),TextDrawBoxColor(CasinoDraw[4], 0x00FF00AA),TextDrawBoxColor(CasinoDraw[5], 0xFF0000AA),TextDrawBoxColor(CasinoDraw[6], 0x000000AA),TextDrawBoxColor(CasinoDraw[7], 0xFF0000AA); 
                        
ShowCasino(i); 
                        if(
betplayer[i] == 4
                        { 
                            
SendClientMessage(i,-1,"?? ???????? x4 ??????. ??????? ??????? ????."); 
                            
GivePlayerMoney(i,betsumma[i]*4),PlayerPlaySound(i,43001,0.0,0.0,0.0); 
                        } 
                        else if(
betplayer[i] == 10 || betplayer[i] == 14SendClientMessage(i,-1,"?? ?????????. ??????? ??????? ????."),PlayerPlaySound(i,1085,0.0,0.0,0.0); 
                        
betsumma[i] = 0,betplayer[i] = 0,PlayerTextDrawSetString(i,CasinoDrawPlayer[i][1], "BET: NONE"); 
                    } 
                 
                    
RouletteTime 20,TotalBet 0,RouletteStatus 0,step 0,step2 0,step3 0,podkrut 0
                    for(new 
ii<3i++) totalbet[i] = 0
                    for(new 
ii<3i++) totalsumma[i] = 0
                    
KillTimer(playtime),KillTimer(prohodtime); 
                    
TextDrawSetString(CasinoDraw[11], "Win Green"); 
                    
TextDrawSetString(CasinoDraw[13], "0 users total 0$"); 
                    
TextDrawSetString(CasinoDraw[15], "0 users total 0$"); 
                    
TextDrawSetString(CasinoDraw[17], "0 users total 0$"); 
                    return 
true
                }    
            } 
        }      
    } 

Reply
#7

Quote:
Originally Posted by AroseKhanNiazi
Посмотреть сообщение
PHP код:
public RouletteGame1() 

    if(
RouletteTime2 == 10 && podkrut == 0prohod random(55); 
    else if(
RouletteTime2 == 10 && podkrut != 0prohod podkrut
    
step ++; 
    switch(
prohod
    { 
        case 
0..25
        { 
            switch(
step
            { 
                case 
1prohodtime SetTimer("TextDrawProhod1"450true),TextDrawSetString(CasinoDraw[11], "Rolling roulette.."); 
                case 
10
                { 
                    foreach(new 
i:Player
                    { 
                        
HideCasino(i); 
                        
TextDrawBoxColor(CasinoDraw[1], 0xFF0000AA),TextDrawBoxColor(CasinoDraw[2], 0x000000AA),TextDrawBoxColor(CasinoDraw[3], 0xFF0000AA),TextDrawBoxColor(CasinoDraw[4], 0x000000AA),TextDrawBoxColor(CasinoDraw[5], 0xFF0000AA),TextDrawBoxColor(CasinoDraw[6], 0x000000AA),TextDrawBoxColor(CasinoDraw[7], 0xFF0000AA); 
                        
ShowCasino(i); 
                        if(
betplayer[i] == 10
                        { 
                            
SendClientMessage(i,-1,"?? ???????? x2 ??????. ??????? ?????? ????."); 
                            
GivePlayerMoney(i,betsumma[i]*2),PlayerPlaySound(i,43001,0.0,0.0,0.0); 
                        } 
                        else if(
betplayer[i] == 14 || betplayer[i] == 4SendClientMessage(i,-1,"?? ?????????. ??????? ?????? ????."),PlayerPlaySound(i,1085,0.0,0.0,0.0); 
                        
betsumma[i] = 0,betplayer[i] = 0,PlayerTextDrawSetString(i,CasinoDrawPlayer[i][1], "BET: NONE"); 
                    }             
                    
RouletteTime 20,RouletteStatus 0,TotalBet 0,step 0,step2 0,step3 0,podkrut 0
                    for(new 
ii<3i++) totalbet[i] = 0
                    for(new 
ii<3i++) totalsumma[i] = 0
                    
KillTimer(playtime),KillTimer(prohodtime); 
                    
TextDrawSetString(CasinoDraw[11], "Win black"); 
                    
TextDrawSetString(CasinoDraw[13], "0 users total 0$"); 
                    
TextDrawSetString(CasinoDraw[15], "0 users total 0$"); 
                    
TextDrawSetString(CasinoDraw[17], "0 users total 0$"); 
                    return 
true
                } 
            } 
        } 
        case 
26..28
        { 
            switch(
step
            { 
                case 
1prohodtime SetTimer("TextDrawProhod2"450true),TextDrawSetString(CasinoDraw[11], "Rolling roulette.."); 
                case 
10
                { 
                    foreach(new 
i:Player
                    {             
                        
HideCasino(i); 
                        
TextDrawBoxColor(CasinoDraw[1], 0x000000AA),TextDrawBoxColor(CasinoDraw[2], 0xFF0000AA),TextDrawBoxColor(CasinoDraw[3], 0x000000AA),TextDrawBoxColor(CasinoDraw[4], 0x00FF00AA),TextDrawBoxColor(CasinoDraw[5], 0xFF0000AA),TextDrawBoxColor(CasinoDraw[6], 0x000000AA),TextDrawBoxColor(CasinoDraw[7], 0xFF0000AA); 
                        
ShowCasino(i); 
                        if(
betplayer[i] == 4
                        { 
                            
SendClientMessage(i,-1,"?? ???????? x4 ??????. ??????? ??????? ????."); 
                            
GivePlayerMoney(i,betsumma[i]*4),PlayerPlaySound(i,43001,0.0,0.0,0.0); 
                        } 
                        else if(
betplayer[i] == 10 || betplayer[i] == 14SendClientMessage(i,-1,"?? ?????????. ??????? ??????? ????."),PlayerPlaySound(i,1085,0.0,0.0,0.0); 
                        
betsumma[i] = 0,betplayer[i] = 0,PlayerTextDrawSetString(i,CasinoDrawPlayer[i][1], "BET: NONE"); 
                    } 
                 
                    
RouletteTime 20,TotalBet 0,RouletteStatus 0,step 0,step2 0,step3 0,podkrut 0
                    for(new 
ii<3i++) totalbet[i] = 0
                    for(new 
ii<3i++) totalsumma[i] = 0
                    
KillTimer(playtime),KillTimer(prohodtime); 
                    
TextDrawSetString(CasinoDraw[11], "Win Green"); 
                    
TextDrawSetString(CasinoDraw[13], "0 users total 0$"); 
                    
TextDrawSetString(CasinoDraw[15], "0 users total 0$"); 
                    
TextDrawSetString(CasinoDraw[17], "0 users total 0$"); 
                    return 
true
                }    
            } 
        }      
    } 

tyy <3
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)