Evo CMD: if(strcmp(cmd, "/buyhouse", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new Float😮ldposx, Float😮ldposy, Float😮ldposz;
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
for(new h = 0; h < sizeof(HouseInfo); h++)
{
if(IsPlayerInRangeOfPoint(playerid, 2, HouseInfo, HouseInfo, HouseInfo) && HouseInfo == 0)
{
if(PlayerInfo < HouseInfo)
{
format(string, sizeof(string), " You must be Level %d to purchase this !", HouseInfo);
SendClientMessage(playerid, COLOR_GRAD5, string);
return 1;
}
if(PlayerInfo != 999 && strcmp(playername, HouseInfo[PlayerInfo], 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)
{
if(PlayerInfo == 1)
{
PlayerInfo = h;
HouseInfo = 1;
strmid(HouseInfo, sendername, 0, strlen(sendername), 255);
SafeGivePlayerMoney(playerid,-HouseInfo);
PlayerPlayMusic(playerid);
GameTextForPlayer(playerid, "~w~Welcome Home~n~You can exit at any time by moving to this door and typing /exit", 5000, 3);
SendClientMessage(playerid, COLOR_WHITE, "Congratulations, on your new Purchase !");
SendClientMessage(playerid, COLOR_WHITE, "Type /help to review the new property help section !");
DateProp(playerid);
SendClientMessage(playerid, COLOR_PINK, "* Remember to type /selectspawn if you wish to spawn at your house when you Log in!");
OnPropUpdate(1);
OnPlayerUpdateEx(playerid);
OnPropTextdrawUpdate(1, h);
OnHousePickupUpdate(h);
new y, m, d;
new h1,mi,s;
getdate(y,m,d);
gettime(h1,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s -> /buyhouse [$%d]",d,m,y,h1,mi,s,sendername, HouseInfo);
PayLog(string);
if (PlayerInfo == 0)
{
TextDrawSetString(Textdraw64,"Congratulations! ~n~~n~You have earned the medal ~n~~b~Home, Sweet, Home. (1😎 ~n~~n~~w~you won ~g~$1337");
ShowAchievement(playerid);
SafeGivePlayerMoney(playerid, 1337);
PlayerInfo = 1;
}