Probleme mit DCMD und Else If

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
  • Hallo liebe Community,


    ich habe ein paar Probleme, und zwar habe ich einen Befehl (/enter) mit Dcmd erstellt, danach getestet und alles hat geklappt. Aber jetzt habe ich mehrere Interiors hinzugefügt und jetzt bekomme ich Errors. Hier mein Code.


    public OnPlayerCommandText(playerid, cmdtext[])
    {


    dcmd(enter, 5, cmdtext);
    dcmd(exit, 4, cmdtext);
    return 0;
    }


    dcmd_enter(playerid, params [])
    {
    #pragma unused params
    if(IsPlayerInRangeOfPoint(playerid, 1.2,2424.2473,-1742.7511,13.5460))//-----24/7 an der GrooveStreet
    {
    SetPlayerPos(playerid,-27.2520,-55.6264,1003.5469);
    SetPlayerFacingAngle(playerid,0);
    SetPlayerInterior(playerid,6);
    GameTextForPlayer(playerid, "Willkommen im 24/7 Supermarkt!", 5000, 5);
    }
    else
    {
    SendClientMessage(playerid, 0x00D7FFFF,"** Du befindest dich an keinem Eingang!");
    }
    else if(IsPlayerInRangeOfPoint(playerid, 1.2,1368.4913,-1279.7889,13.5469))//-----Großes AmmuNation-----
    {
    SetPlayerPos(playerid,286.1481,-38.7994,1001.5156);
    SetPlayerFacingAngle(playerid,0.3387);
    SetPlayerInterior(playerid,1);
    GameTextForPlayer(playerid,"Willkommen bei AmmuNation.", 5000, 5);
    }
    else
    {
    SendClientMessage(playerid, 0x00D7FFFF,"** Du befindest dich an keinem Eingang!");
    }
    else if(IsPlayerInRangeOfPoint(playerid, 1.2,1368.4913,-1279.7889,13.5469))//-----Ten Green Bottels Bar-----
    {
    SetPlayerPos(playerid,501.9810,-69.1502,998.7578);
    SetPlayerFacingAngle(playerid,180.0000);
    SetPlayerInterior(playerid,11);
    GameTextForPlayer(playerid,"Willkommen in der Ten Green Bottles Bar.", 5000, 5);
    }
    else
    {
    SendClientMessage(playerid, 0x00D7FFFF,"** Du befindest dich an keinem Eingang!");
    }
    else if(IsPlayerInRangeOfPoint(playerid, 1.2,1199.2666,-918.3735,43.1214))//-----Burger Shot North (BSN)-----
    {
    SetPlayerPos(playerid,365.8046,-73.9349,1001.5078);
    SetPlayerFacingAngle(playerid,269.9556);
    SetPlayerInterior(playerid,11);
    GameTextForPlayer(playerid,"Willkommen im Burger Shot North.", 5000, 5);
    }
    else
    {
    SendClientMessage(playerid, 0x00D7FFFF,"** Du befindest dich an keinem Eingang!");
    }
    return 1;
    }



    dcmd_exit(playerid, params [])
    {
    #pragma unused params
    if (IsPlayerInRangeOfPoint(playerid, 1.2,-27.3434,-58.2487,1003.5469))
    {
    SetPlayerPos(playerid,2422.8091,-1741.5935,13.5469);
    SetPlayerFacingAngle( playerid, 48.2855);
    SetPlayerInterior(playerid,0);
    return 1;
    }
    else
    {
    SendClientMessage(playerid, 0x00D7FFFF,"** Du befindest dich an keinem Ausgang!");
    }
    else if(IsPlayerInRangeOfPoint(playerid, 1.2,1368.4913,-1279.7889,13.5469))//-----Großes AmmuNation-----
    {
    SetPlayerPos(playerid,286.1481,-38.7994,1001.5156);
    SetPlayerFacingAngle(playerid,0.3387);
    SetPlayerInterior(playerid,1);
    GameTextForPlayer(playerid,"Willkommen bei AmmuNation.", 5000, 5);
    }
    else
    {
    SendClientMessage(playerid, 0x00D7FFFF,"** Du befindest dich an keinem Ausgang!");
    }
    else if(IsPlayerInRangeOfPoint(playerid, 1.2,1368.4913,-1279.7889,13.5469))//-----Ten Green Bottels Bar-----
    {
    SetPlayerPos(playerid,501.9810,-69.1502,998.7578);
    SetPlayerFacingAngle(playerid,180.0000);
    SetPlayerInterior(playerid,11);
    GameTextForPlayer(playerid,"Willkommen in der Ten Green Bottles Bar.", 5000, 5);
    }
    else
    {
    SendClientMessage(playerid, 0x00D7FFFF,"** Du befindest dich an keinem Ausgang!");
    }
    else if(IsPlayerInRangeOfPoint(playerid, 1.2,1199.2666,-918.3735,43.1214))//-----Burger Shot North (BSN)-----
    {
    SetPlayerPos(playerid,365.8046,-73.9349,1001.5078);
    SetPlayerFacingAngle(playerid,269.9556);
    SetPlayerInterior(playerid,11);
    GameTextForPlayer(playerid,"Willkommen im Burger Shot North.", 5000, 5);
    }
    else
    {
    SendClientMessage(playerid, 0x00D7FFFF,"** Du befindest dich an keinem Ausgang!");
    }
    return 1;
    }


    Wäre nett wenn Ihr mir helfen könntet.

  • Auf ein else kann kein else if mehr folgen weil else ausgeführt wird wenn alle anderen nicht mehr zutreffen. Da du aber eh immer die gleiche Meldung ausgibst falls der spieler nicht an einem bestimmten punkt ist, kannst du es auch so machen:
    dcmd_enter(playerid, params [])
    {
    #pragma unused params
    if(IsPlayerInRangeOfPoint(playerid, 1.2,2424.2473,-1742.7511,13.5460))//-----24/7 an der GrooveStreet
    {
    SetPlayerPos(playerid,-27.2520,-55.6264,1003.5469);
    SetPlayerFacingAngle(playerid,0);
    SetPlayerInterior(playerid,6);
    GameTextForPlayer(playerid, "Willkommen im 24/7 Supermarkt!", 5000, 5);
    }
    else if(IsPlayerInRangeOfPoint(playerid, 1.2,1368.4913,-1279.7889,13.5469))//-----Großes AmmuNation-----
    {
    SetPlayerPos(playerid,286.1481,-38.7994,1001.5156);
    SetPlayerFacingAngle(playerid,0.3387);
    SetPlayerInterior(playerid,1);
    GameTextForPlayer(playerid,"Willkommen bei AmmuNation.", 5000, 5);
    }
    else if(IsPlayerInRangeOfPoint(playerid, 1.2,1368.4913,-1279.7889,13.5469))//-----Ten Green Bottels Bar-----
    {
    SetPlayerPos(playerid,501.9810,-69.1502,998.7578);
    SetPlayerFacingAngle(playerid,180.0000);
    SetPlayerInterior(playerid,11);
    GameTextForPlayer(playerid,"Willkommen in der Ten Green Bottles Bar.", 5000, 5);
    }
    else if(IsPlayerInRangeOfPoint(playerid, 1.2,1199.2666,-918.3735,43.1214))//-----Burger Shot North (BSN)-----
    {
    SetPlayerPos(playerid,365.8046,-73.9349,1001.5078);
    SetPlayerFacingAngle(playerid,269.9556);
    SetPlayerInterior(playerid,11);
    GameTextForPlayer(playerid,"Willkommen im Burger Shot North.", 5000, 5);
    }
    else
    {
    SendClientMessage(playerid, 0x00D7FFFF,"** Du befindest dich an keinem Eingang!");
    }
    return 1;
    }



    dcmd_exit(playerid, params [])
    {
    #pragma unused params
    if (IsPlayerInRangeOfPoint(playerid, 1.2,-27.3434,-58.2487,1003.5469))
    {
    SetPlayerPos(playerid,2422.8091,-1741.5935,13.5469);
    SetPlayerFacingAngle( playerid, 48.2855);
    SetPlayerInterior(playerid,0);
    return 1;
    }
    else if(IsPlayerInRangeOfPoint(playerid, 1.2,1368.4913,-1279.7889,13.5469))//-----Großes AmmuNation-----
    {
    SetPlayerPos(playerid,286.1481,-38.7994,1001.5156);
    SetPlayerFacingAngle(playerid,0.3387);
    SetPlayerInterior(playerid,1);
    GameTextForPlayer(playerid,"Willkommen bei AmmuNation.", 5000, 5);
    }
    else if(IsPlayerInRangeOfPoint(playerid, 1.2,1368.4913,-1279.7889,13.5469))//-----Ten Green Bottels Bar-----
    {
    SetPlayerPos(playerid,501.9810,-69.1502,998.7578);
    SetPlayerFacingAngle(playerid,180.0000);
    SetPlayerInterior(playerid,11);
    GameTextForPlayer(playerid,"Willkommen in der Ten Green Bottles Bar.", 5000, 5);
    }
    else if(IsPlayerInRangeOfPoint(playerid, 1.2,1199.2666,-918.3735,43.1214))//-----Burger Shot North (BSN)-----
    {
    SetPlayerPos(playerid,365.8046,-73.9349,1001.5078);
    SetPlayerFacingAngle(playerid,269.9556);
    SetPlayerInterior(playerid,11);
    GameTextForPlayer(playerid,"Willkommen im Burger Shot North.", 5000, 5);
    }
    else
    {
    SendClientMessage(playerid, 0x00D7FFFF,"** Du befindest dich an keinem Ausgang!");
    }
    return 1;
    }

    The fact is, I am right. And if you think I'm wrong, you are wrong.