Need help with house system [SQLite] - Konstantinos, Pottus -
LocMax - 27.06.2014
The problem with following is that house ID keeps being same even if I create multiple houses...
it'll stay as ID 1, even tho in database it increases like 1 2 3 4 5...
pawn Код:
CMD:createhouse(playerid,params[])
{
new Float:EX, Float:EY, Float:EZ, Float:IX, Float:IY, Float:IZ, Cast, Int, Word, name[21], owna[12];
if(sscanf(params, "fffddds[21]s[21]", IX, IY, IZ, Cast, Int, Word, name, owna)) return SendClientMessage(playerid, RED, "/createhouse IX, IY, IZ, Cost, InteriorID, WorldID, name, owner");
new Query[280], DBResult:result;
GetPlayerPos(playerid, EX, EY, EZ);
format(Query, sizeof(Query), "INSERT INTO houses (name, owner, enterx, entery, enterz, interx, intery, interz, cost, interior, world) VALUES ('%s', '%s', '%f', '%f', '%f', '%f', '%f', '%f', %d, %d, %d)", name, owna, EX, EY, EZ, IX, IY, IZ, Cast, Int, Word);
result = db_query(BFU, Query);
if(result) SendClientMessage(playerid, 0x00FF00AA, "House created.");
else if(!result) SendClientMessage(playerid, 0xFF0000AA, "House failed.");
new DBResult:Result, hid;
Result = db_query(BFU, "SELECT * FROM houses");
if(db_num_rows(Result))
{
new Field[190];
db_get_field_assoc(Result, "id", Field, 9); hid = strval(Field);
db_get_field_assoc(Result, "name", Field, 21); format(HouseInfo[hid][Name], 21, "%s", Field);
db_get_field_assoc(Result, "owner", Field, 21); format(HouseInfo[hid][Owner], 21, "%s", Field);
db_get_field_assoc(Result, "enterx", Field, 20); HouseInfo[hid][Enter][0] = floatstr(Field);
db_get_field_assoc(Result, "entery", Field, 20); HouseInfo[hid][Enter][1] = floatstr(Field);
db_get_field_assoc(Result, "enterz", Field, 20); HouseInfo[hid][Enter][2] = floatstr(Field);
db_get_field_assoc(Result, "interx", Field, 20); HouseInfo[hid][Inter][0] = floatstr(Field);
db_get_field_assoc(Result, "intery", Field, 20); HouseInfo[hid][Inter][1] = floatstr(Field);
db_get_field_assoc(Result, "interz", Field, 20); HouseInfo[hid][Inter][2] = floatstr(Field);
db_get_field_assoc(Result, "cost", Field, 8); HouseInfo[hid][Cost] = strval(Field);
db_get_field_assoc(Result, "interior", Field, 5); HouseInfo[hid][Interior] = strval(Field);
db_get_field_assoc(Result, "world", Field, 5); HouseInfo[hid][World] = strval(Field);
if(Result) SendClientMessage(playerid, 0x00FF00AA, "House loaded.");
else if(!Result) SendClientMessage(playerid, 0xFF0000AA, "House not loaded.");
}
db_free_result(Result);
HouseInfo[hid][EnPickup] = CreatePickup(1273, 1, EX, EY, EZ, 0);
HouseInfo[hid][ExPickup] = CreatePickup(1273, 1, IX, IY, IZ, 0);
new str[128];
format(str,sizeof(str), "created house id %d", hid);
SendClientMessage(playerid, 0xFF0000AA, str);
return 1;
}
Re: Need help with house system [SQLite] -
Noliax8 - 27.06.2014
The fields "ID", is "Auto Increment" ?
Re: Need help with house system [SQLite] -
LocMax - 27.06.2014
Quote:
Originally Posted by Noliax8
The fields "ID", is "Auto Increment" ?
|
Yes.
Re: Need help with house system [SQLite] -
Konstantinos - 27.06.2014
Your code assigns the data to the variables for the first row only. Use
db_next_row
Re: Need help with house system [SQLite] -
LocMax - 27.06.2014
I have this now, but it only floods the console, basically I don't know how to stop when it doesn't have any more rows..
pawn Код:
new DBResult:Result, hid;
Result = db_query(BFU, "SELECT * FROM houses");
do
{
new Field[190];
db_get_field_assoc(Result, "id", Field, 9); hid = strval(Field);
db_get_field_assoc(Result, "name", Field, 21); format(HouseInfo[hid][Name], 21, "%s", Field);
db_get_field_assoc(Result, "owner", Field, 21); format(HouseInfo[hid][Owner], 21, "%s", Field);
db_get_field_assoc(Result, "enterx", Field, 20); HouseInfo[hid][Enter][0] = floatstr(Field);
db_get_field_assoc(Result, "entery", Field, 20); HouseInfo[hid][Enter][1] = floatstr(Field);
db_get_field_assoc(Result, "enterz", Field, 20); HouseInfo[hid][Enter][2] = floatstr(Field);
db_get_field_assoc(Result, "interx", Field, 20); HouseInfo[hid][Inter][0] = floatstr(Field);
db_get_field_assoc(Result, "intery", Field, 20); HouseInfo[hid][Inter][1] = floatstr(Field);
db_get_field_assoc(Result, "interz", Field, 20); HouseInfo[hid][Inter][2] = floatstr(Field);
db_get_field_assoc(Result, "cost", Field, 8); HouseInfo[hid][Cost] = strval(Field);
db_get_field_assoc(Result, "interior", Field, 5); HouseInfo[hid][Interior] = strval(Field);
db_get_field_assoc(Result, "world", Field, 5); HouseInfo[hid][World] = strval(Field);
HouseInfo[hid][EnPickup] = CreatePickup(1273, 1, HouseInfo[hid][Enter][0], HouseInfo[hid][Enter][1], HouseInfo[hid][Enter][2], 0);
printf("House ID %d loaded.", hid);
}
while(db_next_row(Result));
new DBResult:result, vid;
result = db_query(BFU, "SELECT * FROM vehicles");
do
{
new Field[115];
db_get_field_assoc(Result, "id", Field, 9); vid = strval(Field);
db_get_field_assoc(Result, "owner", Field, 21); format(HouseInfo[vid][Owner], 21, "%s", Field);
db_get_field_assoc(Result, "posx", Field, 20); HouseInfo[vid][Enter][0] = floatstr(Field);
db_get_field_assoc(Result, "posy", Field, 20); HouseInfo[vid][Enter][0] = floatstr(Field);
db_get_field_assoc(Result, "posz", Field, 20); HouseInfo[vid][Enter][0] = floatstr(Field);
db_get_field_assoc(Result, "angle", Field, 20); HouseInfo[vid][Enter][0] = floatstr(Field);
db_get_field_assoc(Result, "model", Field, 20); HouseInfo[vid][Enter][0] = floatstr(Field);
db_get_field_assoc(Result, "forsale", Field, 2); HouseInfo[vid][Enter][0] = floatstr(Field);
AddStaticVehicleEx(VehicleInfo[vid][Model], VehicleInfo[vid][vPos][0], VehicleInfo[vid][vPos][1], VehicleInfo[vid][vPos][2], VehicleInfo[vid][Angle], VehicleInfo[vid][Color][0], VehicleInfo[vid][Color][1], 300);
printf("Vehicle ID %d loaded.", vid);
}
while(db_next_row(result));
Код:
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
[14:54:14] Vehicle ID x8LЁ loaded.
Re: Need help with house system [SQLite] -
Konstantinos - 27.06.2014
The loop will stop if db_next_row returns 0. I haven't used do-while for that case, I'd do it as:
pawn Код:
new DBResult:Result, rows, hid, Field[21];
Result = db_query(BFU, "SELECT * FROM houses");
rows = db_num_rows(Result);
for (new i; i != rows; ++i)
{
db_get_field_assoc(Result, "id", Field, 9); hid = strval(Field);
if (hid >= sizeof (HouseInfo)) break; // if the "hid" is greater than the in-bounds index, stop the loop to prevent run time error 4
// rest of code.. db_get_field_assoc, create pickup and print the houseid..
db_next_row(Result);
}
db_free_result(Result);
Re: Need help with house system [SQLite] -
LocMax - 27.06.2014
Alright it's working now, however I have question about /enter and /exit, this is my first time ever making house system so sorry for so many questions..
When I do /exit in house it'll flood the chat with all house IDs.
pawn Код:
CMD:enter(playerid,params[])
{
for(new i = 0; i < MAX_HOUSES; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[i][Enter][0], HouseInfo[i][Enter][1], HouseInfo[i][Enter][2]))
{
SetPlayerInterior(playerid, HouseInfo[i][Interior]);
SetPlayerVirtualWorld(playerid, HouseInfo[i][World]);
SetPlayerPos(playerid, HouseInfo[i][Inter][0], HouseInfo[i][Inter][1], HouseInfo[i][Inter][1]);
SendClientMessage(playerid, BLUE, "You have entered the house.");
new str[128];
format(str,sizeof(str), "entered house id %d", i);
SendClientMessage(playerid, 0xFF0000AA, str);
}
}
return 1;
}
CMD:exit(playerid,params[])
{
for(new i = 0; i < MAX_HOUSES; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[i][Inter][0], HouseInfo[i][Inter][1], HouseInfo[i][Inter][2]))
{
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerPos(playerid, HouseInfo[i][Enter][0], HouseInfo[i][Enter][1], HouseInfo[i][Enter][1]);
SendClientMessage(playerid, BLUE, "You have left the house.");
new str[128];
format(str,sizeof(str), "left house id %d", i);
SendClientMessage(playerid, 0xFF0000AA, str);
}
}
return 1;
}
Re : Need help with house system [SQLite] -
Noliax8 - 27.06.2014
houseenter[playerid] = maisonID;
And /exit:
SetPlayerPos(playerid, HouseInfo[ houseenter[playerid] ][Enter][1], ...);
Re: Need help with house system [SQLite] -
Pottus - 27.06.2014
Lets face it Konstantinos the way he is trying to do it is not a very good way this is not how to design a dynamic system in your server with sqlite.
He doesn't need to have a primary integer key for this kind of system here is what I would do.
pawn Код:
#include <YSI\y_hooks>
#define MAX_HOUSES 1000
#define HOUSEBOUNDSCHECK(%0) if(%0 < 0 || %0 >= MAX_HOUSES) return -1
enum HOUSEENUM
{
Name[21],
Owner[21],
Float:EnterX,
Float:EnterY,
Float:EnterZ,
Float:InterX,
Float:InterY,
Float:InterZ,
Cost,
Interior,
World,
EnPickup,
ExPickup,
}
static HouseInfo[MAX_HOUSES][HOUSEENUM]
// Keep track of houses
static Iterator:HouseIter<MAX_HOUSES>;
hook OnGameModeInit()
{
// Create table
db_query(BFU, "CREATE TABLE IF NOT EXISTS `HouseData` (HouseID INTEGER, name TEXT, owner, TEXT, enterx REAL, entery REAL, enterz REAL, interx REAL, intery REAL, interz REAL, cost INTEGER, interior INTEGER, world INTEGER)");
// Load all data
new DBResult:r = db_query(BFU, "SELECT * FROM `HouseData`);
if(db_num_rows®)
{
// Load data into HouseInfo
for(new i = 0; i < db_num_rows®; i++)
{
new Field[32];
db_get_field_assoc(Result, "HouseID", Field, 9); hid = strval(Field);
db_get_field_assoc(Result, "name", Field, 21); format(HouseInfo[hid][Name], 21, "%s", Field);
db_get_field_assoc(Result, "owner", Field, 21); format(HouseInfo[hid][Owner], 21, "%s", Field);
db_get_field_assoc(Result, "enterx", Field, 20); HouseInfo[hid][EnterX] = floatstr(Field);
db_get_field_assoc(Result, "entery", Field, 20); HouseInfo[hid][EnterY] = floatstr(Field);
db_get_field_assoc(Result, "enterz", Field, 20); HouseInfo[hid][EnterZ] = floatstr(Field);
db_get_field_assoc(Result, "interx", Field, 20); HouseInfo[hid][InterX] = floatstr(Field);
db_get_field_assoc(Result, "intery", Field, 20); HouseInfo[hid][InterY] = floatstr(Field);
db_get_field_assoc(Result, "interz", Field, 20); HouseInfo[hid][InterZ] = floatstr(Field);
db_get_field_assoc(Result, "cost", Field, 8); HouseInfo[hid][Cost] = strval(Field);
db_get_field_assoc(Result, "interior", Field, 5); HouseInfo[hid][Interior] = strval(Field);
db_get_field_assoc(Result, "world", Field, 5); HouseInfo[hid][World] = strval(Field);
db_next_row®;
// Create the house providing the index will ignore inserting into database
CreateHouse(HouseInfo[hid][Name], HouseInfo[hid][Owner],
HouseInfo[hid][EnterX], HouseInfo[hid][EnterY], HouseInfo[hid][EnterZ],
HouseInfo[hid][InterX], HouseInfo[hid][InterY], HouseInfo[hid][InterZ],
HouseInfo[hid][Cost], HouseInfo[hid][Interior], HouseInfo[hid][World], hid)
db_next_row®;
}
}
db_free_result®;
return 1;
}
// Create a house
CreateHouse(hname[], howner[], Float:henterx, Float:hentery, Float:henterz, Float:hinterx, Float:hintery, Float:hinterz, hcost, hinterior, hworld, hloadindex=-1)
{
// Load
new index;
// No load index provided find a new load index
if(hloadindex == -1)
{
// Get free index
index = Iter_Free(HouseIter);
// Too many houses
if(index == -1)
{
print("Error::CreateHouse::Too many houses");
return -1;
}
// Initialize house variables for this index
format(HouseInfo[index][Name], 21, "%s", hname);
format(HouseInfo[index][Owner], 21, "%s", howner);
HouseInfo[index][EnterX] = henterx;
HouseInfo[index][EnterY] = hentery;
HouseInfo[index][EnterZ] = henterz;
HouseInfo[index][InterX] = henterx;
HouseInfo[index][InterY] = hentery;
HouseInfo[index][InterZ] = henterz;
HouseInfo[index][Cost] = hcost;
HouseInfo[index][Interior] = hinterior;
HouseInfo[index][World] = hworld;
// Insert into database
new q[128];
format(q, sizeof(q), "INSERT INTO houses (HouseID, name, owner, enterx, entery, enterz, interx, intery, interz, cost, interior, world) VALUES ('%s', '%s', '%f', '%f', '%f', '%f', '%f', '%f', %d, %d, %d)",
index, hname, howner, henterx, hentery, henterz, hinterx, hintery, hinterz, hcost, hinterior, hworld);
db_query(BFU, q);
}
else
{
// Make sure an OOB index was not given
HOUSEBOUNDSCHECK(hloadindex);
index = hloadindex;
}
// Create the house pickups
HouseInfo[index][EnPickup] = CreatePickup(1273, 1, HouseInfo[index][EnterX], HouseInfo[index][EnterY], HouseInfo[index][EnterZ], 0);
HouseInfo[index][ExPickup] = CreatePickup(1273, 1, HouseInfo[index][InterX], HouseInfo[index][InterY], HouseInfo[index][InterZ], 0);
return index;
}
CMD:createhouse(playerid, params[])
{
new Float:EX, Float:EY, Float:EZ, Float:IX, Float:IY, Float:IZ, Cast, Int, Word, name[21], owna[12], line[128];
if(sscanf(params, "fffddds[21]s[21]", IX, IY, IZ, Cast, Int, Word, name, owna)) return SendClientMessage(playerid, RED, "/createhouse IX, IY, IZ, Cost, InteriorID, WorldID, name, owner");
new hid = CreateHouse(name, owna, EX, EY, EZ, IX, IY, IZ, Cast, Int, World);
new str[128];
format(str,sizeof(str), "created house id %d", hid);
SendClientMessage(playerid, 0xFF0000AA, str);
return 1;
}
Re: Need help with house system [SQLite] -
LocMax - 27.06.2014
It won't teleport me in interior, it just throws me randomly in air and when I type /exit it'll also throw me in air and won't return at the enterance.
EDIT: didn't see Pottus' post, gonna observe it now