Problem mit Unbekannten Warnings!

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

  • if(gPlayerLogged[playerid] == 0)
    {
    SendClientMessage(playerid, COLOR_LIGHTRED, "** Du musst dich vorher einloggen oder dir einen Account erstellen! ***");
    Kick(playerid);
    return 1;


    if(gPlayerAccount[playerid] == 1) //Hier
    {
    ForceClassSelection(playerid);
    TogglePlayerSpectating(playerid, 0);
    }
    else if(gPlayerAccount[playerid] == 0)
    {
    ForceClassSelection(playerid);
    TogglePlayerSpectating(playerid, 0);
    }
    return 1;



    }




    C:\Users\-\Desktop\-\gamemodes\GNE.pwn(6084) : warning 225: unreachable code
    C:\Users\-\Desktop\-\gamemodes\GNE.pwn(45529) : warning 225: unreachable code //Hier gibt es kein Code iwie!


  • STDPlayer[playerid] = 0;
    gTeam[playerid] = PlayerInfo[playerid][pTeam]; //Set the Team
    if (gTeam[playerid] == 4) //medic / criminal reset team
    {
    gTeam[playerid] = 3;
    }
    if(gPlayerLogged[playerid] == 0)
    {
    SendClientMessage(playerid, COLOR_LIGHTRED, "** Du musst dich vorher einloggen oder dir einen Account erstellen! ***");
    Kick(playerid);
    return 1;
    }
    if(gPlayerAccount[playerid] == 1)
    {
    ForceClassSelection(playerid);
    TogglePlayerSpectating(playerid, 0);
    }
    else if(gPlayerAccount[playerid] == 0)
    {
    ForceClassSelection(playerid);
    TogglePlayerSpectating(playerid, 0);
    }
    return 1;



    }


    Compeliert er garnichtmehr.
    Genauso wen ich die Klammer anders rum mache komm Viele Warnings = Klammerfehler Warnings

  • Undso?:

    [list=1][*]if(gPlayerLogged[playerid] == 0)
    [*]{
    [*]SendClientMessage(playerid, COLOR_LIGHTRED, "** Du musst dich vorher einloggen oder dir einen Account erstellen! ***");
    [*]Kick(playerid);
    [*]return 1;
    [*]}
    [*]if(gPlayerAccount[playerid] == 1) //Hier
    [*]{
    [*]ForceClassSelection(playerid);
    [*]TogglePlayerSpectating(playerid, 0);
    [*]}
    [*]else if(gPlayerAccount[playerid] == 0)
    [*]{
    [*]ForceClassSelection(playerid);
    [*]TogglePlayerSpectating(playerid, 0);
    [*]}
    [*]return 1;
    [*]}
    [/list]

  • Probiers mal so:

    Code
    if (gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "** Du musst dich vorher einloggen oder dir einen Account erstellen! ***"), Kick(playerid);
    if (gPlayerAccount[playerid] == 1) {ForceClassSelection(playerid); TogglePlayerSpectating(playerid, 0);}
    else if(gPlayerAccount[playerid] == 0) {ForceClassSelection(playerid); TogglePlayerSpectating(playerid, 0);}
    return 1;


    Wobei Zeile 2 und 3 eigentlich Irrsinn sind. Man kann sie auch zusammenfassen:

    Code
    if (gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "** Du musst dich vorher einloggen oder dir einen Account erstellen! ***"), Kick(playerid);
    if (gPlayerAccount[playerid] == 0 || gPlayerAccount[playerid] == 1) {ForceClassSelection(playerid); TogglePlayerSpectating(playerid, 0);}
    return 1;


    Nachtrag:


  • Function OnPlayerSpawn(playerid)
    {
    StopAudioStreamForPlayer(playerid);
    M_OnPlayerSpawn(playerid);
    TextDrawShowForPlayer(playerid,Copyright);
    TextDrawShowForPlayer(playerid,Datum);
    GW_OnPlayerSpawn(playerid);
    if(PlayerInfo[playerid][pTot] == 1 && PlayerInfo[playerid][pLevel] > 1)
    {
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_YELLOW, "|________ Krankenhaus ________|");
    SendClientMessage(playerid, COLOR_ORANGE, "Du bist gestorben , deswegen bist du im Krankenhaus");
    SendClientMessage(playerid, COLOR_ORANGE, "Warte 60 Sekunden bis deine Behandlung fertig ist!");
    SetPlayerSpawn(playerid);
    if(IsPlayerInFrac(playerid, 1))
    {
    SetPlayerColor(playerid,NAMECOLOR_LSCOP);
    }
    else if(IsPlayerInFrac(playerid, 4))
    {
    SetPlayerColor(playerid, NAMECOLOR_MEDIC);
    }
    else
    {
    SetPlayerColor(playerid,TEAM_HIT_COLOR);
    }
    ResetPlayerWeapons(playerid);
    return 1;
    }
    STDPlayer[playerid] = 0;
    gTeam[playerid] = PlayerInfo[playerid][pTeam]; //Set the Team
    if (gTeam[playerid] == 4) //medic / criminal reset team
    {
    gTeam[playerid] = 3;
    }
    if(gPlayerLogged[playerid] == 0)
    {
    SendClientMessage(playerid, COLOR_LIGHTRED, "** Du musst dich vorher einloggen oder dir einen Account erstellen! ***");
    Kick(playerid);
    return 1;
    }
    if(gPlayerAccount[playerid] == 1)
    {
    ForceClassSelection(playerid);
    TogglePlayerSpectating(playerid, 0);
    }
    else if(gPlayerAccount[playerid] == 0)
    {
    ForceClassSelection(playerid);
    TogglePlayerSpectating(playerid, 0);
    }
    return 1;
    }
    if(AtClothes[playerid] == 1)
    {
    PlayerInfo[playerid][pChar] = GetPlayerSkin(playerid);
    PlayerInfo[playerid][pModel] = GetPlayerSkin(playerid);
    AtClothes[playerid] = 0;
    }
    if(gTeam[playerid] == 11 && PlayerInfo[playerid][pLeader] < 1)
    {
    MedicBill[playerid] = 0;
    new rand = random(sizeof(CIV));
    SendClientMessage(playerid, COLOR_LIGHTRED, "Du bist kein Chef dieser Familie, du bist Zivilist !");
    PlayerInfo[playerid][pTeam] = 3;
    gTeam[playerid] = 3;
    SetSpawnInfo(playerid, gTeam[playerid], CIV[rand],0.0,0.0,0.0,0,0,0,0,0,0,0);
    PlayerInfo[playerid][pModel] = CIV[rand];
    SpawnPlayer(playerid);


    }


    Entweder er hasst mich oder warum auch immer.......
    er will einfach nicht compeliren?!

  • Schau mal, vielleicht findest du ja selber den Fehler ;)



    Das Einrücken hat ja einen Sinn ^^ .

  • Ab Zeile 62, der Code steht außerhalb der Funktion.
    Schreibe es so:
    Function OnPlayerSpawn(playerid)
    {
    StopAudioStreamForPlayer(playerid);
    M_OnPlayerSpawn(playerid);
    TextDrawShowForPlayer(playerid,Copyright);
    TextDrawShowForPlayer(playerid,Datum);
    GW_OnPlayerSpawn(playerid);
    if(PlayerInfo[playerid][pTot] == 1 && PlayerInfo[playerid][pLevel] > 1)
    {
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_YELLOW, "|________ Krankenhaus ________|");
    SendClientMessage(playerid, COLOR_ORANGE, "Du bist gestorben , deswegen bist du im Krankenhaus");
    SendClientMessage(playerid, COLOR_ORANGE, "Warte 60 Sekunden bis deine Behandlung fertig ist!");
    SetPlayerSpawn(playerid);
    if(IsPlayerInFrac(playerid, 1))
    {
    SetPlayerColor(playerid,NAMECOLOR_LSCOP);
    }
    else if(IsPlayerInFrac(playerid, 4))
    {
    SetPlayerColor(playerid, NAMECOLOR_MEDIC);
    }
    else
    {
    SetPlayerColor(playerid,TEAM_HIT_COLOR);
    }
    ResetPlayerWeapons(playerid);
    return 1;
    }
    STDPlayer[playerid] = 0;
    gTeam[playerid] = PlayerInfo[playerid][pTeam]; //Set the Team
    if (gTeam[playerid] == 4) //medic / criminal reset team
    {
    gTeam[playerid] = 3;
    }
    if(gPlayerLogged[playerid] == 0)
    {
    SendClientMessage(playerid, COLOR_LIGHTRED, "** Du musst dich vorher einloggen oder dir einen Account erstellen! ***");
    Kick(playerid);
    return 1;
    }
    if(gPlayerAccount[playerid] == 1)
    {
    ForceClassSelection(playerid);
    TogglePlayerSpectating(playerid, 0);
    }
    else if(gPlayerAccount[playerid] == 0)
    {
    ForceClassSelection(playerid);
    TogglePlayerSpectating(playerid, 0);
    }
    if(AtClothes[playerid] == 1)
    {
    PlayerInfo[playerid][pChar] = GetPlayerSkin(playerid);
    PlayerInfo[playerid][pModel] = GetPlayerSkin(playerid);
    AtClothes[playerid] = 0;
    }
    if(gTeam[playerid] == 11 && PlayerInfo[playerid][pLeader] < 1)
    {
    MedicBill[playerid] = 0;
    new rand = random(sizeof(CIV));
    SendClientMessage(playerid, COLOR_LIGHTRED, "Du bist kein Chef dieser Familie, du bist Zivilist !");
    PlayerInfo[playerid][pTeam] = 3;
    gTeam[playerid] = 3;
    SetSpawnInfo(playerid, gTeam[playerid], CIV[rand],0.0,0.0,0.0,0,0,0,0,0,0,0);
    PlayerInfo[playerid][pModel] = CIV[rand];
    SpawnPlayer(playerid);
    }
    return 1;
    }


  • ocmd:motor(playerid,params[])
    {
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 1;
    new engine,lights,alarm,doors,bonnet,boot,objective;
    new vid = GetPlayerVehicleID(playerid);
    //new string[255];
    //new sendername;
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    if(vid != INVALID_VEHICLE_ID)
    {
    if(engine == VEHICLE_PARAMS_ON)
    {
    SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    //format(string, sizeof(string), "* %s stellt den Motor ab.", sendername);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, "Du stellst den Motor ab.");
    //ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    }
    else
    {
    SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
    //format(string, sizeof(string), "* %s betätigt die Zündung. Der Motor springt an!", sendername);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, "Du betätigst die Zündung.");
    //ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    }
    }
    return 1;
    }


    Wollte Fragen wie man das %s bestätigt die Zündung. Der Motor springt an! wie man das von dem Spieler am kopf anziegen lassen kann?


    wie kann ich machen wen ich motor ausmache das das licht aus geht?



    ocmd:licht(playerid,params[])
    {
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 1;
    new engine,lights,alarm,doors,bonnet,boot,objective;
    new vid = GetPlayerVehicleID(playerid);
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    if(vid != INVALID_VEHICLE_ID)
    if(vid != INVALID_VEHICLE_ID)
    {
    if(lights == VEHICLE_PARAMS_ON)
    {
    SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
    }
    else
    {
    SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
    }
    }
    return 1;
    }

  • ocmd:motor(playerid,params[])
    {
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 1;
    new engine,lights,alarm,doors,bonnet,boot,objective;
    new vid = GetPlayerVehicleID(playerid);
    new string[145];
    new sendername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, sendername, MAX_PLAYER_NAME);
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    if(vid != INVALID_VEHICLE_ID)
    {
    if(engine == VEHICLE_PARAMS_ON)
    {
    SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
    format(string, sizeof(string), "* %s stellt den Motor ab.", sendername);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, "Du stellst den Motor ab.");
    //ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    }
    else
    {
    SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
    format(string, sizeof(string), "* %s betätigt die Zündung. Der Motor springt an!", sendername);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, "Du betätigst die Zündung.");
    //ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    }
    SetPlayerChatBubble(playerid, string, 0xFFFFFFFF, 100.0, 10000); //10 Sekunden, 100 Meter
    }
    return 1;
    }


  • Function OnPlayerSpawn(playerid)
    {
    StopAudioStreamForPlayer(playerid);
    M_OnPlayerSpawn(playerid);
    TextDrawShowForPlayer(playerid,Copyright);
    TextDrawShowForPlayer(playerid,Datum);
    GW_OnPlayerSpawn(playerid);
    if(PlayerInfo[playerid][pTot] == 1 && PlayerInfo[playerid][pLevel] > 1)
    {
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_LIGHTRED, " ");
    SendClientMessage(playerid, COLOR_YELLOW, "|________ Krankenhaus ________|");
    SendClientMessage(playerid, COLOR_ORANGE, "Du bist gestorben , deswegen bist du im Krankenhaus");
    SendClientMessage(playerid, COLOR_ORANGE, "Warte 60 Sekunden bis deine Behandlung fertig ist!");
    SetPlayerSpawn(playerid);
    if(IsPlayerInFrac(playerid, 1))
    {
    SetPlayerColor(playerid,NAMECOLOR_LSCOP);
    }
    else if(IsPlayerInFrac(playerid, 4))
    {
    SetPlayerColor(playerid, NAMECOLOR_MEDIC);
    }
    else
    {
    SetPlayerColor(playerid,TEAM_HIT_COLOR);
    }
    ResetPlayerWeapons(playerid);
    return 1;
    }
    STDPlayer[playerid] = 0;
    gTeam[playerid] = PlayerInfo[playerid][pTeam]; //Set the Team
    if (gTeam[playerid] == 4) //medic / criminal reset team
    {
    gTeam[playerid] = 3;
    }
    if(gPlayerLogged[playerid] == 0)
    {
    SendClientMessage(playerid, COLOR_LIGHTRED, "** Du musst dich vorher einloggen oder dir einen Account erstellen! ***");
    Kick(playerid);
    return 1;
    }
    if(gPlayerAccount[playerid] == 1)
    {
    ForceClassSelection(playerid);
    TogglePlayerSpectating(playerid, 0);
    }
    else if(gPlayerAccount[playerid] == 0)
    {
    ForceClassSelection(playerid);
    TogglePlayerSpectating(playerid, 0);
    }
    if(AtClothes[playerid] == 1)
    {
    PlayerInfo[playerid][pChar] = GetPlayerSkin(playerid);
    PlayerInfo[playerid][pModel] = GetPlayerSkin(playerid);
    AtClothes[playerid] = 0;
    }
    if(gTeam[playerid] == 11 && PlayerInfo[playerid][pLeader] < 1)
    {
    MedicBill[playerid] = 0;
    new rand = random(sizeof(CIV));
    SendClientMessage(playerid, COLOR_LIGHTRED, "Du bist kein Chef dieser Familie, du bist Zivilist !");
    PlayerInfo[playerid][pTeam] = 3;
    gTeam[playerid] = 3;
    SetSpawnInfo(playerid, gTeam[playerid], CIV[rand],0.0,0.0,0.0,0,0,0,0,0,0,0);
    PlayerInfo[playerid][pModel] = CIV[rand];
    SpawnPlayer(playerid);
    }


    es funktioniert aber irgendwie wen ich mich einlogge kann ich nicht mehr spawnen?


  • Kommt er überhaupt zu OnPlayerSpawn? Soll heissen, nach OnPlayerRequestClass sollte SpawnPlayer kommen. Im übrigen fehlt dir oben ein RETURN 1; und eine Klammer.



    Falls dies nicht geht, entfern mal deinen Code innerhalb OnPlayerSpawn und hau da mal ein

    Code
    print("ich spawne");
    return 1;

    zum Testen rein.