Only a single statement (or expression) can follow each "case"
#1

(11479) : error 002: only a single statement (or expression) can follow each "case"
(11479) : warning 215: expression has no effect
(11481) : warning 217: loose indentation
(11489) : warning 217: loose indentation

11447 -- 11486:
pawn Код:
if (CarJackingTimer == 0)
            {
                new Car = GetPlayerVehicleID(playerid), Model = GetVehicleModel(Car);
                switch(Model)
                {
                  case 400, 424, 470, 489, 495, 500, 505, 579:
                  {
                        new carprice = 8000 + random(3500);
                        SetVehicleToRespawn(Car);
                        format(string,sizeof(string),"[CAR JACKER:] You sold this jeep for %s.", carprice);
                        SendClientMessage(playerid, COLOR_WHITE, string);
                        GivePlayerCash(playerid, carprice);
                        CarJackingTimer = 20;
                    }
                    case 401, 404, 405, 410, 412, 413, 418, 419, 436, 440, 445, 458, 466, 467, 474, 554, 475, 479, 580, 482, 483, 491, 492, 566, 516, 517, 518, 526, 527, 529, 534, 540, 542, 543, 546, 547, 549, 550, 551, 567, 575, 576, 585, 589, 600, 426:
                  {
                        new carprice = 2500 + random(3500);
                        SetVehicleToRespawn(Car);
                        format(string,sizeof(string),"[CAR JACKER:] You sold this saloon for %s.", carprice);
                        SendClientMessage(playerid, COLOR_WHITE, string);
                        GivePlayerCash(playerid, carprice);
                        CarJackingTimer = 20;
                    }
                    case 402, 409, 411, 415, 429, 434, 439, 451, 477, 480, 506, 507, 535, 533, 536, 541, 545, 555, 558, 559, 560, 561, 562, 565, 587, 602, 603:
                  {
                        new carprice = 14000 + random(3500);
                        SetVehicleToRespawn(Car);
                        format(string,sizeof(string),"[CAR JACKER:] You sold this sports car for %s.", carprice);
                        SendClientMessage(playerid, COLOR_WHITE, string);
                        GivePlayerCash(playerid, carprice);
                        CarJackingTimer = 20;
                    }
                }
                SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] You can't sell this car.");
            }
            else
            {
                format(string,sizeof(string),"[ERROR:] You need to wait %s more minutes.", CarJackingTimer);
        SendClientMessage(playerid, COLOR_WHITE, string);
            }
I searched the forums about that error but didn't find any solution with this problem. How to fix that? Thank you very much.

OT: 1336th page of this forum n_n
Reply
#2

if you need help about errors check the error section in pawn-lang, so you can mostly (or always) fix the problem by yourself

but its quite strange, i cant see any mistakes in the switch statment
Reply
#3

Okay, i tried to use this instead:
pawn Код:
if(Model == (400 || 424 || 470 || 489 || 495 || 500 || 505 || 579))
But it gives:
Код:
(11452) : warning 217: loose indentation
(11452) : warning 213: tag mismatch
(11481) : warning 217: loose indentation
Or should i do like:
pawn Код:
if((Model == 400) || (Model == 424) || ...))
?


Okay, i found out that in my code was an open bracket which prevented proper compiling Now it compiles fine. Thank you anyways ;]
Reply
#4

pawn Код:
new Model = GetVehicleModel(GetPlayerVehicleID(playerid));
if(Model == 400 || Model == 424 || Model == 470 || Model == 489 || Model == 495 || Model == 500 || Model == 505 || Model == 579)
{
doshitHere();
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)