/enter geht nur einmal

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
  • Ja bei mir kann ich /enter nur einmal benutzen bei Grove Street muss ich immer was anderes wie /genter undsoweiter also bei alle Fraktionen..


    if(strcmp(cmd, "/enter", true) == 0)
    {
    if(IsPlayerInRangeOfPoint(playerid,3.0,1154.3900,-1440.2579,15.7969))
    {
    SetPlayerPos(playerid,-2240.468505,137.060440,1035.414062);
    SetPlayerInterior(playerid,6);
    SetPlayerVirtualWorld(playerid,9);
    }
    }


    Grüße
    [GR]WiZZY.


    Galaxy RealLife

    Server Owner

  • Hallo,


    zunächst einmal, fange bitte nicht mit /enter und /exit an. Wenn ich das auf Servern sehe, bekomme ich einen Anfall. Nun gut, zu deiner Frage:


    Du musst einfach unter der if- Abfrage weitere Abfragen mit else if anhängen.

  • Bei mir sieht das so aus:
    if(strcmp(cmd, "/enter", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    for(new i = 0; i<MAX_HOUSES; i++)
    {
    format(str, sizeof str, "/Houses/%d.ini", i);
    if(fexist(str))
    {
    if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[i][hEntrx], HouseInfo[i][hEntry], HouseInfo[i][hEntrz]))
    {
    if(HouseInfo[i][hLocked])
    {
    if(PlayerInfo[playerid][pHouseKey] == i || PlayerInfo[playerid][pRentHouseKey] == i||IsACop(playerid))
    {
    SetPlayerPos(playerid, HouseInfo[i][hIntx], HouseInfo[i][hInty], HouseInfo[i][hIntz]);
    SetPlayerInterior(playerid, HouseInfo[i][hInt]);
    SetPlayerVirtualWorld(playerid, i);
    return 1;
    }
    else
    {
    SendClientMessage(playerid, COLOR_GRAD1, "Abgeschlossen!");
    return 1;
    }
    }
    else if(!HouseInfo[i][hLocked])
    {
    SetPlayerPos(playerid, HouseInfo[i][hIntx], HouseInfo[i][hInty], HouseInfo[i][hIntz]);
    SetPlayerInterior(playerid, HouseInfo[i][hInt]);
    SetPlayerVirtualWorld(playerid, i);
    return 1;
    }
    }
    }
    }
    if(IsPlayerInRangeOfPoint(playerid,2.0,1720.2097,-1741.0798,13.5469))
    {
    PlayerInfo[playerid][Paintball] = 1;
    SetPlayerPos(playerid,-975.975708,1060.983032,1345.671875);
    SetPlayerInterior(playerid,10);
    SendClientMessage(playerid,COLOR_GREEN,"____________________________ Paintball ____________________________");
    SendClientMessage(playerid,COLOR_GRAD1,"Du hast die Paintball Arena betreten.Wir wünschen dir Viel Spaß!");
    SendClientMessage(playerid,COLOR_GREEN,"___________________________________________________________________");
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid,24,500);
    GivePlayerWeapon(playerid,29,500);
    GivePlayerWeapon(playerid,25,500);
    GivePlayerMoney(playerid, -5000);
    SetTimer("Paintballraus", 600000, 0);
    return 1;
    }
    if(IsPlayerInRangeOfPoint(playerid,3.0,1310.2528,-1367.1868,13.5232))
    {
    SetPlayerPos(playerid,-1462.4629,938.0257,1036.6064);
    SetPlayerInterior(playerid,15);
    }
    if(PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)
    {
    if(IsPlayerInRangeOfPoint(playerid,3.0,-2717.8894,-317.6792,7.8438))
    {
    SetPlayerPos(playerid,2324.419921,-1145.568359,1050.710083);
    SetPlayerInterior(playerid,12);
    }
    }
    if(PlayerInfo[playerid][pMember] == 22 || PlayerInfo[playerid][pLeader] == 22)
    {
    if(IsPlayerInRangeOfPoint(playerid,3.0,-540.0740,-505.9044,25.5234))
    {
    SetPlayerPos(playerid,300.6332,305.8026,1003.5391);
    SetPlayerInterior(playerid,4);
    SetPlayerVirtualWorld(playerid,12);
    }
    }


    if(PlayerInfo[playerid][pMember] == 19 || PlayerInfo[playerid][pLeader] == 19)
    {
    if(IsPlayerInRangeOfPoint(playerid,3.0,-315.1326,1773.4491,43.6406))
    {
    SetPlayerPos(playerid,2807.619873,-1171.899902,1025.570312);
    SetPlayerInterior(playerid,8);
    SetPlayerVirtualWorld(playerid,12);
    }
    }
    if(PlayerInfo[playerid][pMember] == 18 || PlayerInfo[playerid][pLeader] == 18)
    {
    if(IsPlayerInRangeOfPoint(playerid,3.0,-2119.5837,-177.7518,35.3203))
    {
    SetPlayerPos(playerid,-2637.69,1404.24,906.46);
    SetPlayerInterior(playerid,3);
    SetPlayerVirtualWorld(playerid,10);
    }
    }
    if(PlayerInfo[playerid][pMember] == 17 || PlayerInfo[playerid][pLeader] == 17)
    {
    if(IsPlayerInRangeOfPoint(playerid,3.0,2522.6704,-2018.9017,14.0744))
    {
    SetPlayerPos(playerid,1262.4510,-785.2432,1091.9063);
    SetPlayerInterior(playerid,5);
    SetPlayerVirtualWorld(playerid,9);
    }
    }
    if(PlayerInfo[playerid][pMember] == 16 || PlayerInfo[playerid][pLeader] == 16)
    {
    if(IsPlayerInRangeOfPoint(playerid,3.0,2526.7761,-1033.5236,69.5792))
    {
    SetPlayerPos(playerid,318.565,1115.210,1083.58);
    SetPlayerInterior(playerid,5);
    SetPlayerVirtualWorld(playerid,15);
    }
    }
    if(PlayerInfo[playerid][pMember] == 15 || PlayerInfo[playerid][pLeader] == 15)
    {
    if(IsPlayerInRangeOfPoint(playerid,3.0,-329.6922,1536.7266,76.6117))
    {
    SetPlayerPos(playerid,2807.619873,-1171.899902,1025.570312);
    SetPlayerInterior(playerid,8);
    SetPlayerVirtualWorld(playerid,7);
    }
    }

    if(PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14)
    {
    if(IsPlayerInRangeOfPoint(playerid,3.0,1999.9824,-1114.3895,27.1250))
    {
    SetPlayerPos(playerid,2553.6584,-1283.3613,1060.9844);
    SetPlayerInterior(playerid,2);
    SetPlayerVirtualWorld(playerid,2);
    }
    }
    if(PlayerInfo[playerid][pMember] == 12 || PlayerInfo[playerid][pLeader] == 12)
    {
    if(IsPlayerInRangeOfPoint(playerid,3.0,510.7079,-78.3492,998.9609))
    {
    SetPlayerPos(playerid,1273.8680,-1641.0560,27.3750);
    SetPlayerInterior(playerid,0);
    SetPlayerVirtualWorld(playerid,0);
    }
    }
    if(PlayerInfo[playerid][pMember] == 12 || PlayerInfo[playerid][pLeader] == 12)
    {
    if(IsPlayerInRangeOfPoint(playerid,3.0,1240.0183,-1639.6063,13.5469))
    {
    SetPlayerPos(playerid,501.9810,-69.1502,998.7578);
    SetPlayerInterior(playerid,11);
    SetPlayerVirtualWorld(playerid,1);
    }
    }
    if(PlayerInfo[playerid][pMember] == 13 || PlayerInfo[playerid][pLeader] == 13)
    {
    if(IsPlayerInRangeOfPoint(playerid,3.0,2495.3865,-1690.6353,14.7656))
    {
    SetPlayerPos(playerid,2496.65,-1696.55,1014.74);
    SetPlayerInterior(playerid,3);
    SetPlayerVirtualWorld(playerid,5);
    }
    }
    if(PlayerInfo[playerid][pMember] == 9 || PlayerInfo[playerid][pLeader] == 9)
    {
    if(IsPlayerInRangeOfPoint(playerid,3.0,1712.3523,-1640.3364,20.2239))
    {
    SetPlayerPos(playerid,1658.7671,-1641.1302,83.7813);
    SetPlayerInterior(playerid,0);
    }
    }
    if(PlayerInfo[playerid][pMember] == 9 || PlayerInfo[playerid][pLeader] == 9)
    {
    if(IsPlayerInRangeOfPoint(playerid,3.0,1658.6110,-1691.5841,15.6094))
    {
    SetPlayerPos(playerid,1700.9042,-1667.9751,20.2188);
    SetPlayerInterior(playerid,18);
    }
    }
    if(PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pLeader] == 7)
    {
    if(IsPlayerInRangeOfPoint(playerid,3.0,1123.1750,-2036.9468,69.8936))
    {
    SetPlayerInterior(playerid, 5);
    SetPlayerPos(playerid,1262.4510,-785.2432,1091.9063);
    }
    }
    if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8)
    {
    if(IsPlayerInRangeOfPoint(playerid,3.0,300.2709,-1154.4785,81.3909))
    {
    SetPlayerPos(playerid,2807.619873,-1171.899902,1025.570312);
    SetPlayerInterior(playerid,8);
    SetPlayerVirtualWorld(playerid,3);
    }
    }
    if(PlayerInfo[playerid][pMember] == 20 || PlayerInfo[playerid][pLeader] == 20)
    {
    if(IsPlayerInRangeOfPoint(playerid,3.0,2597.6418,1900.5270,11.0312))
    {
    SetPlayerPos(playerid,-2159.122802,641.517517,1052.381713);
    SetPlayerInterior(playerid,1);
    }
    }
    if(PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5)
    {
    if(IsPlayerInRangeOfPoint(playerid,3.0,254.9415,-1366.9342,53.1094))
    {
    SetPlayerPos(playerid,225.630997,1022.479980,1084.069946 );
    SetPlayerInterior(playerid,7);
    SetPlayerVirtualWorld(playerid,12);
    }
    }
    if(IsPlayerInRangeOfPoint(playerid,3.0,690.7373,-1275.6281,13.5601))
    {
    if(PlayerInfo[playerid][pMember] == 23 || PlayerInfo[playerid][pLeader] == 23)
    {
    SetPlayerInterior(playerid,7);
    SetPlayerPos(playerid,225.630991,1022.479980,1084.069946);
    }
    }
    if (IsPlayerInRangeOfPoint(playerid,3.0,1073.0619,-344.5148,73.9922))
    {
    if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8)
    {
    SetPlayerInterior(playerid,2);
    SetPlayerPos(playerid,1205.0947,-10.1685,1000.9219);
    PlayerInfo[playerid][pInt] = 2;
    PlayerInfo[playerid][pLocal] = 242;
    }
    }
    /* else if (IsPlayerInRangeOfPoint(playerid,8.0,2279.8643,2448.0544,3.5313))//WAFFENKAMMER
    {
    if(PlayerInfo[playerid][pLeader]==21 || PlayerInfo[playerid][pMember]==21)
    {
    SetPlayerInterior(playerid,1);
    SetPlayerPos(playerid,286.148986,-40.644397,1001.515625);
    PlayerInfo[playerid][WAKA]=8;
    SetPlayerVirtualWorld(playerid,20);
    }
    }
    else if (IsPlayerInRangeOfPoint(playerid,8.0,202.5454,1869.3562,13.1406))//WAFFENKAMMER
    {
    if(PlayerInfo[playerid][pLeader]==3 || PlayerInfo[playerid][pMember]==3)
    {
    SetPlayerInterior(playerid,1);
    SetPlayerPos(playerid,286.148986,-40.644397,1001.515625);
    PlayerInfo[playerid][WAKA]=9;
    SetPlayerVirtualWorld(playerid,13);
    }
    }
    else if (IsPlayerInRangeOfPoint(playerid,8.0,1568.6294,-1690.3629,5.8906))//WAFFENKAMMER
    {
    if(PlayerInfo[playerid][pLeader]==1 || PlayerInfo[playerid][pMember]==1)
    {
    SetPlayerInterior(playerid,1);
    SetPlayerPos(playerid,286.148986,-40.644397,1001.515625);
    PlayerInfo[playerid][WAKA]=10;
    SetPlayerVirtualWorld(playerid,14);
    }
    }
    else if (IsPlayerInRangeOfPoint(playerid,8.0,-1593.5123,716.3030,-5.2422))//WAFFENKAMMER
    {
    if(PlayerInfo[playerid][pLeader]==2 || PlayerInfo[playerid][pMember]==2)
    {
    SetPlayerInterior(playerid,1);
    SetPlayerPos(playerid,286.148986,-40.644397,1001.515625);
    PlayerInfo[playerid][WAKA]=11;
    SetPlayerVirtualWorld(playerid,15);
    }
    }*/

    else if (IsPlayerInRangeOfPoint(playerid,3.0,2695.6235,-1704.6960,11.8438))
    {
    GameTextForPlayer(playerid, "~w~Willkommen in der 8Ball Arena", 5000, 1);
    SetPlayerInterior(playerid,7);
    SetPlayerPos(playerid,-1404.5299,-259.0602,1043.6563);
    }
    else if (IsPlayerInRangeOfPoint(playerid,8.0,-2111.5686,-443.9720,38.7344))
    {
    GameTextForPlayer(playerid, "~w~Willkommen in der Dirt Arena", 5000, 1);
    SetPlayerInterior(playerid,4);
    SetPlayerPos(playerid,-1443.0554,-581.1879,1055.0472);
    }
    else if (IsPlayerInRangeOfPoint(playerid,8.0,-2080.3079,-406.0309,38.7344))
    {
    GameTextForPlayer(playerid, "~w~Willkommen im der Stunt Arena", 5000, 1);
    SetPlayerInterior(playerid,14);
    SetPlayerPos(playerid,-1464.7732,1557.5533,1052.5313);
    }


    else if (IsPlayerInRangeOfPoint(playerid,5.0,254.8123,1802.1803,7.4448))
    {
    GameTextForPlayer(playerid, "~w~Willkommen im Bunker", 5000, 1);
    SetPlayerInterior(playerid,0);
    SetPlayerPos(playerid,198.1085,1780.7993,7.5693);
    }


    else if(IsPlayerInRangeOfPoint(playerid,3.0,2232.1707,-1159.8075,25.8906))
    {
    GameTextForPlayer(playerid, "~w~Willkommen im arbeitsamt~n~ benutze ~r~/job", 5000, 1);
    SetPlayerInterior(playerid, 15);
    SetPlayerPos(playerid,2216.3401,-1150.5100,1025.7969,270.0000);
    }
    /*else if(IsPlayerInRangeOfPoint(playerid,3.0,1699.9642,-1170.1368,23.8281))
    {
    GameTextForPlayer(playerid, "~w~Willkommen am Uhrenladen", 5000, 1);
    SetPlayerInterior(playerid, 3);
    SetPlayerPos(playerid,833.269775,10.588416,1004.179687);
    }*/
    for(new e = 0; e < MAX_BIZZES; e++){
    if(IsPlayerInRangeOfPoint(playerid, 2.0, BizzInfo[e][bx],BizzInfo[e][by],BizzInfo[e][bz])){
    if(BizzInfo[e][pProds] < 2){SendClientMessage(playerid, COLOR_GRAD1, "Die Produkte sind leer!"); return 1;}
    if(!BizzInfo[e][status]){SendClientMessage(playerid, COLOR_GRAD1, "Das Biz wurde geschlossen"); return 1;}
    SetPlayerPos(playerid,BizzInfo[e][ExitX],BizzInfo[e][ExitY],BizzInfo[e][ExitZ]);
    SetPlayerInterior(playerid, BizzInfo[e][EnterInt]);
    SetPlayerVirtualWorld(playerid, BizzInfo[e][EnterWorld]);
    GivePlayerMoney(playerid, -BizzInfo[e][Epreis]);
    BizzInfo[e][bkasse] += BizzInfo[e][Epreis];
    BizzInfo[e][pProds] -= 2;
    SB(e);
    KB(e);
    LB(e);
    break;
    }
    }return 1;
    }
    return 1;

  • Hallo,


    if und else if Abfragen sind ganz einfach.

    if (IsPlayerInRangeOfPoint(playerid, 3.0, 133, 33, 976))
    {
    // Hier ist er am PD (Hier kommen die SetPlayerPos Funktionen)
    }
    else if (IsPlayerInRangeOfPoint(playerid, 3.0, 4234, 34565, 3123))
    {
    // Hier ist er am BSN (Hier kommen die SetPlayerPos Funktionen)
    }

    Kannst immer mehr else if Abfragen anhängen, um mehr /enter Punkte bestimmen zu können. Wenn du mit "F" oder "ENTER" in ein Gebäude willst, solltest du dir das Callback OnPlayerKeyStateChange anschauen.