new HousePickup[MAX_HOUSES];
enum HouseData
{
Name[24],
Rentable,
RentCost,
Cost,
Sell,
Interior,
VirtualWorld,
Locked,
Float:InteriorX,
Float:InteriorY,
Float:InteriorZ,
Float:IconX,
Float:IconY,
Float:IconZ
}
new HouseInfo[MAX_HOUSES][HouseData];
AddHouse(1,1258.4746,-785.3508,92.0302,1263.0800,-785.3090,1091.9063, 100, 100, 5, 1);
AddHouse(houseid, Float:iconX, Float:iconY, Float:iconZ, Float:interiorX, Float:interiorY, Float:interiorZ, cost, sell, interior, virtualworld)
{
new query[128];
format(query, sizeof(query), "SELECT * FROM houses WHERE houseid = %d", houseid);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() == 0)
{
new query2[1024];
format(query2, sizeof(query2), "INSERT INTO houses (houseid, name, rentable, rentcost, cost, sell, interior, virtualworld, locked, X, Y, Z) VALUES (%d, 'ForSale', 0, 0, %d, %d, %d, %d, 1, %f, %f, %f)", houseid, cost, sell, interior, virtualworld, interiorX, interiorY, interiorZ);
mysql_query(query);
format(HouseInfo[houseid][Name], 24, "ForSale");
HouseInfo[houseid][Rentable] = 0;
HouseInfo[houseid][RentCost] = 0;
HouseInfo[houseid][Cost] = cost;
HouseInfo[houseid][Sell] = sell;
HouseInfo[houseid][Interior] = interior;
HouseInfo[houseid][VirtualWorld] = virtualworld;
HouseInfo[houseid][Locked] = 1;
HouseInfo[houseid][InteriorX] = interiorX;
HouseInfo[houseid][InteriorY] = interiorY;
HouseInfo[houseid][InteriorZ] = interiorZ;
}
if(mysql_num_rows() == 1)
{
new row[1024], name[24], rentable[2], rentcost[6], locked[2];
mysql_fetch_row(row);
mysql_fetch_field_row(name, "name");
format(HouseInfo[houseid][Name], 24, "%s", name);
mysql_fetch_field_row(rentable, "rentable");
HouseInfo[houseid][Rentable] = strval(rentable);
mysql_fetch_field_row(rentcost, "rentcost");
HouseInfo[houseid][RentCost] = strval(rentcost);
HouseInfo[houseid][Cost] = cost;
HouseInfo[houseid][Sell] = sell;
HouseInfo[houseid][Interior] = interior;
HouseInfo[houseid][VirtualWorld] = virtualworld;
mysql_fetch_field_row(locked, "locked");
HouseInfo[houseid][Locked] = strval(locked);
HouseInfo[houseid][InteriorX] = interiorX;
HouseInfo[houseid][InteriorY] = interiorY;
HouseInfo[houseid][InteriorZ] = interiorZ;
}
HouseInfo[houseid][IconX] = iconX;
HouseInfo[houseid][IconY] = iconY;
HouseInfo[houseid][IconZ] = iconZ;
if(strcmp(HouseInfo[houseid][Name],"ForSale",true)==0)
{
HousePickup[houseid] = CreatePickup(1273, 2, iconX, iconY, iconZ);
}
else
{
HousePickup[houseid] = CreatePickup(1272, 2, iconX, iconY, iconZ);
}
}
HouseDebug(playerid, pickupid)
{
for(new i=0;i<MAX_HOUSES;i++)
{
if(HousePickup[i] == pickupid)
{
new s1[32], s2[32], s3[32], s4[32], s5[32], s6[32], s7[32], s8[32];
format(s1, 32, "%d", i);
format(s2, 32, "%s", HouseInfo[i][Name]);
format(s3, 32, "%d", HouseInfo[i][Cost]);
format(s4, 32, "%d", HouseInfo[i][Rentable]);
format(s5, 32, "%d", HouseInfo[i][RentCost]);
format(s6, 32, "%d", HouseInfo[i][Sell]);
format(s7, 32, "%f", HouseInfo[i][IconX]);
format(s8, 32, "%f", HouseInfo[i][InteriorX]);
SendClientMessage(playerid, RED, s1);
SendClientMessage(playerid, RED, s2);
SendClientMessage(playerid, RED, s3);
SendClientMessage(playerid, RED, s4);
SendClientMessage(playerid, RED, s5);
SendClientMessage(playerid, RED, s6);
SendClientMessage(playerid, RED, s7);
SendClientMessage(playerid, RED, s8);
}
}
return 1;
}
Originally Posted by Seif_ [adream-rp.com
]
It's not "float:" it's "Float:", capitalize the F. |
HouseDebug(playerid, pickupid)
{
for(new i=0;i<MAX_HOUSES;i++)
{
if(HousePickup[i] == pickupid)
{
new s1[32], s2[32], s3[32], s4[32], s5[32], s6[32], s7[32], s8[32];
format(s1, 32, "%d", i);
format(s2, 32, "%s", HouseInfo[i][Name]);
format(s3, 32, "%d", HouseInfo[i][Cost]);
format(s4, 32, "%d", HouseInfo[i][Rentable]);
format(s5, 32, "%d", HouseInfo[i][RentCost]);
format(s6, 32, "%d", HouseInfo[i][Sell]);
format(s7, 32, "%f", HouseInfo[i][IconX]);
format(s8, 32, "%f", HouseInfo[i][InteriorX]);
SendClientMessage(playerid, RED, s1);
SendClientMessage(playerid, RED, s2);
SendClientMessage(playerid, RED, s3);
SendClientMessage(playerid, RED, s4);
SendClientMessage(playerid, RED, s5);
SendClientMessage(playerid, RED, s6);
SendClientMessage(playerid, RED, s7);
SendClientMessage(playerid, RED, s8);
}
}
return 1;
}