error 002: only a single statement (or expression) can follow each "case"
#1

(3745) : error 002: only a single statement (or expression) can follow each "case"
(3773) : error 002: only a single statement (or expression) can follow each "case"

Code: http://pastebin.com/jGpGkU4R

If you do know whats wrong, please tell me the issue. Thanks!
Reply
#2

you might havent close switch and case 1
PHP код:
switch(id)
    {
        case 
1:
        {
            new 
rand1 random(sizeof(DeathmatchLVPD));
            
CreateDM(
            
playeridDeathmatchLVPD[rand1][0], DeathmatchLVPD[rand1][1], DeathmatchLVPD[rand1][2], DeathmatchLVPD[rand1][3], 100100242501); // 28 = Micro/UZI and 25 = Shotgun
        
// << here
        
case 2:
        {
            new 
rand1 random(sizeof(DeathmatchJeffersonMotel));
            
CreateDM(
            
playeridDeathmatchJeffersonMotel[rand1][0], DeathmatchJeffersonMotel[rand1][1], DeathmatchJeffersonMotel[rand1][2], DeathmatchJeffersonMotel[rand1][3], 10010024251501);
            }
    
// here
return 1
you can refer it

PHP код:
switch(id)
{
    case 
1:
    {
    }
    case 
2:
    {
    }

Reply
#3

Quote:
Originally Posted by Alvitr
Посмотреть сообщение
you might havent close switch and case 1
PHP код:
switch(id)
    {
        case 
1:
        {
            new 
rand1 random(sizeof(DeathmatchLVPD));
            
CreateDM(
            
playeridDeathmatchLVPD[rand1][0], DeathmatchLVPD[rand1][1], DeathmatchLVPD[rand1][2], DeathmatchLVPD[rand1][3], 100100242501); // 28 = Micro/UZI and 25 = Shotgun
        
// << here
        
case 2:
        {
            new 
rand1 random(sizeof(DeathmatchJeffersonMotel));
            
CreateDM(
            
playeridDeathmatchJeffersonMotel[rand1][0], DeathmatchJeffersonMotel[rand1][1], DeathmatchJeffersonMotel[rand1][2], DeathmatchJeffersonMotel[rand1][3], 10010024251501);
            }
    
// here
return 1
you can refer it

PHP код:
switch(id)
{
    case 
1:
    {
    }
    case 
2:
    {
    }

Thanks for the quick reply! I have it like this


RespawnInDM(playerid)
{
switch(DMZone[playerid])
{
case 1: // First DM
{
new rand1 = random(sizeof(DeathmatchLVPD));
CreateDM(
playerid, DeathmatchLVPD[rand1][0], DeathmatchLVPD[rand1][1], DeathmatchLVPD[rand1][2], DeathmatchLVPD[rand1][3], 100, 100, 24, 25, 3, 0, 1); // each DM has to get it's own zone ID.
}
case 2: // Second DM
{
new rand1 = random(sizeof(DeathmatchJeffersonMotel));
CreateDM(
playerid, DeathmatchJeffersonMotel[rand1][0], DeathmatchJeffersonMotel[rand1][1], DeathmatchJeffersonMotel[rand1][2], DeathmatchJeffersonMotel[rand1][3], 100, 100, 24, 25, 15, 0, 1);
}
return 1;
}
Reply
#4

Quote:
Originally Posted by aoky
Посмотреть сообщение
Thanks for the quick reply! I have it like this


RespawnInDM(playerid)
{
switch(DMZone[playerid])
{
case 1: // First DM
{
new rand1 = random(sizeof(DeathmatchLVPD));
CreateDM(
playerid, DeathmatchLVPD[rand1][0], DeathmatchLVPD[rand1][1], DeathmatchLVPD[rand1][2], DeathmatchLVPD[rand1][3], 100, 100, 24, 25, 3, 0, 1); // each DM has to get it's own zone ID.
}
case 2: // Second DM
{
new rand1 = random(sizeof(DeathmatchJeffersonMotel));
CreateDM(
playerid, DeathmatchJeffersonMotel[rand1][0], DeathmatchJeffersonMotel[rand1][1], DeathmatchJeffersonMotel[rand1][2], DeathmatchJeffersonMotel[rand1][3], 100, 100, 24, 25, 15, 0, 1);
}
return 1;
}
PHP код:
RespawnInDM(playerid)
{
    switch(
DMZone[playerid])
    {
        case 
1// First DM
        
{
            new 
rand1 random(sizeof(DeathmatchLVPD));
            
CreateDM(
            
playeridDeathmatchLVPD[rand1][0], DeathmatchLVPD[rand1][1], DeathmatchLVPD[rand1][2], DeathmatchLVPD[rand1][3], 1001002425301); // each DM has to get it's own zone ID.
        
}
        case 
2// Second DM
        
{
            new 
rand1 random(sizeof(DeathmatchJeffersonMotel));
            
CreateDM(
            
playeridDeathmatchJeffersonMotel[rand1][0], DeathmatchJeffersonMotel[rand1][1], DeathmatchJeffersonMotel[rand1][2], DeathmatchJeffersonMotel[rand1][3], 10010024251501);
        }
    
//here havent }
    
return 1;

check again
Reply
#5

Quote:
Originally Posted by Alvitr
Посмотреть сообщение
PHP код:
RespawnInDM(playerid)
{
    switch(
DMZone[playerid])
    {
        case 
1// First DM
        
{
            new 
rand1 random(sizeof(DeathmatchLVPD));
            
CreateDM(
            
playeridDeathmatchLVPD[rand1][0], DeathmatchLVPD[rand1][1], DeathmatchLVPD[rand1][2], DeathmatchLVPD[rand1][3], 1001002425301); // each DM has to get it's own zone ID.
        
}
        case 
2// Second DM
        
{
            new 
rand1 random(sizeof(DeathmatchJeffersonMotel));
            
CreateDM(
            
playeridDeathmatchJeffersonMotel[rand1][0], DeathmatchJeffersonMotel[rand1][1], DeathmatchJeffersonMotel[rand1][2], DeathmatchJeffersonMotel[rand1][3], 10010024251501);
        }
    
//here havent }
    
return 1;

check again
Nope, I still get the error.
Reply
#6

Quote:
Originally Posted by aoky
Посмотреть сообщение
Nope, I still get the error.
PHP код:
RespawnInDM(playerid

    switch(
DMZone[playerid]) 
    { 
        case 
1// First DM 
        

            new 
rand1 random(sizeof(DeathmatchLVPD)); 
            
CreateDM
            
playeridDeathmatchLVPD[rand1][0], DeathmatchLVPD[rand1][1], DeathmatchLVPD[rand1][2], DeathmatchLVPD[rand1][3], 1001002425301); // each DM has to get it's own zone ID. 
        

        case 
2// Second DM 
        

            new 
rand1 random(sizeof(DeathmatchJeffersonMotel)); 
            
CreateDM
            
playeridDeathmatchJeffersonMotel[rand1][0], DeathmatchJeffersonMotel[rand1][1], DeathmatchJeffersonMotel[rand1][2], DeathmatchJeffersonMotel[rand1][3], 10010024251501); 
        } 
    }
//here must need } to close it
    
return 1

umm...have you add } at there i comment

i added, you can try it
or another err?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)