Quote:
Originally Posted by Bingo
Why'd you need the whole script instead of the callback function?
Post your house loading function.
|
hi bingo
public load_houses()
{
new DBResult:qresult, count = 0, value[328];
if(!db_query(DB: HOUSEDB, "SELECT * FROM `house_data`"))
{
print("HOUSE SYSTEM :: No houses were found in \"Houses.db\" :: 0 Loaded");
}
else
{
qresult = db_query(DB: HOUSEDB, "SELECT * FROM `house_data`");
count = db_num_rows(qresult);
for(new i = 0; i < count; i++)
{
if(count <= MAX_SCRIPT_HOUSES)
{
db_get_field_assoc(qresult, "house_id", value, 5);
houseStuff[i][house_id] = strval(value);
db_get_field_assoc(qresult, "house_owner", value, 4
![Cool](images/smilies/cool.gif)
;
format(houseStuff[i][house_owner], 48, value);
db_get_field_assoc(qresult, "house_password", value, 4
![Cool](images/smilies/cool.gif)
;
format(houseStuff[i][house_password], 48, value);
db_get_field_assoc(qresult, "house_title", value, 4
![Cool](images/smilies/cool.gif)
;
format(houseStuff[i][house_title], 48, value);
db_get_field_assoc(qresult, "house_bought", value, 20);
houseStuff[i][house_bought] = strval(value);
db_get_field_assoc(qresult, "house_price", value, 20);
houseStuff[i][house_price] = strval(value);
db_get_field_assoc(qresult, "houseX", value, 20);
houseStuff[i][houseX] = floatstr(value);
db_get_field_assoc(qresult, "houseY", value, 20);
houseStuff[i][houseY] = floatstr(value);
db_get_field_assoc(qresult, "houseZ", value, 20);
houseStuff[i][houseZ] = floatstr(value);
db_get_field_assoc(qresult, "interiorX", value, 20);
houseStuff[i][interiorX] = floatstr(value);
db_get_field_assoc(qresult, "interiorY", value, 20);
houseStuff[i][interiorY] = floatstr(value);
db_get_field_assoc(qresult, "interiorZ", value, 20);
houseStuff[i][interiorZ] = floatstr(value);
db_get_field_assoc(qresult, "interiorAngle", value, 20);
houseStuff[i][interiorA] = floatstr(value);
db_get_field_assoc(qresult, "interiorID", value, 20);
houseStuff[i][interiorID] = strval(value);
db_get_field_assoc(qresult, "lockType", value, 20);
houseStuff[i][houseLock] = strval(value);
db_get_field_assoc(qresult, "houseAlarm", value, 20);
houseStuff[i][houseAlarm] = strval(value);
houseECP[i] = CreateDynamicCP(houseStuff[i][houseX], houseStuff[i][houseY], houseStuff[i][houseZ], 1.5, 0);
houseECP2[i] = CreateDynamicCP(houseStuff[i][interiorX], houseStuff[i][interiorY], houseStuff[i][interiorZ], 1.5, 150 + houseStuff[i][house_id]);
new labelstring[200];
switch(houseStuff[i][house_bought])
{
case 0:
{
houseStuff[i][label] = CreateDynamic3DTextLabel("{58D3F7}[FOR SALE]", COLOR_WHITE, houseStuff[i][houseX], houseStuff[i][houseY], houseStuff[i][houseZ] + 0.2, 25.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, 0, -1);
format(labelstring, sizeof(labelstring), "{FFFFFF}/buyhouse {FFDC2E}%i {FFFFFF}\nPrice: {FFDC2E}$%i", houseStuff[i][house_id], houseStuff[i][house_price]);
}
case 1:
{
houseStuff[i][label] = CreateDynamic3DTextLabel("{58D3F7}[ALT TO ENTER]", COLOR_WHITE, houseStuff[i][houseX], houseStuff[i][houseY], houseStuff[i][houseZ] + 0.2, 25.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, 0, -1);
format(labelstring, sizeof(labelstring), "{FFFFFF}Owner: {FFDC2E}%s\n{FFFFFF}House ID: {FFDC2E}%i", houseStuff[i][house_owner], houseStuff[i][house_id], houseStuff[i][house_price]);
}
}
houseStuff[i][infoLabel] = CreateDynamic3DTextLabel(labelstring, 0xFF0000FF, houseStuff[i][houseX], houseStuff[i][houseY], houseStuff[i][houseZ], 25.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, 0, -1);
xHouses++;
db_next_row(qresult);
}
}
db_free_result(qresult);
}
}