31.05.2011, 06:28
Estoy haciendo un sistema de casas, pero hay problema:

http://s3.subirimagenes.com:81/priva...088samp020.png
Sale ese mensaje en rojo como error al comprar la casa (como pueden ya habнa comprado la casa).
Tambiйn cuando la vendo.
Edit: Mm, veo que la imagen esta un poco pequeсa, asн que aquн les dejo el mensaje:
"You have successfully purchased a new house"
"PCash: -10000"
"You already own a house"

http://s3.subirimagenes.com:81/priva...088samp020.png
Sale ese mensaje en rojo como error al comprar la casa (como pueden ya habнa comprado la casa).
Tambiйn cuando la vendo.
Edit: Mm, veo que la imagen esta un poco pequeсa, asн que aquн les dejo el mensaje:
"You have successfully purchased a new house"
"PCash: -10000"
"You already own a house"
pawn Код:
dcmd_buyhouse(playerid, params[])
{
#pragma unused params
for(new houseid = 0; houseid < MAX_HOUSES; houseid++)
{
new str[128], pName[20], file[128];
GetPlayerName(playerid, pName, 20);
format(file, sizeof(file), "/Users/%s.ini", pName);
if(dini_Int(file, "HouseOwner") == 1) return SendClientMessage(playerid, COLOR_RED," » You aleady own a house");
else if(dini_Int(HFile(houseid), "Owned") == 1) return SendClientMessage(playerid, COLOR_RED," » This house is already owned");
else if(!IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[houseid][hEnterX], HouseInfo[houseid][hEnterY], HouseInfo[houseid][hEnterZ])) return SendClientMessage(playerid, COLOR_RED," » You are not near a house icon");
else if(PlayerInfo[playerid][PCash] < dini_Int(HFile(houseid), "Price")) return SendClientMessage(playerid, COLOR_RED," » You don't have enough money");
else
{
dini_IntSet(file, "HouseOwnedID", houseid);
dini_IntSet(file, "HouseOwner", 1);
dini_FloatSet(file, "HouseX", HouseInfo[dini_Int(file, "HouseOwnedID")][hEnterX]);
dini_FloatSet(file, "HouseY", HouseInfo[dini_Int(file, "HouseOwnedID")][hEnterY]);
dini_FloatSet(file, "HouseZ", HouseInfo[dini_Int(file, "HouseOwnedID")][hEnterZ]);
dini_IntSet(HFile(houseid), "Owned", 1);
dini_Set(HFile(houseid), "Owner", pName);
PlayerInfo[playerid][PCash] -= dini_Int(HFile(houseid), "Price");
SendClientMessage(playerid, COLOR_GREEN," » You have successfully purchased a new house");
format(str, 128," » PCash: -%i", dini_Int(HFile(houseid), "Price"));
SendClientMessage(playerid, COLOR_YELLOW, str);
format(str, 128,"House\r\nOwned by: %s", pName);
Update3DTextLabelText(House3D, -1, str);
}
}
return 1;
}
dcmd_sellhouse(playerid, params[])
{
#pragma unused params
for(new houseid = 0; houseid < MAX_HOUSES; houseid++)
{
new str[128], pName[20], file[128];
GetPlayerName(playerid, pName, 20);
format(file, sizeof(file), "/Users/%s.ini", pName);
if(dini_Int(file, "HouseOwner") != 1) return SendClientMessage(playerid, COLOR_RED," » You don't own a house");
else if(!IsPlayerInRangeOfPoint(playerid, 2.0, dini_Float(file, "HouseX"), dini_Float(file, "HouseY"), dini_Float(file, "HouseZ"))) return SendClientMessage(playerid, COLOR_RED," » You are not near your house");
else
{
dini_IntSet(file, "HouseOwnedID", -1);
dini_IntSet(file, "HouseOwner", 0);
dini_FloatSet(file, "HouseX", 0.0);
dini_FloatSet(file, "HouseY", 0.0);
dini_FloatSet(file, "HouseZ", 0.0);
dini_IntSet(HFile(houseid), "Owned", 0);
dini_Set(HFile(houseid), "Owner", "None");
PlayerInfo[playerid][PCash] += dini_Int(HFile(houseid), "Price")/2;
SendClientMessage(playerid, COLOR_GREEN," » You have successfully sold your house");
format(str, 128," » PCash: +%i", dini_Int(HFile(houseid), "Price")/2);
SendClientMessage(playerid, COLOR_YELLOW, str);
format(str, 128,"House\r\nFor sale\r\nPrice: %i", dini_Int(HFile(houseid), "Price"));
Update3DTextLabelText(House3D, -1, str);
}
}
return 1;
}