10.08.2017, 05:26
Hey,
i got some problem with my script, so basically everything works good on this house script, when im creating house im buying and House Owner and house owned columns isnt changing and so basically i just need ur help guys,
there is a code
}
buyhouse
and if u know the solution of this please respond!
i got some problem with my script, so basically everything works good on this house script, when im creating house im buying and House Owner and house owned columns isnt changing and so basically i just need ur help guys,
there is a code
PHP Code:
forward LoadHouse();
public LoadHouse()
{
mysql_tquery(MySQLCon, "SELECT * FROM "HOUSES_TABLE" ORDER BY `ID` ASC", "OnHouseLoad", "");
PHP Code:
forward OnHouseLoad();
public OnHouseLoad() {
new rows, fields, houseLoadTime;
cache_get_data(rows, fields);
if(!rows)
return printf("[House] No houses to load.");
if(rows) {
houseLoadTime = GetTickCount();
for(new i = 0; i < rows; i++) {
HouseInfo[houses][hID] = cache_get_row_int(i, 0, MySQLCon);
HouseInfo[houses][hExt][0] = cache_get_row_float(i, 1, MySQLCon);
HouseInfo[houses][hExt][1] = cache_get_row_float(i, 2, MySQLCon);
HouseInfo[houses][hExt][2] = cache_get_row_float(i, 3, MySQLCon);
HouseInfo[houses][hInt][0] = cache_get_row_float(i, 4, MySQLCon);
HouseInfo[houses][hInt][1] = cache_get_row_float(i, 5, MySQLCon);
HouseInfo[houses][hInt][2] = cache_get_row_float(i, 6, MySQLCon);
HouseInfo[houses][hInterior] = cache_get_row_int(i, 7, MySQLCon);
cache_get_row(i, 8, HouseInfo[houses][hOwner], MySQLCon, MAX_PLAYER_NAME);
HouseInfo[houses][hPrice] = cache_get_row_int(i, 9, MySQLCon);
HouseInfo[houses][hOwned] = cache_get_row_int(i, 10, MySQLCon);
HouseInfo[houses][hType] = cache_get_row_int(i, 11, MySQLCon);
if(HouseInfo[houses][hOwned] == 0) {
HouseInfo[houses][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[houses][hExt][0], HouseInfo[houses][hExt][1], HouseInfo[houses][hExt][2]);
}
else {
HouseInfo[houses][hPickup] = CreateDynamicPickup(1239, 1, HouseInfo[houses][hExt][0], HouseInfo[houses][hExt][1], HouseInfo[houses][hExt][2]);
}
houses++;
}
printf("Loaded %d houses in %02d ms.", houses, GetTickCount() - houseLoadTime);
}
return 1;
}
PHP Code:
CMD:buyhouse(playerid) {
for(new h; h < houses; h++) {
if(IsPlayerInRangeOfPoint(playerid, 1.5, HouseInfo[h][hExt][0], HouseInfo[h][hExt][1], HouseInfo[h][hExt][2])) {
if(!HouseInfo[h][hOwned]) {
if(pInfo[playerid][pMoney] < HouseInfo[h][hPrice])
return SendClientMessage(playerid, COLOR_RED, "ERROR: {FFFFFF}You have insufficient funds to do this action('s).");
if(pInfo[playerid][pHouseKey] > 1)
return SendClientMessage(playerid, COLOR_RED, "ERROR: {FFFFFF}You already own a house.");
SendClientMessage(playerid, COLOR_WHITE, "Property has been {2BFF00}purchased.");
pInfo[playerid][pHouseKey] = 1;
HouseInfo[h][hOwned] = 1;
HouseInfo[h][hOwner] = GetName(playerid);
GiveCash(playerid, -HouseInfo[h][hPrice]);
DestroyDynamicPickup(HouseInfo[h][hPickup]);
HouseInfo[h][hPickup] = CreateDynamicPickup(1239, 1, HouseInfo[h][hExt][0], HouseInfo[h][hExt][1], HouseInfo[h][hExt][2]);
}
}
}
return 1;
}