stock BuyHouse(playerid, houseid)
{
new string2[256];
new name[24];
GetPlayerName(playerid, name, sizeof(name));
#if defined PRINT_HOUSES
printf("%s Bought House ID %d", name, houseid);
#endif
GivePlayerMoney(playerid, -hInfo[houseid][Cost]);
format(string2,sizeof(string2), HOUSE_FILE, houseid);
INI_Open(string2);
INI_WriteString("Name", name);
INI_WriteInt("Locked", 0);
INI_Save();
INI_Close();
hInfo[houseid][Name] = name;
hInfo[houseid][Locked] = 0;
DestroyPickup(HousePickup[houseid]);
HousePickup[houseid] = CreatePickup(1272, 23, hInfo[houseid][ExteriorX], hInfo[houseid][ExteriorY], hInfo[houseid][ExteriorZ]);
ShowBoughtHouseMessage(playerid);
return 1;
}
if(GetPlayerScore(playeerid) >= 1000) return SendClientMessage(playerid, [color], "You have to get 1000 score before you can use this command");
stock BuyHouse(playerid, houseid)
{
if(GetPlayerScore(playerid) >= 1000) return SendClientMessage(playerid, "You have to get 1000 score before you can use this command");
new string2[256];
new name[24];
GetPlayerName(playerid, name, sizeof(name));
#if defined PRINT_HOUSES
printf("%s Bought House ID %d", name, houseid);
#endif
GivePlayerMoney(playerid, -hInfo[houseid][Cost]);
format(string2,sizeof(string2), HOUSE_FILE, houseid);
INI_Open(string2);
INI_WriteString("Name", name);
INI_WriteInt("Locked", 0);
INI_Save();
INI_Close();
hInfo[houseid][Name] = name;
hInfo[houseid][Locked] = 0;
DestroyPickup(HousePickup[houseid]);
HousePickup[houseid] = CreatePickup(1272, 23, hInfo[houseid][ExteriorX], hInfo[houseid][ExteriorY], hInfo[houseid][ExteriorZ]);
ShowBoughtHouseMessage(playerid);
return 1;
}
if(GetPlayerScore(playerid) >= 1000) return SendClientMessage(playerid, "You have to get 1000 score before you can use this command");
if(GetPlayerScore(playerid) <= 1000) return SendClientMessage(playerid, REPLACE_ME_WITH_YOUR_COLOR, "You have to get 1000 score before you can use this command");
SendClientMessage(playerid, 0xFFFFFFAA, "text"); //white
You didn't replace [color] with your desired colour. Also, that snippet has flawed logic. It'll fail if the player HAS more than 1000 score.
pawn Код:
|
stock OpenHouseDialog(playerid, houseid)
{
if(strcmp(hInfo[houseid][Name], "ForSale",true) == 0)
{
new string[180];
if(GetPlayerScore(playerid) >= 1000) return SendClientMessage(playerid, 0xFFFFFFAA, "You have to get 1000 score before you can use this command");
if(GetPlayerMoney(playerid) >= hInfo[houseid][Cost]) { format(string,sizeof(string),"{33AA33}Buy this house for $%d", hInfo[houseid][Cost]); }
else { format(string,sizeof(string),"{FF0000}Buy this house for $%d", hInfo[houseid][Cost]); }
ShowPlayerDialog(playerid, DIALOG_FORSALE_HOUSE, DIALOG_STYLE_LIST, "{33AA33}For Sale!", string, "OK", "Close");
return 1;
}
else
{
new string2[180];
new name[24];
GetPlayerName(playerid,name,sizeof(name));
if(strcmp(hInfo[houseid][Name], name, true) == 0)
{
ShowPlayerDialog(playerid, DIALOG_MY_HOUSE,DIALOG_STYLE_LIST, "{33AA33}Welcome back to your house", "{33AA33}Enter in your house\n{33AA33}Open/Close the door\n{33AA33}Sell your house", "OK", "Close");
return 0;
}
stock OpenHouseDialog(playerid, houseid)
{
if(strcmp(hInfo[houseid][Name], "ForSale",true) == 0)
{
new string[180];
if(GetPlayerScore(playerid) <= 1000) return SendClientMessage(playerid, 0xFFFFFFAA, "You have to get 1000 score before you can use this command");
if(GetPlayerMoney(playerid) >= hInfo[houseid][Cost]) { format(string,sizeof(string),"{33AA33}Buy this house for $%d", hInfo[houseid][Cost]); }
else { format(string,sizeof(string),"{FF0000}Buy this house for $%d", hInfo[houseid][Cost]); }
ShowPlayerDialog(playerid, DIALOG_FORSALE_HOUSE, DIALOG_STYLE_LIST, "{33AA33}For Sale!", string, "OK", "Close");
return 1;
}
else
{
new string2[180];
new name[24];
GetPlayerName(playerid,name,sizeof(name));
if(strcmp(hInfo[houseid][Name], name, true) == 0)
{
ShowPlayerDialog(playerid, DIALOG_MY_HOUSE,DIALOG_STYLE_LIST, "{33AA33}Welcome back to your house", "{33AA33}Enter in your house\n{33AA33}Open/Close the door\n{33AA33}Sell your house", "OK", "Close");
return 0;
}
if(GetPlayerScore(playerid) <= 1000) return SendClientMessage(playerid, 0xFFFFFFAA, "You have to get 1000 score before you can use this command");