10.10.2013, 01:59
The GivePlayerMoney doesn't work for this /buyhouse command. It also doesn't set the owner when typing /buyhouse, so you can't /sellhouse because it don't set the owner!
pawn Код:
CMD:buyhouse(playerid, params[])
{
new string[100], owner[30], ID;
if(sscanf(params, "d", ID)) return UsageMessage(pid, "/buyhouse [houseaddress]");
if(!IsPlayerInRangeOfPoint(pid, 5.5, HouseInfo[ID][hextX], HouseInfo[ID][hextY], HouseInfo[ID][hextZ])) return SCM(pid, COLRED, "Server: {F0F0F0}You are not in range of house!");
if(GetPlayerMoney(playerid) >= HouseInfo[ID][hPrice])
{
if(strmatch(HouseInfo[ID][hOwner], "None"))
{
new price = HouseInfo[ID][hPrice];
GivePlayerMoney(playerid, - price);
format(owner, sizeof(owner), "%s", GetName(playerid));
HouseInfo[ID][hOwner] = owner;
Delete3DTextLabel(HouseInfo[ID][hLabel]);
format(string, sizeof(string), "%House\nAddress: %d", ID);
HouseInfo[ID][hLabel] = Create3DTextLabel(string, COLBLUE, HouseInfo[ID][hextX], HouseInfo[ID][hextY], HouseInfo[ID][hextZ], 20.0, 0, 1);
}
else return SCM(pid, COLRED, "Server: {f0f0f0}this house is owned.");
}
else
{
SCM(pid, COLRED, "Server: {f0f0f0}You don't have enough money.");
}
return 1;
}