Case

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • Ich würde gerne wissen wie ich nach case 3 wieder auf case 0 springe.


    switch(CurrentMap)
    {
    case 0:
    {


    SendClientMessage(playerid,WHITE,"");
    SendClientMessage(playerid,WHITE,"");
    SendClientMessage(playerid,WHITE,"");
    SendClientMessage(playerid,WHITE,"");
    SendClientMessage(playerid,WHITE,"");
    SendClientMessage(playerid,GREEN,"____________________________________________");
    SendClientMessage(playerid,WHITE,"- Karte : Wüste -");
    SendClientMessage(playerid,WHITE,"- happy fragging ! -");
    SendClientMessage(playerid,GREEN,"____________________________________________");
    SendClientMessage(playerid,WHITE,"");
    SendClientMessage(playerid,WHITE,"");
    SendClientMessage(playerid,WHITE,"");
    SendClientMessage(playerid,WHITE,"");
    SetPlayerInterior(playerid,0);
    if(gTeam[playerid] == TEAM_BLUE) {
    SetPlayerPos(playerid,6286.1719,-2129.5879,12.6453);
    SetPlayerFacingAngle(playerid,314.8662);


    }
    if(gTeam[playerid] == TEAM_RED) {

    SetPlayerPos(playerid,6212.8721,-2189.0254,5.4562);
    SetPlayerFacingAngle(playerid,177.7062);
    SetPlayerInterior(playerid,0);


    //Wüste


    }
    }
    case 1:
    {
    SendClientMessage(playerid,WHITE,"");
    SendClientMessage(playerid,WHITE,"");
    SendClientMessage(playerid,WHITE,"");
    SendClientMessage(playerid,WHITE,"");
    SendClientMessage(playerid,GREEN,"____________________________________________");
    SendClientMessage(playerid,WHITE,"- Karte : Dschungel -");
    SendClientMessage(playerid,WHITE,"- happy fragging ! -");
    SendClientMessage(playerid,GREEN,"____________________________________________");
    SendClientMessage(playerid,WHITE,"");
    SendClientMessage(playerid,WHITE,"");
    SendClientMessage(playerid,WHITE,"");
    SendClientMessage(playerid,WHITE,"");
    //DSCHUNGEL;
    SetPlayerInterior(playerid,0);


    if(gTeam[playerid] == TEAM_BLUE) {
    SetPlayerPos(playerid,2874.7771,-3061.0977,379.8411);
    SetPlayerFacingAngle(playerid,228.1154);
    SetPlayerInterior(playerid,0);


    }
    if(gTeam[playerid] == TEAM_RED) {
    SetPlayerPos(playerid,2875.2122,-2981.9343,376.3135);
    SetPlayerFacingAngle(playerid,15.4068);
    SetPlayerInterior(playerid,0);


    }
    }


    case 2:
    {
    //de_dust1


    SendClientMessage(playerid,WHITE,"");
    SendClientMessage(playerid,WHITE,"");
    SendClientMessage(playerid,WHITE,"");
    SendClientMessage(playerid,WHITE,"");
    SendClientMessage(playerid,GREEN,"____________________________________________");
    SendClientMessage(playerid,WHITE,"- Karte : De_Dust1 -");
    SendClientMessage(playerid,WHITE,"- happy fragging ! -");
    SendClientMessage(playerid,GREEN,"____________________________________________");
    SendClientMessage(playerid,WHITE,"");
    SendClientMessage(playerid,WHITE,"");
    SendClientMessage(playerid,WHITE,"");
    SendClientMessage(playerid,WHITE,"");
    SetPlayerInterior(playerid,0);
    if(gTeam[playerid] == TEAM_BLUE) {
    SetPlayerPos(playerid,1756.6603,-4740.8545,756.3553);
    SetPlayerFacingAngle(playerid,69.1259);
    SetPlayerInterior(playerid,0);


    }
    if(gTeam[playerid] == TEAM_RED)
    {
    SetPlayerPos(playerid,1770.3132,-4941.1060,753.9554);
    SetPlayerFacingAngle(playerid,242.8826);
    SetPlayerInterior(playerid,0);




    }


    }
    }
    return 1;
    }

  • Du könntest es natürlich ganz böse mit goto machen, jedoch würde ich stark davon abraten.
    Lager die Funktionalität vom "Case 0" in einer Funktion aus, und ruf die am Ende von "Case 2" auf.


    #Brotfischbaron


    In schā'a llāh

  • Wenn du keine andere Lösung hast, mache es mit goto ^^


    Hier:


    //unter case 0:
    stop:


    //unter case 2:
    goto stop;


    mfg. :thumbup:

    ast2ufdyxkb1.png


    Leute, lernt scripten und versucht mal lieber etwas selber zu schreiben, als es aus einem GF zu kopieren. :S