10.09.2013, 10:48
pawn Код:
stock LoadHouses()
{
new i, query[200], field[64], housename[24];
mysql_query("SELECT * FROM `housedata`");
mysql_store_result();
while (mysql_retrieve_row())
{
mysql_fetch_field_row(field, "HouseID"); hInfo[i][mID] = strval(field);
mysql_fetch_field_row(field, "Price"); hInfo[i][Price] = strval(field);
mysql_fetch_field_row(field, "EnterX"); hInfo[i][EnterX] = floatstr(field);
mysql_fetch_field_row(field, "EnterY"); hInfo[i][EnterY] = floatstr(field);
mysql_fetch_field_row(field, "EnterZ"); hInfo[i][EnterZ] = floatstr(field);
mysql_fetch_field_row(field, "ExitX"); hInfo[i][ExitX] = floatstr(field);
mysql_fetch_field_row(field, "ExitY"); hInfo[i][ExitY] = floatstr(field);
mysql_fetch_field_row(field, "ExitZ"); hInfo[i][ExitZ] = floatstr(field);
mysql_fetch_field_row(field, "Interior"); hInfo[i][mInterior] = strval(field);
mysql_fetch_field_row(field, "World"); hInfo[i][World] = strval(field);
mysql_fetch_field_row(field, "Text"); format(hInfo[i][Text], 128, field);
mysql_fetch_field_row(field, "Owner"); format(hInfo[i][Owner], 24, field);
mysql_fetch_field_row(field, "Owned"); hInfo[i][Owned] = strval(field);
mysql_fetch_field_row(field, "Locked"); hInfo[i][Locked] = strval(field);
i++;
}
mysql_free_result();
format(housename, 24, "%s", hInfo[i][Text]);
strreplace(housename, '_', ' ');
if(!strcmp(hInfo[i][Owner], "None", false)) format(query, sizeof(query), "[MЬЬA]\n%s\nHind: %i", housename, hInfo[i][Price]);
else format(query, sizeof(query), "%s\n[Omanik]:%s", hInfo[i][Text], hInfo[i][Owner]);
hInfo[i][Label] = Create3DTextLabel(string, COLOR_LIGHTORANGE, hInfo[i][EnterX],hInfo[i][EnterY], hInfo[i][EnterZ], 35.0, 0, 1);
hInfo[i][Pickup] = CreatePickup(1273, 1, hInfo[i][EnterX], hInfo[i][EnterY], hInfo[i][EnterZ], 0);
printf("Maja ID %i laetud; Aadress: %s", i, hInfo[i][Text]);
return 1;
}
stock ReloadHouses()
{
for(new i = 1; i < MAX_HOUSES; i++)
{
Delete3DTextLabel(hInfo[i][Label]);
DestroyPickup(hInfo[i][Pickup]);
}
LoadHouses();
return 1;
}