2021-10-06, 02:41 AM
Hey.
I have a command of creating houses.
The loop is creating houses just like 1,3,5,7,9,11..etc.
I tried to investigate the problem in the loop and I can't see anything wrong.
Somebody?knows? Here's the code..
I have a command of creating houses.
The loop is creating houses just like 1,3,5,7,9,11..etc.
I tried to investigate the problem in the loop and I can't see anything wrong.
Somebody?knows? Here's the code..
Code:
COMMAND:housecreate(playerid, params[])
{
new houseid, price, Float:X, Float:Y, Float:Z, UID, text[128];
if(sscanf(params,"ii",houseid, price)) return usage(playerid, "USAGE: /HouseCreate [Class] [Value]");
if(houseid < 1 || houseid > 4) return error(playerid, "Invalid house ID.");
new found = 0;
for(new i = 1; i < MAX_HOUSES; i)
{
if(HouseInfo[i][hID] == 0 && found == 0)
{
? ? found;
? ? UID = i;
format(text, sizeof(text), "House id is %d", UID);
SendClientMessage(playerid, -1, text);
}
}
new count = 0;
for(new i = 0; i < sizeof(HouseCoordinates); i)
{
? ? if(count == 0)
? ? {
? ? ? ? if(HouseCoordinates[i][Class] == houseid)
? ? ? ? {
? ? ? ? count;
HouseInfo[UID][hXi] = HouseCoordinates[i][mbX];
HouseInfo[UID][hYi] = HouseCoordinates[i][mbY];
HouseInfo[UID][hZi] = HouseCoordinates[i][mbZ];
HouseInfo[UID][hIntIn] = HouseCoordinates[i][HouseInt];
}
}
}
HouseInfo[UID][hID] = UID;
HouseInfo[UID][hValue] = price;
HouseInfo[UID][hClass] = houseid;
HouseInfo[UID][hIntOut] = GetPlayerInterior(playerid);
HouseInfo[UID][hVwOut] = GetPlayerVirtualWorld(playerid);
HouseInfo[UID][hVwIn] = MAX_INTS UID;
GetPlayerPos(playerid, X, Y, Z);
HouseInfo[UID][hXo] = X;
HouseInfo[UID][hYo] = Y;
HouseInfo[UID][hZo] = Z;
new query[516], owner[25];
format(owner, sizeof(owner), "None");
mysql_format(handlesql, query, sizeof(query),"INSERT INTO `houses`(`ID`, `Xo`, `Yo`, `Zo`, `Xi`, `Yi`, `Zi`, `IntOut`, `IntIn`, `VwOut`, `Owner`, `Value`) VALUES (%d, %f, %f, %f, %f, %f, %f, %d, %d, %d, '%e', %d)",
UID, X, Y, Z, HouseInfo[UID][hXi], HouseInfo[UID][hYi], HouseInfo[UID][hZi], HouseInfo[UID][hIntOut], HouseInfo[UID][hIntIn], HouseInfo[UID][hVwOut],
owner, price);
mysql_pquery(handlesql, query);
HouseInfo[UID][hIcon] = CreateDynamicCP(HouseInfo[UID][hXo], HouseInfo[UID][hYo], HouseInfo[UID][hZo], 1.5, HouseInfo[UID][hVwOut], -1, -1, 20.0);
HouseInfo[UID][hIconi] = CreateDynamicCP(HouseInfo[UID][hXi], HouseInfo[UID][hYi], HouseInfo[UID][hZi], 1.5, HouseInfo[UID][hVwIn], -1, -1, 20.0);
UpdateHouseText(UID);
Iter_Add(HouseIterator, UID);
return 1;
}