Buy House When Owner is Offline! - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Buy House When Owner is Offline! (
/showthread.php?tid=604133)
Buy House When Owner is Offline! -
danish007 - 01.04.2016
any idea about buying house? when the owner of house is not connected! i hope there is something direct to do with user(owner) files.. im using INI
Re: Buy House When Owner is Offline! -
Alpha000 - 01.04.2016
I'm newbie in scripting but this may help you.... Try making if statement to check that if the house is owned.....then in case IF house is owned make another if statement that is if owner is Online and if owner is NOTonline then players can buy the house... Make these in your buy house command..
Re: Buy House When Owner is Offline! -
danish007 - 01.04.2016
anyone other?
Re: Buy House When Owner is Offline! -
introzen - 01.04.2016
No one here can help you with any coding unless your provide the right code for your house system.
Let's say you're using HouseInfo[MAX_HOUSES][hInfo]. This would then be an example code.
Код:
CMD:buyhouse(playerid, params[]) {
new string[128], houseid, name;
houseid = GetPlayerNearestHouseEntrance(playerid)
if(houseid == -1) return SendClientMessage(playerid, -1, "You're not near any entrance.");
if(HouseInfo[houseid][hSale] != 1) return SendClientMessage(playerid, -1, "House is not for sale.");
if(GetPlayerMoney(playerid) < HouseInfo[houseid][hPrice]) return SendClientMessage(playerid, -1, "You don't have enough money.");
GetPlayerName(playerid, name, sizeof(name));
format(HouseInfo[houseid][hOwner], %s, name);
GivePlayerMoney(playerid, -HouseInfo[houseid][hPrice]);
SendClientMessage(playerid, -1, "Congratulations on your purchase.");
return 1;
}