Beiträge von CaZe

    Jetzt kommt wieder der Fehler wenn ich ein 2tes Haus eintragen möchte er die ExitPositions nicht mehr aus dem Enum lädt und beim 2ten Mal löschen nur das Label löscht.


    //EDIT::
    Das mit den Exit Positionen passiert nur wenn 2x die gleiche Interior ID sowie der gleiche Type erstellt wird.

    Okay Jeffry: Ich habe das Problem gefunden weiß aber natürlich nicht wie ich es beheben soll:
    Beim erstellen des Hauses wird die ID nicht hochgezählt, sondern bleibt immer 0 dato, lösche ich 2 verschiedene Häuser per ID und weil die ID jeweils gleich ist werden zwar beide Einträge aus der DB gelöscht aber es bleibt jedoch 1 PickUp & Label rest da da, diese ja nicht mehr zu einem Haus gehört.

    Hey iPit, ich habe das so geregelt das wenn ein Datenbank eintrag für die VirtualWorld kommt, es mit AUTO_INCREMENT hochgesetzt wird. So musst du dies nicht immer selber rausfinden sondern es wird automatisch hochgezählt. Bei bestimmten Interioren zählst du dann einfach von oben nach unten.(So würde ich dies handhaben)

    Jetzt wird nur das Label & Pickup entfernt wenn es ein Apartment ist.


    Erstell Befehl

    ocmd:hcreate(playerid,params[])
    {
    if(!IsPlayerAnAdmin(playerid))return SendClientMessage(playerid,Rot,"Error: {FFFFFF}You are not allowed to use this Command.");
    if(!IsPlayerAdminRank(playerid,4))return SendClientMessage(playerid,Rot,"Error: {FFFFFF}You are not allowed to use this Command.");
    new inter,price,type;
    if(sscanf(params,"iii",inter,type,price))return SendClientMessage(playerid,Rot,"Error: {FFFFFF}Use /hcreate [Interior ID] [Type] [BuyPrice]"),
    SendClientMessage(playerid,Grau,"[Types]: 1: Apartment, 2: House, 3: Villa");
    if(type < 1 || type > 3)return SendClientMessage(playerid,Rot,"Error: Something's wrong with the Type");
    for(new i=0;i<MAX_HOUSES;i++)
    {
    if(strlen(HouseInfo[i][h_owner]))continue;
    {
    new query[512];
    new Float:pos[3];
    GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
    HouseInfo[i][h_enterX] = pos[0];
    HouseInfo[i][h_enterY] = pos[1];
    HouseInfo[i][h_enterZ] = pos[2];
    new count, tmp;
    for(new j=0; j<sizeof(HouseInfo); j++) if(HouseInfo[j][h_int] == inter && HouseInfo[j][h_type] == type) count++;
    printf("count: %d", count);
    for(new j=0; j<sizeof(InteriorInfo); j++)
    {
    printf("%d == %d | %d == %d", InteriorInfo[j][int_ID], inter, InteriorInfo[j][int_type], type);
    if(InteriorInfo[j][int_ID] == inter && InteriorInfo[j][int_type] == type)
    {
    printf("%d == %d", tmp, count);
    if(tmp == count)
    {
    printf("Nutze InteriorInfo %d", j);
    HouseInfo[i][h_exitX] = InteriorInfo[j][int_exitX];
    HouseInfo[i][h_exitY] = InteriorInfo[j][int_exitY];
    HouseInfo[i][h_exitZ] = InteriorInfo[j][int_exitZ];
    }
    tmp++;
    }
    }
    HouseInfo[i][h_int] = inter;
    format(HouseInfo[i][h_owner], 24, "");
    HouseInfo[i][h_buyprice] = price;
    HouseInfo[i][h_rentprice] = 100;
    HouseInfo[i][h_bought] = 0;
    HouseInfo[i][h_rentable] = 0;
    HouseInfo[i][h_locked] = 1;
    HouseInfo[i][h_money] = 0;
    HouseInfo[i][h_type] = type;
    format(query,sizeof(query),"INSERT INTO Houses (id,Owner,EnterPosX,EnterPosY,EnterPosZ,ExitPosX,ExitPosY,ExitPosZ,Interior,BuyPrice,RentPrice,Bought,RentAble,IsLocked,Money,Type) VALUES ('%i','%s','%f','%f','%f','%f','%f','%f','%i','%i','%i','%i','%i','%i','%i','%i')",
    i,HouseInfo[i][h_owner],HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],HouseInfo[i][h_exitX],HouseInfo[i][h_exitY],HouseInfo[i][h_exitZ],HouseInfo[i][h_int],HouseInfo[i][h_buyprice],HouseInfo[i][h_rentprice],HouseInfo[i][h_bought],HouseInfo[i][h_rentable],HouseInfo[i][h_locked],HouseInfo[i][h_money],HouseInfo[i][h_type]);
    mysql_pquery(Handle,query);
    HouseInfo[i][h_vw] = cache_get_field_content_int(i,"VirtualWorld");
    if(HouseInfo[i][h_type] == 1)
    {
    new str[128];
    format(str,sizeof(str),"This Apartment has NO Owner.Type /buyhouse to buy it.\nPrice: %i$",HouseInfo[i][h_buyprice]);
    HouseInfo[i][h_label] = Create3DTextLabel(str,Weiß,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],10,0,0);
    HouseInfo[i][h_pick] = CreatePickup(1274,0,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],0);
    }
    else if(HouseInfo[i][h_type] == 2)
    {
    new str[128];
    format(str,sizeof(str),"This House has NO Owner.Type /buyhouse to buy it.\nPrice: %i$",HouseInfo[i][h_buyprice]);
    HouseInfo[i][h_label] = Create3DTextLabel(str,Weiß,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],10,0,0);
    HouseInfo[i][h_pick] = CreatePickup(1274,0,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],0);
    }
    else if(HouseInfo[i][h_type] == 3)
    {
    new str[128];
    format(str,sizeof(str),"This Villa has NO Owner.Type /buyhouse to buy it.\nPrice: %i$",HouseInfo[i][h_buyprice]);
    HouseInfo[i][h_label] = Create3DTextLabel(str,Weiß,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],10,0,0);
    HouseInfo[i][h_pick] = CreatePickup(1274,0,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],0);
    }
    return 1;
    }
    }
    return 1;
    }


    Häuser Laden

    stock LoadHouses()
    {
    mysql_pquery(Handle, "SELECT * FROM houses ORDER BY ID ASC","LoadHouses_Data");
    return 1;
    }

    Häuser Laden
    forward LoadHouses_Data();
    public LoadHouses_Data()
    {
    new rows;
    rows = cache_num_rows();
    for(new i=0;i<rows;i++)
    {
    HouseInfo[i][h_ID] = cache_get_field_content_int(i, "id");
    cache_get_field_content(i,"Owner",HouseInfo[i][h_owner],Handle,24);
    HouseInfo[i][h_enterX] = cache_get_field_content_float(i, "EnterPosX");
    HouseInfo[i][h_enterY] = cache_get_field_content_float(i, "EnterPosY");
    HouseInfo[i][h_enterZ] = cache_get_field_content_float(i, "EnterPosZ");
    HouseInfo[i][h_exitX] = cache_get_field_content_float(i, "ExitPosX");
    HouseInfo[i][h_exitY] = cache_get_field_content_float(i, "ExitPosY");
    HouseInfo[i][h_exitZ] = cache_get_field_content_float(i, "ExitPosZ");
    HouseInfo[i][h_int] = cache_get_field_content_int(i, "Interior");
    HouseInfo[i][h_vw] = cache_get_field_content_int(i, "VirtualWorld");
    HouseInfo[i][h_buyprice] = cache_get_field_content_int(i, "BuyPrice");
    HouseInfo[i][h_rentprice] = cache_get_field_content_int(i, "RentPrice");
    HouseInfo[i][h_bought] = cache_get_field_content_int(i, "Bought");
    HouseInfo[i][h_rentable] = cache_get_field_content_int(i, "RentAble");
    HouseInfo[i][h_locked] = cache_get_field_content_int(i, "IsLocked");
    HouseInfo[i][h_money] = cache_get_field_content_int(i, "Money");
    HouseInfo[i][h_type] = cache_get_field_content_int(i, "Type");
    for(new h=0;h<MAX_HOUSES;h++)
    {
    if(HouseInfo[h][h_type] == 1)
    {
    if(HouseInfo[h][h_bought] == 0)
    {
    new str[128];
    format(str,sizeof(str),"This Apartment has NO Owner.Type /buyhouse to buy it.\nPrice: %i$",HouseInfo[h][h_buyprice]);
    HouseInfo[h][h_label] = Create3DTextLabel(str,Weiß,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],10.0,0,0);
    HouseInfo[h][h_pick] = CreatePickup(1274,0,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],0);
    }
    else
    {
    new str[148];
    format(str,sizeof(str),"This Apartment is already bought.\nType /rent to rent a room in this Apartment.\nOwner: %s\nRent Price: %i$",HouseInfo[h][h_owner],HouseInfo[h][h_rentprice]);
    HouseInfo[h][h_label] = Create3DTextLabel(str,Weiß,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],10.0,0,0);
    HouseInfo[h][h_pick] = CreatePickup(1273,0,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],0);
    }
    }
    else if(HouseInfo[h][h_type] == 2)
    {
    if(HouseInfo[h][h_bought] == 0)
    {
    new str[128];
    format(str,sizeof(str),"This House has NO Owner.Type /buyhouse to buy it.\nPrice: %i$",HouseInfo[h][h_buyprice]);
    HouseInfo[h][h_label] = Create3DTextLabel(str,Weiß,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],10.0,0,0);
    HouseInfo[h][h_pick] = CreatePickup(1274,0,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],0);
    }
    else
    {
    new str[148];
    format(str,sizeof(str),"This House is already bought.\nType /rent to rent a room in this House.\nOwner: %s\nRent Price: %i$",HouseInfo[h][h_owner],HouseInfo[h][h_rentprice]);
    HouseInfo[h][h_label] = Create3DTextLabel(str,Weiß,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],10.0,0,0);
    HouseInfo[h][h_pick] = CreatePickup(1273,0,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],0);
    }
    }
    else if(HouseInfo[h][h_type] == 3)
    {
    if(HouseInfo[h][h_bought] == 0)
    {
    new str[128];
    format(str,sizeof(str),"This Villa has NO Owner.Type /buyhouse to buy it.\nPrice: %i$",HouseInfo[h][h_buyprice]);
    HouseInfo[h][h_label] = Create3DTextLabel(str,Weiß,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],10.0,0,0);
    HouseInfo[h][h_pick] = CreatePickup(1274,0,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],0);
    }
    else
    {
    new str[148];
    format(str,sizeof(str),"This Villa is already bought.\nType /rent to rent a room in this Villa.\nOwner: %s\nRent Price: %i$",HouseInfo[h][h_owner],HouseInfo[h][h_rentprice]);
    HouseInfo[h][h_label] = Create3DTextLabel(str,Weiß,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],10.0,0,0);
    HouseInfo[h][h_pick] = CreatePickup(1273,0,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],0);
    }
    }
    }
    }
    return 1;
    }


    Häuser löschen:


    ocmd:hdelete(playerid,params[])
    {
    if(!IsPlayerAnAdmin(playerid))return SendClientMessage(playerid,Rot,"Error: {FFFFFF}You are not allowed to use this Command.");
    if(!IsPlayerAdminRank(playerid,4))return SendClientMessage(playerid,Rot,"Error: {FFFFFF}You are not allowed to use this Command.");
    for(new i=0;i<MAX_HOUSES;i++)
    {
    if(IsPlayerInRangeOfPoint(playerid,2,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ]))
    {
    /*SpielerInfo[GetPlayerID(HouseInfo[i][h_owner])[pOwnHouse] = 0;
    new str[128];
    format(str,sizeof(str),"[SInfo] {FFFFFF}%s has deleted your House.",getPlayerName(playerid));
    SendClientMessage(GetPlayerID(HouseInfo[i][h_owner]),Rot,str);*/
    HouseInfo[i][h_enterX] = 0;
    HouseInfo[i][h_enterY] = 0;
    HouseInfo[i][h_enterZ] = 0;
    HouseInfo[i][h_exitX] = 0;
    HouseInfo[i][h_exitY] = 0;
    HouseInfo[i][h_exitZ] = 0;
    HouseInfo[i][h_int] = 0;
    format(HouseInfo[i][h_owner], 24, "");
    HouseInfo[i][h_buyprice] = 0;
    HouseInfo[i][h_rentprice] = 0;
    HouseInfo[i][h_bought] = 0;
    HouseInfo[i][h_rentable] = 0;
    HouseInfo[i][h_locked] = 0;
    HouseInfo[i][h_money] = 0;
    HouseInfo[i][h_type] = 0;
    HouseInfo[i][h_vw] =0 ;
    DestroyPickup(HouseInfo[i][h_pick]);
    Delete3DTextLabel(HouseInfo[i][h_label]);
    new query[512];
    format(query,sizeof(query),"DELETE FROM houses WHERE id='%i'",i);
    mysql_pquery(Handle,query);
    return SendClientMessage(playerid,Gelb,"[SInfo] {FFFFFF}You have deleted the House.");
    }
    }
    return 1;
    }


    Label &amp;amp;amp; PickUp beim Restart löschen

    public OnGameModeExit()
    {
    SaveHouses();
    for(new h=0;h<MAX_HOUSES;h++)
    {
    DestroyPickup(HouseInfo[h][h_pick]);
    Delete3DTextLabel(HouseInfo[h][h_label]);
    }
    return 1;
    }

    Jeffry erstmal danke für die großartige und gute Hilfe.
    Jetzt habe ich allerdings noch soweit ich es bemerke 1 Problem:
    Wenn ich das Haus lösche wird das PickUp nicht gelöscht ebenso beim Serverrestart auch nicht.


    Löschebefehl

    ocmd:hdelete(playerid,params[])
    {
    if(!IsPlayerAnAdmin(playerid))return SendClientMessage(playerid,Rot,"Error: {FFFFFF}You are not allowed to use this Command.");
    if(!IsPlayerAdminRank(playerid,4))return SendClientMessage(playerid,Rot,"Error: {FFFFFF}You are not allowed to use this Command.");
    for(new i=0;i<MAX_HOUSES;i++)
    {
    if(IsPlayerInRangeOfPoint(playerid,2,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ]))
    {
    HouseInfo[i][h_enterX] = 0;
    HouseInfo[i][h_enterY] = 0;
    HouseInfo[i][h_enterZ] = 0;
    HouseInfo[i][h_exitX] = 0;
    HouseInfo[i][h_exitY] = 0;
    HouseInfo[i][h_exitZ] = 0;
    HouseInfo[i][h_int] = 0;
    format(HouseInfo[i][h_owner], 24, "");
    HouseInfo[i][h_buyprice] = 0;
    HouseInfo[i][h_rentprice] = 0;
    HouseInfo[i][h_bought] = 0;
    HouseInfo[i][h_rentable] = 0;
    HouseInfo[i][h_locked] = 0;
    HouseInfo[i][h_money] = 0;
    HouseInfo[i][h_type] = 0;
    HouseInfo[i][h_vw] =0 ;
    DestroyPickup(HouseInfo[i][h_pick]);
    Delete3DTextLabel(HouseInfo[i][h_label]);
    new query[512];
    format(query,sizeof(query),"DELETE FROM houses WHERE id='%i'",i);
    mysql_pquery(Handle,query);
    return SendClientMessage(playerid,Gelb,"[SInfo] {FFFFFF}You have delete the House.");
    }
    }
    return 1;
    }
    public OnGameModeExit()
    {
    for(new h=0;h<MAX_HOUSES;h++)
    {
    DestroyPickup(HouseInfo[h][h_pick]);
    Delete3DTextLabel(HouseInfo[h][h_label]);
    }
    return 1;
    }


    Wie Das PickUp deklariert wird:

    ocmd:buyhouse(playerid,params[])
    {
    new query[256];
    for(new h=0;h<MAX_HOUSES;h++)
    {
    if(IsPlayerInRangeOfPoint(playerid,2,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ]))
    {
    if(HouseInfo[h][h_buyprice] <= GetPlayerMoney(playerid))
    {
    if(HouseInfo[h][h_bought] == 0)
    {
    if(SpielerInfo[playerid][pHouseOwned] == 0)
    {
    SendClientMessage(playerid,Gelb,"[SInfo] {FFFFFF}Congratulations. You bought the House.");
    format(query,sizeof(query),"UPDATE houses SET Owner='%s',Bought='1' WHERE id='%i'",getPlayerName(playerid),h);
    mysql_pquery(Handle,query);
    format(HouseInfo[h][h_owner],24,getPlayerName(playerid));
    GivePlayerMoney(playerid,-HouseInfo[h][h_buyprice]/2);
    DestroyPickup(HouseInfo[h][h_pick]);
    Delete3DTextLabel(HouseInfo[h][h_label]);
    SpielerInfo[playerid][pHouseOwned] = 1;
    if(HouseInfo[h][h_type] == 1)
    {
    new str[148];
    format(str,sizeof(str),"This Apartment is already bought.\nType /rent to rent a room in this Apartment.\nOwner: %s\nRent Price: %i$",HouseInfo[h][h_owner],HouseInfo[h][h_rentprice]);
    HouseInfo[h][h_label] = Create3DTextLabel(str,Weiß,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],10.0,0,0);
    HouseInfo[h][h_pick] = CreatePickup(1273,0,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],0);
    }
    else if(HouseInfo[h][h_type] == 2)
    {
    new str[128];
    format(str,sizeof(str),"This House is already bought.\nType /rent to rent a room in this House.\nOwner: %s\nRent Price: %i$",HouseInfo[h][h_owner],HouseInfo[h][h_rentprice]);
    HouseInfo[h][h_label] = Create3DTextLabel(str,Weiß,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],10.0,0,0);
    HouseInfo[h][h_pick] = CreatePickup(1273,0,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],0);
    }
    else if(HouseInfo[h][h_type] == 3)
    {
    new str[128];
    format(str,sizeof(str),"This Villa is already bought.\nType /rent to rent a room in this Villa.\nOwner: %s\nRent Price: %i$",HouseInfo[h][h_owner],HouseInfo[h][h_rentprice]);
    HouseInfo[h][h_label] = Create3DTextLabel(str,Weiß,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],10.0,0,0);
    HouseInfo[h][h_pick] = CreatePickup(1273,0,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],0);
    }
    }
    }
    }
    }
    }
    return SendClientMessage(playerid,Rot,"Error: {FFFFFF}You are not close to any House,the House is bought or you don't have enough money.");
    }

    Wie Das PickUp deklariert wird:
    forward LoadHouses_Data();
    public LoadHouses_Data()
    {
    new rows;
    rows = cache_num_rows();
    for(new i=0;i<rows;i++)
    {
    HouseInfo[i][h_ID] = cache_get_field_content_int(i, "id");
    cache_get_field_content(i,"Owner",HouseInfo[i][h_owner],Handle,24);
    HouseInfo[i][h_enterX] = cache_get_field_content_float(i, "EnterPosX");
    HouseInfo[i][h_enterY] = cache_get_field_content_float(i, "EnterPosY");
    HouseInfo[i][h_enterZ] = cache_get_field_content_float(i, "EnterPosZ");
    HouseInfo[i][h_exitX] = cache_get_field_content_float(i, "ExitPosX");
    HouseInfo[i][h_exitY] = cache_get_field_content_float(i, "ExitPosY");
    HouseInfo[i][h_exitZ] = cache_get_field_content_float(i, "ExitPosZ");
    HouseInfo[i][h_int] = cache_get_field_content_int(i, "Interior");
    HouseInfo[i][h_vw] = cache_get_field_content_int(i, "VirtualWorld");
    HouseInfo[i][h_buyprice] = cache_get_field_content_int(i, "BuyPrice");
    HouseInfo[i][h_rentprice] = cache_get_field_content_int(i, "RentPrice");
    HouseInfo[i][h_bought] = cache_get_field_content_int(i, "Bought");
    HouseInfo[i][h_rentable] = cache_get_field_content_int(i, "RentAble");
    HouseInfo[i][h_locked] = cache_get_field_content_int(i, "IsLocked");
    HouseInfo[i][h_money] = cache_get_field_content_int(i, "Money");
    HouseInfo[i][h_type] = cache_get_field_content_int(i, "Type");
    for(new h=0;h<MAX_HOUSES;h++)
    {
    if(HouseInfo[h][h_type] == 1)
    {
    if(HouseInfo[h][h_bought] == 0)
    {
    new str[128];
    format(str,sizeof(str),"This Apartment has NO Owner.Type /buyhouse to buy it.\nPrice: %i$",HouseInfo[h][h_buyprice]);
    HouseInfo[h][h_label] = Create3DTextLabel(str,Weiß,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],10.0,0,0);
    CreatePickup(1274,0,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],0);
    }
    else
    {
    new str[148];
    format(str,sizeof(str),"This Apartment is already bought.\nType /rent to rent a room in this Apartment.\nOwner: %s\nRent Price: %i$",HouseInfo[h][h_owner],HouseInfo[h][h_rentprice]);
    HouseInfo[h][h_label] = Create3DTextLabel(str,Weiß,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],10.0,0,0);
    HouseInfo[h][h_pick] = CreatePickup(1273,0,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],0);
    }
    }
    else if(HouseInfo[h][h_type] == 2)
    {
    if(HouseInfo[h][h_bought] == 0)
    {
    new str[128];
    format(str,sizeof(str),"This House has NO Owner.Type /buyhouse to buy it.\nPrice: %i$",HouseInfo[h][h_buyprice]);
    HouseInfo[h][h_label] = Create3DTextLabel(str,Weiß,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],10.0,0,0);
    HouseInfo[h][h_pick] = CreatePickup(1274,0,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],0);
    }
    else
    {
    new str[148];
    format(str,sizeof(str),"This House is already bought.\nType /rent to rent a room in this House.\nOwner: %s\nRent Price: %i$",HouseInfo[h][h_owner],HouseInfo[h][h_rentprice]);
    HouseInfo[h][h_label] = Create3DTextLabel(str,Weiß,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],10.0,0,0);
    HouseInfo[h][h_pick] = CreatePickup(1273,0,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],0);
    }
    }
    else if(HouseInfo[h][h_type] == 3)
    {
    if(HouseInfo[h][h_bought] == 0)
    {
    new str[128];
    format(str,sizeof(str),"This Villa has NO Owner.Type /buyhouse to buy it.\nPrice: %i$",HouseInfo[h][h_buyprice]);
    HouseInfo[h][h_label] = Create3DTextLabel(str,Weiß,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],10.0,0,0);
    HouseInfo[h][h_pick] = CreatePickup(1274,0,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],0);
    }
    else
    {
    new str[148];
    format(str,sizeof(str),"This Villa is already bought.\nType /rent to rent a room in this Villa.\nOwner: %s\nRent Price: %i$",HouseInfo[h][h_owner],HouseInfo[h][h_rentprice]);
    HouseInfo[h][h_label] = Create3DTextLabel(str,Weiß,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],10.0,0,0);
    HouseInfo[h][h_pick] = CreatePickup(1273,0,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],0);
    }
    }
    }
    }
    return 1;
    }


    Btw:
    Beim /buyhouse Befehl wird alles gelöscht wie es soll.

    Schon selber behoben ich habe einfach das mit der Virtual World nach dem übetragen auslesen und erst alles eintragen lassen.
    Nun habe ich noch eine frage: Wieso bekomme ich hier eine tag mismatch error:

    HouseInfo[h][h_label] = Create3DTextLabel(str,Weiß,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],10,0,0);

    Koordinaten passen soweit ich das sehe auch, aber wie du siehst werden die End-Daten nicht mehr übermittel beim erstellen des Hauses.


    Server_log:

    mysql_log:


    Ich glaube momentan besteht eine 50/50 Chance ein Haus richtig zu erstellen :S


    ocmd:hcreate(playerid,params[])
    {
    if(!IsPlayerAnAdmin(playerid))return SendClientMessage(playerid,Rot,"Error: {FFFFFF}You are not allowed to use this Command.");
    if(!IsPlayerAdminRank(playerid,4))return SendClientMessage(playerid,Rot,"Error: {FFFFFF}You are not allowed to use this Command.");
    new inter,price,type;
    if(sscanf(params,"iii",inter,type,price))return SendClientMessage(playerid,Rot,"Error: {FFFFFF}Use /hcreate [Interior ID] [Type] [BuyPrice]"),
    SendClientMessage(playerid,Grau,"[Types]: 1: Apartment, 2: House, 3: Villa");
    if(type < 1 || type > 3)return SendClientMessage(playerid,Rot,"Error: Something's wrong with the Type");
    //if(inter != InteriorInfo[inter][int_ID])return SendClientMessage(playerid,Rot,"Error: {FFFFFF}This isn't a Valid Interior. Use /validint to see what Interiors are Valid.");
    for(new i=0;i<MAX_HOUSES;i++)
    {
    if(strlen(HouseInfo[i][h_owner]))continue;
    {
    new query[512];
    new Float:pos[3];
    GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
    HouseInfo[i][h_enterX] = pos[0];
    HouseInfo[i][h_enterY] = pos[1];
    HouseInfo[i][h_enterZ] = pos[2];
    new count, tmp;
    for(new j=0; j<sizeof(HouseInfo); j++) if(HouseInfo[j][h_int] == inter && HouseInfo[j][h_type] == type) count++;
    printf("count: %d", count);
    for(new j=0; j<sizeof(InteriorInfo); j++)
    {
    printf("%d == %d | %d == %d", InteriorInfo[j][int_ID], inter, InteriorInfo[j][int_type], type);
    if(InteriorInfo[j][int_ID] == inter && InteriorInfo[j][int_type] == type)
    {
    printf("%d == %d", tmp, count);
    if(tmp == count)
    {
    printf("Nutze InteriorInfo %d", j);
    HouseInfo[i][h_exitX] = InteriorInfo[j][int_exitX];
    HouseInfo[i][h_exitY] = InteriorInfo[j][int_exitY];
    HouseInfo[i][h_exitZ] = InteriorInfo[j][int_exitZ];
    }
    tmp++;
    }
    }
    HouseInfo[i][h_int] = inter;
    format(HouseInfo[i][h_owner], 24, " ");
    format(query,sizeof(query),"INSERT INTO Houses (id,Owner,EnterPosX,EnterPosY,EnterPosZ,ExitPosX,ExitPosY,ExitPosZ,Interior) VALUES ('%i','%s','%f','%f','%f','%f','%f','%f','%i')",
    i,HouseInfo[i][h_owner],HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],HouseInfo[i][h_exitX],HouseInfo[i][h_exitY],HouseInfo[i][h_exitZ],HouseInfo[i][h_int]);
    mysql_pquery(Handle,query);
    HouseInfo[i][h_vw] = cache_get_field_content_int(i,"VirtualWorld");
    HouseInfo[i][h_buyprice] = price;
    HouseInfo[i][h_rentprice] = 100;
    HouseInfo[i][h_bought] = 0;
    HouseInfo[i][h_rentable] = 0;
    HouseInfo[i][h_locked] = 1;
    HouseInfo[i][h_money] = 0;
    HouseInfo[i][h_type] = type;
    format(query,sizeof(query),"UPDATE Houses SET BuyPrice='%i',RentPrice='%i',Bought='%i',IsLocked='%i',Money='%i',`Type`='%i',RentAble='%i' WHERE id='%i'",
    HouseInfo[i][h_buyprice],HouseInfo[i][h_rentprice],HouseInfo[i][h_bought],HouseInfo[i][h_locked],HouseInfo[i][h_money],HouseInfo[i][h_type],HouseInfo[i][h_rentable],i);
    mysql_pquery(Handle,query);
    if(HouseInfo[i][h_type] == 1)
    {
    new str[128];
    format(str,sizeof(str),"This Apartment has NO Owner.Type /buyhouse to buy it.\nPrice: %i$",HouseInfo[i][h_buyprice]);
    Create3DTextLabel(str,Weiß,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],10,0,0);
    CreatePickup(1274,0,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],0);
    }
    else if(HouseInfo[i][h_type] == 2)
    {
    new str[128];
    format(str,sizeof(str),"This House has NO Owner.Type /buyhouse to buy it.\nPrice: %i$",HouseInfo[i][h_buyprice]);
    Create3DTextLabel(str,Weiß,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],10,0,0);
    CreatePickup(1274,0,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],0);
    }
    else if(HouseInfo[i][h_type] == 3)
    {
    new str[128];
    format(str,sizeof(str),"This Villa has NO Owner.Type /buyhouse to buy it.\nPrice: %i$",HouseInfo[i][h_buyprice]);
    Create3DTextLabel(str,Weiß,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],10,0,0);
    CreatePickup(1274,0,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],0);
    }
    return 1;
    }
    }
    return 1;
    }

    Klappt so halbwegs:


    //EDIT:
    Debug:

    Befehl:
    ocmd:hcreate(playerid,params[])
    {
    if(!IsPlayerAnAdmin(playerid))return SendClientMessage(playerid,Rot,"Error: {FFFFFF}You are not allowed to use this Command.");
    if(!IsPlayerAdminRank(playerid,4))return SendClientMessage(playerid,Rot,"Error: {FFFFFF}You are not allowed to use this Command.");
    new inter,price,type;
    if(sscanf(params,"iii",inter,type,price))return SendClientMessage(playerid,Rot,"Error: {FFFFFF}Use /hcreate [Interior ID] [Type] [BuyPrice]"),
    SendClientMessage(playerid,Grau,"[Types]: 1: Apartment, 2: House, 3: Villa");
    //if(inter != InteriorInfo[inter][int_ID])return SendClientMessage(playerid,Rot,"Error: {FFFFFF}This isn't a Valid Interior. Use /validint to see what Interiors are Valid.");
    for(new i=0;i<MAX_HOUSES;i++)
    {
    if(strlen(HouseInfo[i][h_owner]))continue;
    {
    new query[512];
    new Float:pos[3];
    GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
    HouseInfo[i][h_enterX] = pos[0];
    HouseInfo[i][h_enterY] = pos[1];
    HouseInfo[i][h_enterZ] = pos[2];
    new count, tmp;
    for(new j=0; j<sizeof(HouseInfo); j++) if(HouseInfo[j][h_int] == inter && HouseInfo[j][h_type] == type) count++;
    for(new j=0; j<sizeof(HouseInfo); j++)
    {
    if(InteriorInfo[j][int_ID] == inter && InteriorInfo[j][int_type] == type)
    {
    if(tmp == count)
    {
    HouseInfo[i][h_exitX] = InteriorInfo[j][int_exitX];
    HouseInfo[i][h_exitY] = InteriorInfo[j][int_exitY];
    HouseInfo[i][h_exitZ] = InteriorInfo[j][int_exitZ];
    }
    }
    tmp++;
    }
    HouseInfo[i][h_int] = inter;
    format(HouseInfo[i][h_owner], 24, " ");
    format(query,sizeof(query),"INSERT INTO Houses (id,Owner,EnterPosX,EnterPosY,EnterPosZ,ExitPosX,ExitPosY,ExitPosZ,Interior) VALUES ('%i','%s','%f','%f','%f','%f','%f','%f','%i')",
    i,HouseInfo[i][h_owner],HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],HouseInfo[i][h_exitX],HouseInfo[i][h_exitY],HouseInfo[i][h_exitZ],HouseInfo[i][h_int]);
    mysql_pquery(Handle,query);
    HouseInfo[i][h_vw] = cache_get_field_content_int(i,"VirtualWorld");
    HouseInfo[i][h_buyprice] = price;
    HouseInfo[i][h_rentprice] = 100;
    HouseInfo[i][h_bought] = 0;
    HouseInfo[i][h_rentable] = 0;
    HouseInfo[i][h_locked] = 1;
    HouseInfo[i][h_money] = 0;
    HouseInfo[i][h_type] = type;
    format(query,sizeof(query),"UPDATE Houses SET BuyPrice='%i',RentPrice='%i',Bought='%i',IsLocked='%i',Money='%i',`Type`='%i',RentAble='%i' WHERE id='%i'",
    HouseInfo[i][h_buyprice],HouseInfo[i][h_rentprice],HouseInfo[i][h_bought],HouseInfo[i][h_locked],HouseInfo[i][h_money],HouseInfo[i][h_type],HouseInfo[i][h_rentable],i);
    mysql_pquery(Handle,query);
    if(HouseInfo[i][h_type] == 0)
    {
    new str[128];
    format(str,sizeof(str),"This Apartment has NO Owner.Type /buyhouse to buy it.\nPrice: %i$",HouseInfo[i][h_buyprice]);
    Create3DTextLabel(str,Weiß,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],10,0,0);
    CreatePickup(1274,0,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],0);
    }
    else if(HouseInfo[i][h_type] == 1)
    {
    new str[128];
    format(str,sizeof(str),"This House has NO Owner.Type /buyhouse to buy it.\nPrice: %i$",HouseInfo[i][h_buyprice]);
    Create3DTextLabel(str,Weiß,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],10,0,0);
    CreatePickup(1274,0,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],0);
    }
    else if(HouseInfo[i][h_type] == 2)
    {
    new str[128];
    format(str,sizeof(str),"This Villa has NO Owner.Type /buyhouse to buy it.\nPrice: %i$",HouseInfo[i][h_buyprice]);
    Create3DTextLabel(str,Weiß,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],10,0,0);
    CreatePickup(1274,0,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],0);
    }
    return 1;
    }
    }
    return 1;
    }
    Datenbank:

    Aber es besteht doch trotzdem noch das Problem welches ich //EDIT: habe.
    //EDITwelchesNichtsMitDemEditImSatzDrüberZuTuhenHat::
    Ich bin mir gar nicht sicher ob man dieses Problem auf eine leichte Weise umgehen kann.

    Nein und Ja.
    Guck mal:
    Ist ein Haus aus dem Enum mit der Interior ID: 5
    {5,2350.339843,-1181.649902,1027.976562},
    Ist ein Villen Interior aus dem Enum mit der Interior ID: 5
    {5,1267.663208,-781.323242,1091.906250}


    Wenn ich nun diese Villa erstellen möchte, sucht er nichtmal nach der 5 er geht einfach das Enum runter bis er Zahlen hat die noch unverwendet sind. Da weiß ich nicht wie ich überprüfen soll ob die Variable "inter" mit der Interior ID und der Variable Type übereinstimmt.
    Ich habe mir das so gedacht:
    Jede Zeile erhält nochmal einen Typen also Apartment Haus oder Villa.
    Nun weiß ich nicht wie ich in einer if Abfrage abfragen soll ob Interior ID und Type übereinstimmen. Habe da bis jetzt nur Errors bekommen.
    Und wenn ich das schon wieder so sehe weiß ich das meine Methode wieder zu 90% nicht funktionieren wird weil, es die Interior ID: 2 schon 2x allein in Apartments existiert also: Bei Abfrage gleiche Interior ID und gleicher Type.

    enum interEnum
    {
    int_ID,
    Float:int_exitX,
    Float:int_exitY,
    Float:int_exitZ,
    int_type
    };


    new InteriorInfo[][interEnum] =
    {
    //Apartments
    {12,444.646911,508.239044,1001.419494,1},
    {1,244.411987,305.032989,999.148437,1},
    {2,271.884979,306.631988,999.148437,1},
    {2,1523.509887,-47.821197,1002.130981,1},
    {},
    //Houses
    {8,2807.619873,-1171.899902,1025.570312,2},
    {3,2496.049804,-1695.238159,1014.742187,2},
    {5,318.564971,1118.209960,1083.882812,2},
    {5,2350.339843,-1181.649902,1027.976562,2},
    {1,2527.654052,-1679.388305,1015.498596,2},
    //Villas
    {12,2324.419921,-1145.568359,1050.710083,3},
    {5,1267.663208,-781.323242,1091.906250,3}
    };


    //EDIT:
    Siehst du auch bei dem Screenshot das Haus-ID: 1 keine Einträge außer Koordinaten hat was an sich schon ein Fehler ist, da dies beim erstellen eingetragen wird etc.

    Jeffry:
    Ich habe das Problem gefunden kann es aber nicht beheben, da ich nicht weiß wie.
    Es liegt an dem Enum, er liest immer nur die erste Zeile aus dem InteriorInfo Enum aus und trägt die Exit/Interior Positionen in die Datenbank ein.
    Leider weiß ich halt nicht wie ich durch dieses enum switche.


    //EDIT:

    Und ich habe gemerkt, dass er bei dem erstellen keine neuen PickUps und TextLables macht.

    Klappt soweit außer dass, er nicht die richtigen Exit Daten aus dem Enum ausliest. Also er trägt nicht die richtigen Daten ein sondern immer die gleichen wo er mich beim eintreten dann ich einen Schwarzen Raum mit einen Spiegel setzt.
    Wenn ich /interior nutze gibt er mir auch den richtigen aus


    //EDIT:
    @Mencent:
    Jeffry:


    Alles rund um Häuser sieht gerade so aus:

    Erstell Befehl

    ocmd:hcreate(playerid,params[])
    {
    if(!IsPlayerAnAdmin(playerid))return SendClientMessage(playerid,Rot,"Error: {FFFFFF}You are not allowed to use this Command.");
    if(!IsPlayerAdminRank(playerid,4))return SendClientMessage(playerid,Rot,"Error: {FFFFFF}You are not allowed to use this Command.");
    new inter,price,type;
    if(sscanf(params,"iii",inter,type,price))return SendClientMessage(playerid,Rot,"Error: {FFFFFF}Use /hcreate [Interior ID] [Type] [BuyPrice]"),
    SendClientMessage(playerid,Grau,"[Types]: 1: Apartment, 2: House, 3: Villa");
    if(inter != InteriorInfo[inter][int_ID])return SendClientMessage(playerid,Rot,"Error: {FFFFFF}This isn't a Valid Interior. Use /validint to see what Interiors are Valid.");
    for(new i=0;i<MAX_HOUSES;i++)
    {
    if(strlen(HouseInfo[i][h_owner]))continue;
    {
    new query[512];
    new Float:pos[3];
    GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
    HouseInfo[i][h_enterX] = pos[0];
    HouseInfo[i][h_enterY] = pos[1];
    HouseInfo[i][h_enterZ] = pos[2];
    HouseInfo[i][h_exitX] = InteriorInfo[i][int_exitX];
    HouseInfo[i][h_exitY] = InteriorInfo[i][int_exitY];
    HouseInfo[i][h_exitZ] = InteriorInfo[i][int_exitZ];
    HouseInfo[i][h_int] = inter;
    format(HouseInfo[i][h_owner], 24, " ");
    format(query,sizeof(query),"INSERT INTO Houses (id,Owner,EnterPosX,EnterPosY,EnterPosZ,ExitPosX,ExitPosY,ExitPosZ,Interior) VALUES ('%i','%s','%f','%f','%f','%f','%f','%f','%i')",
    i,HouseInfo[i][h_owner],HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],HouseInfo[i][h_exitX],HouseInfo[i][h_exitY],HouseInfo[i][h_exitZ],HouseInfo[i][h_int]);
    mysql_pquery(Handle,query);
    HouseInfo[i][h_vw] = cache_get_field_content_int(i,"VirtualWorld");
    HouseInfo[i][h_buyprice] = price;
    HouseInfo[i][h_rentprice] = 100;
    HouseInfo[i][h_bought] = 0;
    HouseInfo[i][h_rentable] = 0;
    HouseInfo[i][h_locked] = 1;
    HouseInfo[i][h_money] = 0;
    HouseInfo[i][h_type] = type;
    format(query,sizeof(query),"UPDATE Houses SET BuyPrice='%i',RentPrice='%i',Bought='%i',IsLocked='%i',Money='%i',`Type`='%i',RentAble='%i' WHERE id='%i'",
    HouseInfo[i][h_buyprice],HouseInfo[i][h_rentprice],HouseInfo[i][h_bought],HouseInfo[i][h_locked],HouseInfo[i][h_money],HouseInfo[i][h_type],HouseInfo[i][h_rentable],i);
    mysql_pquery(Handle,query);
    if(HouseInfo[i][h_type] == 0)
    {
    new str[128];
    format(str,sizeof(str),"This Apartment has NO Owner, you can buy it.\nPrice: %i$",HouseInfo[i][h_buyprice]);
    Create3DTextLabel(str,Weiß,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],10,0,0);
    CreatePickup(1274,0,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],0);
    }
    else if(HouseInfo[i][h_type] == 1)
    {
    new str[128];
    format(str,sizeof(str),"This House has NO Owner, you can buy it.\nPrice: %i$",HouseInfo[i][h_buyprice]);
    Create3DTextLabel(str,Weiß,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],10,0,0);
    CreatePickup(1274,0,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],0);
    }
    else if(HouseInfo[i][h_type] == 2)
    {
    new str[128];
    format(str,sizeof(str),"This Villa has NO Owner, you can buy it.\nPrice: %i$",HouseInfo[i][h_buyprice]);
    Create3DTextLabel(str,Weiß,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],10,0,0);
    CreatePickup(1274,0,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],0);
    }
    return 1;
    }
    }
    return 1;
    }


    Häuser Laden

    stock LoadHouses()
    {
    mysql_pquery(Handle, "SELECT * FROM houses ORDER BY ID ASC","LoadHouses_Data");
    return 1;
    }

    Häuser Laden
    forward LoadHouses_Data();
    public LoadHouses_Data()
    {
    new rows;
    rows = cache_num_rows();
    for(new i=0;i<rows;i++)
    {
    HouseInfo[i][h_ID] = cache_get_field_content_int(i, "id");
    cache_get_field_content(i,"Owner",HouseInfo[i][h_owner],Handle,24);
    HouseInfo[i][h_enterX] = cache_get_field_content_float(i, "EnterPosX");
    HouseInfo[i][h_enterY] = cache_get_field_content_float(i, "EnterPosY");
    HouseInfo[i][h_enterZ] = cache_get_field_content_float(i, "EnterPosZ");
    HouseInfo[i][h_exitX] = cache_get_field_content_float(i, "ExitPosX");
    HouseInfo[i][h_exitY] = cache_get_field_content_float(i, "ExitPosY");
    HouseInfo[i][h_exitZ] = cache_get_field_content_float(i, "ExitPosZ");
    HouseInfo[i][h_int] = cache_get_field_content_int(i, "Interior");
    HouseInfo[i][h_vw] = cache_get_field_content_int(i, "VirtualWorld");
    HouseInfo[i][h_buyprice] = cache_get_field_content_int(i, "BuyPrice");
    HouseInfo[i][h_rentprice] = cache_get_field_content_int(i, "RentPrice");
    HouseInfo[i][h_bought] = cache_get_field_content_int(i, "Bought");
    HouseInfo[i][h_rentable] = cache_get_field_content_int(i, "RentAble");
    HouseInfo[i][h_locked] = cache_get_field_content_int(i, "IsLocked");
    HouseInfo[i][h_money] = cache_get_field_content_int(i, "Money");
    HouseInfo[i][h_type] = cache_get_field_content_int(i, "Type");
    for(new h=0;h<MAX_HOUSES;h++)
    {
    if(HouseInfo[h][h_type] == 0)
    {
    if(HouseInfo[h][h_bought] == 0)
    {
    new str[128];
    format(str,sizeof(str),"This Apartment has NO Owner, you can buy it.\nPrice: %i$",HouseInfo[h][h_buyprice]);
    Create3DTextLabel(str,Weiß,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],10,0,0);
    CreatePickup(1274,0,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],0);
    }
    else
    {
    new str[128];
    format(str,sizeof(str),"This Apartment is already bought.\nOwner: %s\nRent Price: %i",HouseInfo[h][h_owner],HouseInfo[h][h_rentprice]);
    Create3DTextLabel(str,Weiß,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],10,0,0);
    CreatePickup(1274,0,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],0);
    }
    }
    else if(HouseInfo[h][h_type] == 1)
    {
    if(HouseInfo[h][h_bought] == 0)
    {
    new str[128];
    format(str,sizeof(str),"This House has NO Owner, you can buy it.\nPrice: %i$",HouseInfo[h][h_buyprice]);
    Create3DTextLabel(str,Weiß,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],10,0,0);
    CreatePickup(1274,0,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],0);
    }
    else
    {
    new str[128];
    format(str,sizeof(str),"This House is already bought.\nOwner: %s\nRent Price: %i",HouseInfo[h][h_owner],HouseInfo[h][h_rentprice]);
    Create3DTextLabel(str,Weiß,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],10,0,0);
    CreatePickup(1274,0,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],0);
    }
    }
    else if(HouseInfo[h][h_type] == 2)
    {
    if(HouseInfo[h][h_bought] == 0)
    {
    new str[128];
    format(str,sizeof(str),"This Villa has NO Owner, you can buy it.\nPrice: %i$",HouseInfo[h][h_buyprice]);
    Create3DTextLabel(str,Weiß,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],10,0,0);
    CreatePickup(1274,0,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],0);
    }
    else
    {
    new str[128];
    format(str,sizeof(str),"This Villa is already bought.\nOwner: %s\nRent Price: %i",HouseInfo[h][h_owner],HouseInfo[h][h_rentprice]);
    Create3DTextLabel(str,Weiß,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],10,0,0);
    CreatePickup(1274,0,HouseInfo[h][h_enterX],HouseInfo[h][h_enterY],HouseInfo[h][h_enterZ],0);
    }
    }
    }
    }
    return 1;
    }


    Häuser betreten

    public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
    {
    for(new i=0;i<MAX_HOUSES;i++)
    {
    if(newkeys == KEY_SECONDARY_ATTACK && IsPlayerInRangeOfPoint(playerid,2,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ]))
    {
    EnterHouse(i,playerid);
    }
    }
    return 1;
    }
    stock EnterHouse(house,playerid)
    {
    if(HouseInfo[house][h_locked] == 1)return SendClientMessage(playerid,Rot,"Error: {FFFFFF}This House is locked.");
    SetPlayerPos(playerid,HouseInfo[house][h_exitX],HouseInfo[house][h_exitY],HouseInfo[house][h_exitZ]);
    SetPlayerInterior(playerid,HouseInfo[house][h_int]);
    SetPlayerVirtualWorld(playerid,HouseInfo[house][h_vw]);
    return 1;
    }


    InteriorInfo

    enum interEnum
    {
    int_ID,
    Float:int_exitX,
    Float:int_exitY,
    Float:int_exitZ
    };

    InteriorInfo
    new InteriorInfo[][interEnum] =
    {
    //Apartments
    {12,444.646911,508.239044,1001.419494},
    {1,244.411987,305.032989,999.148437},
    {2,271.884979,306.631988,999.148437},
    {2,1523.509887,-47.821197,1002.130981},
    {},
    //Houses
    {8,2807.619873,-1171.899902,1025.570312},
    {3,2496.049804,-1695.238159,1014.742187},
    {5,318.564971,1118.209960,1083.882812},
    {5,2350.339843,-1181.649902,1027.976562},
    {1,2527.654052,-1679.388305,1015.498596},
    //Villas
    {12,2324.419921,-1145.568359,1050.710083},
    {5,1267.663208,-781.323242,1091.906250}
    };

    Guten Tag liebe Leute,
    Ich habe das Problem, das wenn ich ein Haus per Befehl erstellen möchte, dies auch teils funktioniert er mir dann aber ~10 Einträge von verschieden Häusern in die Datenbank knallt.

    Befehl zum Erstellen:

    ocmd:hcreate(playerid,params[])
    {
    if(!IsPlayerAnAdmin(playerid))return SendClientMessage(playerid,Rot,"Error: {FFFFFF}You are not allowed to use this Command.");
    if(!IsPlayerAdminRank(playerid,4))return SendClientMessage(playerid,Rot,"Error: {FFFFFF}You are not allowed to use this Command.");
    new inter,price;
    if(sscanf(params,"ii",inter,price))return SendClientMessage(playerid,Rot,"Error: {FFFFFF}Use /hcreate [Interior ID] [BuyPrice]"),
    SendClientMessage(playerid,Grau,"[Types]: 1: Apartment, 2: House, 3: Villa");
    if(!InteriorInfo[inter][int_ID])return SendClientMessage(playerid,Rot,"Error: {FFFFFF}This isn't a Valid Interior. Use /validint to see what Interiors are Valid.");
    for(new i=0;i<MAX_HOUSES;i++)
    {
    if(strlen(HouseInfo[i][h_owner]))continue;
    {
    new query[512];
    new Float:pos[3];
    GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
    HouseInfo[i][h_enterX] = pos[0];
    HouseInfo[i][h_enterY] = pos[1];
    HouseInfo[i][h_enterZ] = pos[2];
    HouseInfo[i][h_exitX] = InteriorInfo[i][int_exitX];
    HouseInfo[i][h_exitY] = InteriorInfo[i][int_exitY];
    HouseInfo[i][h_exitZ] = InteriorInfo[i][int_exitZ];
    HouseInfo[i][h_int] = inter;
    format(query,sizeof(query),"INSERT INTO Houses (id,Owner,EnterPosX,EnterPosY,EnterPosZ,ExitPosX,ExitPosY,ExitPosZ,Interior) VALUES ('%i','%s','%f','%f','%f','%f','%f','%f','%i')",
    i,HouseInfo[i][h_owner],HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],HouseInfo[i][h_exitX],HouseInfo[i][h_exitY],HouseInfo[i][h_exitZ],HouseInfo[i][h_int]);
    mysql_pquery(Handle,query);
    HouseInfo[i][h_vw] = cache_get_field_content_int(i,"VirtualWorld");
    HouseInfo[i][h_buyprice] = price;
    HouseInfo[i][h_rentprice] = 100;
    HouseInfo[i][h_bought] = 0;
    HouseInfo[i][h_rentable] = 0;
    HouseInfo[i][h_locked] = 1;
    HouseInfo[i][h_money] = 0;
    HouseInfo[i][h_type] = InteriorInfo[i][int_type];
    format(query,sizeof(query),"UPDATE Houses SET BuyPrice='%i',RentPrice='%i',Bought='%i',`Locked`='%i',Money='%i',`Type`='%i',RentAble='%i' WHERE id='%i'",
    HouseInfo[i][h_buyprice],HouseInfo[i][h_rentprice],HouseInfo[i][h_bought],HouseInfo[i][h_locked],HouseInfo[i][h_money],HouseInfo[i][h_type],HouseInfo[i][h_rentable],i);
    if(HouseInfo[i][h_type] == 0)
    {
    new str[128];
    format(str,sizeof(str),"This Apartment has NO Owner, you can buy it.\nPrice: %i$",HouseInfo[i][h_buyprice]);
    Create3DTextLabel(str,Weiß,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],10,0,0);
    CreatePickup(1274,0,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],0);
    }
    else if(HouseInfo[i][h_type] == 1)
    {
    new str[128];
    format(str,sizeof(str),"This House has NO Owner, you can buy it.\nPrice: %i$",HouseInfo[i][h_buyprice]);
    Create3DTextLabel(str,Weiß,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],10,0,0);
    CreatePickup(1274,0,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],0);
    }
    else if(HouseInfo[i][h_type] == 2)
    {
    new str[128];
    format(str,sizeof(str),"This Villa has NO Owner, you can buy it.\nPrice: %i$",HouseInfo[i][h_buyprice]);
    Create3DTextLabel(str,Weiß,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],10,0,0);
    CreatePickup(1274,0,HouseInfo[i][h_enterX],HouseInfo[i][h_enterY],HouseInfo[i][h_enterZ],0);
    }
    }
    }
    return 1;
    }


    InteriorInfo:
    enum interEnum
    {
    int_ID,
    Float:int_exitX,
    Float:int_exitY,
    Float:int_exitZ,
    int_type
    };


    new InteriorInfo[][interEnum] =
    {
    //Apartments
    {12,444.646911,508.239044,1001.419494,1},
    {1,244.411987,305.032989,999.148437,1},
    {2,271.884979,306.631988,999.148437,1},
    {2,1523.509887,-47.821197,1002.130981,1},
    {},
    //Houses
    {8,2807.619873,-1171.899902,1025.570312,2},
    {3,2496.049804,-1695.238159,1014.742187,2},
    {5,318.564971,1118.209960,1083.882812,2},
    {5,2350.339843,-1181.649902,1027.976562,2},
    {1,2527.654052,-1679.388305,1015.498596,2},
    //Villas
    {12,2324.419921,-1145.568359,1050.710083,3},
    {5,1267.663208,-781.323242,1091.906250,3}
    };
    Btw: Ist natürlich alles eingereiht.


    Bilder der Datenbank:


    Schonmal danke im vorraus.

    Wenn ich mich nicht komplett irre ja,

    Und beim Createn des Fahrzeuges
    Sieht es so aus:
    ocmd:pcreate(playerid,params[])
    {
    if(!IsPlayerAnAdmin(playerid))return SendClientMessage(playerid,Rot,"Error: {FFFFFF}You are not allowed to use this Command.");
    if(!IsPlayerAdminRank(playerid,4))return SendClientMessage(playerid,Rot,"Error: {FFFFFF}You are not allowed to use this Command.");
    new model,owner[24],c1,c2;
    if(GetVehicleModel(MAX_VEHICLES-1))return SendClientMessage(playerid,Rot,"Error: {FFFFFF}The Limit of MAX_VEHICLES is reached.");
    if(sscanf(params,"siii",owner,model,c1,c2))return SendClientMessage(playerid,Rot,"Error: {FFFFFF}Use /pcreate [Owner] [Model ID] [Color 1] [Color 2]");
    if(model < 400 || model > 611)return SendClientMessage(playerid,Rot,"Error: {FFFFFF}The VehicleID can't be smaller then 400 or higher then 600.");
    if(c1 < 1 || c1 > 255)return SendClientMessage(playerid,Rot,"Error: {FFFFFF}In the Color ID 1 is an error. It can't be smaller then 1 and can't be higher then 255.");
    if(c2 < 1 || c2 > 255)return SendClientMessage(playerid,Rot,"Error: {FFFFFF}In the Color ID 2 is an error. It can't be smaller then 1 and can't be higher then 255.");
    for(new i=0;i<MAX_PRIVATE_VEHICLES;i++)
    {
    if(PrivateVehicle[i][p_vID] == 0)
    {
    new Float:x, Float:y, Float:z, Float:a;
    GetPlayerPos(playerid, x, y, z);
    GetPlayerFacingAngle(playerid, a);
    PrivateVehicle[i][p_modelID] = model;
    PrivateVehicle[i][p_x] = x;
    PrivateVehicle[i][p_y] = y;
    PrivateVehicle[i][p_z] = z;
    PrivateVehicle[i][p_a] = a;
    PrivateVehicle[i][p_color1] = c1;
    PrivateVehicle[i][p_color2] = c2;
    format(PrivateVehicle[i][p_owner],24,"%s",owner);
    new query[342];
    mysql_format(Handle,query,sizeof(query),"INSERT INTO privatecars (id, Modelid, PosX, PosY, PosZ, PosA, Color1, Color2, Owner) VALUES ('%d', '%d', '%f', '%f', '%f', '%f', '%d', '%d', '%s')",
    i,PrivateVehicle[i][p_modelID],PrivateVehicle[i][p_x],PrivateVehicle[i][p_y],PrivateVehicle[i][p_z],PrivateVehicle[i][p_a],PrivateVehicle[i][p_color1],PrivateVehicle[i][p_color2],PrivateVehicle[i][p_owner]);
    mysql_pquery(Handle,query);
    PrivateVehicle[i][p_vID] = CreateVehicle(PrivateVehicle[i][p_modelID],PrivateVehicle[i][p_x],PrivateVehicle[i][p_y],PrivateVehicle[i][p_z],PrivateVehicle[i][p_a],PrivateVehicle[i][p_color1],PrivateVehicle[i][p_color2],-1);
    PutPlayerInVehicle(playerid,PrivateVehicle[i][p_vID],0);
    return SendClientMessage(playerid,Gelb,"[SInfo] {FFFFFF}The Private Vehicle was created and saved.");
    }
    }
    return SendClientMessage(playerid,Rot,"Error: {FFFFFF}The Limit of MAX_PRIVATE_VEHICLES is reached.");
    }

    Es funktioniert jetzt, aber auch nicht immer.
    Ich habe mir 2x ein Fahrzeug gespawned welches mir gehört und MAX_PRIVATE_VEHICLES zu MAX_VEHICLES abgeändert.
    Nun bekomme ich aber nur bei 1nem erstellen Fahrzeug die Lock Nachrichten.


    //EDIT:
    ocmd:lock(playerid,params[])
    {
    for(new i=0;i<MAX_VEHICLES;i++)
    {
    new Float:pos[3];
    GetVehiclePos(i,pos[0],pos[1],pos[2]);
    if(IsPlayerInRangeOfPoint(playerid,5,pos[0],pos[1],pos[2]))
    {
    if(!strlen(PrivateVehicle[i][p_owner]))continue;
    if(!strcmp(PrivateVehicle[i][p_owner], getPlayerName(playerid)))
    {
    printf("Owner = %s",PrivateVehicle[i][p_owner]);
    printf("Player = %s",getPlayerName(playerid));
    new engine,lights,alarm,doors,bonnet,boot,objective;
    GetVehicleParamsEx(i,engine,lights,alarm,doors,bonnet,boot,objective);
    if(doors == 1)
    {
    SetVehicleParamsEx(i,engine,lights,alarm,0,bonnet,boot,objective);
    SendClientMessage(playerid,Gelb,"[SInfo] {FFFFFF}You have unlocked your Vehicle.");
    return 1;
    }
    else
    {
    SetVehicleParamsEx(i,engine,lights,alarm,1,bonnet,boot,objective);
    SendClientMessage(playerid,Gelb,"[SInfo] {FFFFFF}You have locked your Vehicle.");
    return 1;
    }
    }
    return SendClientMessage(playerid,Rot,"Error: {FFFFFF}You are not near by your Vehicle.");
    }
    }
    return SendClientMessage(playerid,Rot,"Error: {FFFFFF}You are not near by your Vehicle.");
    }