Sziasztok!
Találtam egy viszonylag jó kis házrendszert ám de az a baj hogy az eladása nem éppen a legjobb. Úgy szeretném megoldani, hogy egy adott játékosnak lehessen eladni a házat annyiért amennyit a tulajdonos megad. Tehát ilyen módon: /sellhouse [JÁTÉKOS ID/NÉV] [HÁZ SZLOTSZÁMA] [ÁR]
És még anyit szeretnék kérni hozzá hogy ha a játékosnak eladta a tulaj a házat akkor mentse el az új tulaj nevére a házat. És akinek felajánlotta a házat annak egy parancsal elkéne fogadnia pl /megveszház vagy valami ilyesmire gondolok. És persze a játékos legyen a tulajdonos közelébe.
/sellhouse script:
if(strcmp(cmd, \"/sellhouse\", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new i = PlayerInfo[playerid][pHouseKey];
new i2 = PlayerInfo[playerid][pHouseKey2];
if(i == -1 && i2 == -1) return SendClientMessage(playerid, GREY, \" You don\'t own a house.\");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SyntaxMessage(playerid, \"/sellhouse [1/2] [confirm]\");
return 1;
}
new slot = strval(tmp);
if (slot < 1 || slot > 2) return SendClientMessage(playerid, GREY, \"Slot can\'t be below 1, or above 2.\");
if (slot == 1)
{
if (PlayerInfo[playerid][pHouseKey] == -1) return SendClientMessage(playerid, GREY, \" You don\'t own a house in this slot.\");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SyntaxMessage(playerid, \"/sellhouse [1/2] [confirm]\");
format(string, sizeof(string), \"Your house is worth $%d. Are you really sure you wanna sell it?\", HouseInfo[HousePrice] / 100 * 80);
SendClientMessage(playerid, YELLOW, string);
return 1;
}
if(strcmp(tmp,\"confirm\",true) == 0)
{
GiveMoney(playerid, HouseInfo[HousePrice] / 100 * 80);
HouseInfo[HouseOwned] = 0;
strmid(HouseInfo[HouseOwner], \"The State\", 0, strlen(\"The State\"), 255);
format(string, sizeof(string), \"Congratulations, you have successfully sold your house for $%d.\", HouseInfo[HousePrice] / 100 * 80);
SendClientMessage(playerid, YELLOW, string);
new location[MAX_ZONE_NAME];
DestroyDynamicPickup(HouseInfo[HousePickup]);
DestroyDynamic3DTextLabel(HouseInfo[HouseLabel]);
HouseInfo[HousePickup] = CreateDynamicPickup(1273, 23, HouseInfo[HouseEnterX], HouseInfo[HouseEnterY], HouseInfo[HouseEnterZ]);
Get2DZone(location, MAX_ZONE_NAME, HouseInfo[HouseEnterX], HouseInfo[HouseEnterY], HouseInfo[HouseEnterZ]);
format(string, sizeof(string), \"House Owner: {FFFFFF}The State\\n\"HOUSE_HEX\"House Location: {FFFFFF}%s\\n\"HOUSE_HEX\"House Interior: {FFFFFF}%s\\n\"HOUSE_HEX\"House Cost: {FFFFFF}$%d\", location, HouseInfo[HouseType]);
HouseInfo[HouseLabel] = CreateStreamed3DTextLabel(string, HOUSE_COLOR, HouseInfo[HouseEnterX], HouseInfo[HouseEnterY], HouseInfo[HouseEnterZ], 10.0, 0);
PlayerInfo[playerid][pHouseKey] = -1;
SaveHouses();
return 1;
}
}
if (slot == 2)
{
if (PlayerInfo[playerid][pHouseKey2] == -1) return SendClientMessage(playerid, GREY, \" You don\'t own a house in this slot.\");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SyntaxMessage(playerid, \"/sellhouse [1/2] [confirm]\");
format(string, sizeof(string), \"Your house is worth $%d. Are you really sure you wanna sell it?\", HouseInfo[i2][HousePrice] / 100 * 80);
SendClientMessage(playerid, YELLOW, string);
return 1;
}
if(strcmp(tmp,\"confirm\",true) == 0)
{
GiveMoney(playerid, HouseInfo[i2][HousePrice] / 100 * 80);
HouseInfo[i2][HouseOwned] = 0;
strmid(HouseInfo[i2][HouseOwner], \"The State\", 0, strlen(\"The State\"), 255);
format(string, sizeof(string), \"Congratulations, you have successfully sold your house for $%d.\", HouseInfo[i2][HousePrice] / 100 * 80);
SendClientMessage(playerid, YELLOW, string);
new location[MAX_ZONE_NAME];
DestroyDynamicPickup(HouseInfo[i2][HousePickup]);
DestroyDynamic3DTextLabel(HouseInfo[i2][HouseLabel]);
HouseInfo[i2][HousePickup] = CreateDynamicPickup(1273, 23, HouseInfo[i2][HouseEnterX], HouseInfo[i2][HouseEnterY], HouseInfo[i2][HouseEnterZ]);
Get2DZone(location, MAX_ZONE_NAME, HouseInfo[i2][HouseEnterX], HouseInfo[i2][HouseEnterY], HouseInfo[i2][HouseEnterZ]);
format(string, sizeof(string), \"House Owner: {FFFFFF}The State\\n\"HOUSE_HEX\"House Location: {FFFFFF}%s\\n\"HOUSE_HEX\"House Interior: {FFFFFF}%s\\n\"HOUSE_HEX\"House Cost: {FFFFFF}$%d\", location, HouseInfo[i2][HouseType]);
HouseInfo[i2][HouseLabel] = CreateStreamed3DTextLabel(string, HOUSE_COLOR, HouseInfo[i2][HouseEnterX], HouseInfo[i2][HouseEnterY], HouseInfo[i2][HouseEnterZ], 10.0, 0);
PlayerInfo[playerid][pHouseKey2] = -1;
SaveHouses();
return 1;
}
}
}
return 1;
}
Ház vásárlása :
if(strcmp(cmd, \"/buyhouse\", true) == 0)
{
new i = IsPlayerNearHouse(playerid);
if (i == -1) return SendClientMessage(playerid, GREY, \" You are not near a house that\'s for sale.\");
if(IsPlayerConnected(playerid))
{
if(IsPlayerNearHouse(playerid))
{
if(PlayerInfo[playerid][pHouseKey] != -1 && PlayerInfo[playerid][pHouseKey2] != -1) return SendClientMessage(playerid, GREY, \" You already own 2 houses.\");
if(HouseInfo[HouseOwned] == 0)
{
SetPVarInt(playerid, \"HouseToBuy\", i);
SetPVarInt(playerid, \"HousePrice\", HouseInfo[HousePrice]);
format(string, sizeof(string), \"Are you sure you would like to purchase \'%s\' for $%d?\", HouseInfo[HouseType], HouseInfo[HousePrice]);
ShowPlayerDialog(playerid, 5498, DIALOG_STYLE_MSGBOX, \"House Purchase Confirmation\", string, \"Yes\", \"No\");
return 1;
}
else
{
SendClientMessage(playerid, GREY, \"This house is already owned.\");
return 1;
}
}
}
return 1;
}
Elõre is köszönöm a segítségeteket!
Dupla hozzászólás automatikusan összefûzve. ( 2014. június 14. - 14:23:54 )
Vagy ha esetleg valaki tud egy olyan házrendszert ami jó és így van megoldva akkor azt is megköszönném!