[HELP] Buying house 1 dollar more - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Buying house 1 dollar more (
/showthread.php?tid=271507)
[HELP] Buying house 1 dollar more -
spaty2 - 24.07.2011
pawn Код:
if(strcmp(cmd, "/buyhouse", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
for(new h = 0; h < sizeof(HouseInfo); h++)
{
if(PlayerToPoint(2.0, playerid, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]) && HouseInfo[h][hOwned] == 0)
{
if(PlayerInfo[playerid][pLevel] < HouseInfo[h][hLevel])
{
format(string, sizeof(string), " You must be Level %d to purchase this !", HouseInfo[h][hLevel]);
SendClientMessage(playerid, COLOR_GRAD5, string);
return 1;
}
if(PlayerInfo[playerid][pPhousekey] != 255 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
{
SendClientMessage(playerid, COLOR_WHITE, " You already own a house, type /sellhouse if you want to buy this one !");
return 1;
}
if(GetPlayerMoney(playerid) > HouseInfo[h][hValue])
{
format(string, sizeof(string), "1st Money: %d", GetPlayerMoney(playerid));
SendClientMessage(playerid, -1, string);
PlayerInfo[playerid][pPhousekey] = h;
HouseInfo[h][hOwned] = 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(HouseInfo[h][hOwner], sendername, 0, strlen(sendername), 255);
SafeGivePlayerMoney(playerid, -HouseInfo[h][hValue] + 1);
format(string, sizeof(string), "Second Money: %d", GetPlayerMoney(playerid));
SendClientMessage(playerid, -1, string);
PlayerPlayMusic(playerid);
SetPlayerInterior(playerid,HouseInfo[h][hInt]);
SetPlayerVirtualWorld(playerid,HouseInfo[h][hWorld]);
SetPlayerPos(playerid,HouseInfo[h][hExitx],HouseInfo[h][hExity],HouseInfo[h][hExitz]);
GameTextForPlayer(playerid, "~w~Welcome Home~n~You can exit at any time by moving to this door and typing /exit", 5000, 3);
PlayerInfo[playerid][pInt] = HouseInfo[h][hInt];
PlayerInfo[playerid][pLocal] = h;
HouseEntered[playerid] = h;
SendClientMessage(playerid, COLOR_WHITE, "Congratulations, on your new Purchase !");
SendClientMessage(playerid, COLOR_WHITE, "Type /help to review the new property help section !");
Delete3DTextLabel(Text3D:housesale);
DateProp(playerid);
OnPropUpdate();
OnPlayerUpdate(playerid);
format(string, sizeof(string), "Last Money: %d", GetPlayerMoney(playerid));
SendClientMessage(playerid, -1, string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, " You don't have the cash for that !");
return 1;
}
}
}
}
return 1;
Hello, when I buying house, it shows 300000 but i must pay 3000001 do you know, why? thx
Re: [HELP] Buying house 1 dollar more -
Prumpuz - 24.07.2011
Try changing
pawn Код:
if(GetPlayerMoney(playerid) > HouseInfo[h][hValue])
to
pawn Код:
if(GetPlayerMoney(playerid) => HouseInfo[h][hValue])
You see, > means only if you have more cash then the value of the house. => means if you have exactly or more then the value.
Re: [HELP] Buying house 1 dollar more -
spaty2 - 24.07.2011
Yes man, that can be this.... i know what it means it's normal, bigger then, =, or smaller then
Re: [HELP] Buying house 1 dollar more -
spaty2 - 24.07.2011
it must be like this >= no =>
Re: [HELP] Buying house 1 dollar more -
spaty2 - 24.07.2011
Yep Works, thx