22.09.2012, 12:11
pawn Код:
if(strcmp(string,"buy",true) == 0) // House kaufen
{
if(house > 0) return ShowInfoDialog(playerid, "House - Info", "You already own a house");
for(new h = 0; h <= gHouse; h++)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, hInfo[h][hEntrancex], hInfo[h][hEntrancey], hInfo[h][hEntrancez]))
{
if(!strcmp(hInfo[h][hOwner], "None", true))
{
if(GetUserMoney(playerid) >= hInfo[h][hValue])
{
new
sendername[MAX_PLAYER_NAME];
print("Blad - Proccesed");
GetPlayerName(playerid, sendername, MAX_PLAYER_NAME);
print("Blad - Proccesed");
strmid(hInfo[h][hOwner], sendername, 0, strlen(sendername), 255);
print("Blad - Proccesed");
GiveUserMoney(playerid,-hInfo[h][hValue]);
print("Blad - Proccesed");
SetUserHouse(playerid);
print("Blad - Proccesed");
ShowInfoDialog(playerid, "House - Info", "You successfully bought the house, use /house to manage it.");
SaveHouse(h);
print("Blad - Proccesed");
SaveAccount(playerid);
print("Blad - Proccesed");
CheckUserAchievement(playerid, ACHIEVEMENT_HOUSE, true);
print("Blad - Proccesed");
}
else ShowInfoDialog(playerid, "House - Info", "You can't afford it");
}
else ShowInfoDialog(playerid, "House - Info", "Someone already owns this house");
}
else ShowInfoDialog(playerid, "Error!", "You arent even near a house");
print("Server distance housing properly");
}
print("Server checked housing properly");
return 1;
}