SA-MP Forums Archive
[Duda] Que quiere decir este error ? :O - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: [Duda] Que quiere decir este error ? :O (/showthread.php?tid=308491)



[Duda] Que quiere decir este error ? :O - [Nikk] - 03.01.2012

Quote:

error 040: duplicate "case" label (value 5)

Que quiere decir ?

Solucionado Xd

Lo que quiere decir es que Repetiste un case.

Ejemplo.

pawn Код:
case ClassTrainDriver
        {
            Index = random(sizeof(ASpawnLocationsRoadWorker));
            x = ASpawnLocationsRoadWorker[Index][SpawnX]; // Get the X-position for the spawnlocation
            y = ASpawnLocationsRoadWorker[Index][SpawnY]; // Get the Y-position for the spawnlocation
            z = ASpawnLocationsRoadWorker[Index][SpawnZ]; // Get the Z-position for the spawnlocation
            Angle = ASpawnLocationsRoadWorker[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
            format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} joined {FFFF00}Roadworker class", Name);
        }
        case ClassTrainDriver:
        {
            Index = random(sizeof(ASpawnLocationsTrainDriver));
            x = ASpawnLocationsTrainDriver[Index][SpawnX]; // Get the X-position for the spawnlocation
            y = ASpawnLocationsTrainDriver[Index][SpawnY]; // Get the Y-position for the spawnlocation
            z = ASpawnLocationsTrainDriver[Index][SpawnZ]; // Get the Z-position for the spawnlocation
            Angle = ASpawnLocationsTrainDriver[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
            format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} joined {FFFF00}Train Driver class", Name);
        }



Respuesta: [Duda] Que quiere decir este error ? :O - TheChaoz - 03.01.2012

significa que tenes el valor 5 en 2 casos diferentes.
Ej:
pawn Код:
new rnd = random(8);
switch(rnd){
    case 0, 1, 2:
        print("caso 0, 1 o 2");
    case 3 .. 6:
        print("caso 3-6");
    case 7, 8://valor repetido (8)
        print("caso 7 u 8");
    case 8://valor repetido
        print("caso 8");
}



Respuesta: [Duda] Que quiere decir este error ? :O - [Nikk] - 03.01.2012

Quote:
Originally Posted by the_chaoz
Посмотреть сообщение
significa que tenes el valor 5 en 2 casos diferentes.
Ej:
pawn Код:
new rnd = random(8);
switch(rnd){
    case 0, 1, 2:
        print("caso 0, 1 o 2");
    case 3 .. 6:
        print("caso 3-6");
    case 7, 8://valor repetido (8)
        print("caso 7 u 8");
    case 8://valor repetido
        print("caso 8");
}
Exacto, justo me di cuenta gracias igual por responder