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:
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;
}
stock LoadHouses()
{
mysql_pquery(Handle, "SELECT * FROM houses ORDER BY ID ASC","LoadHouses_Data");
return 1;
}
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;
}
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;
}
enum interEnum
{
int_ID,
Float:int_exitX,
Float:int_exitY,
Float:int_exitZ
};
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}
};