10.10.2012, 12:16
I went to go buy a house on my server but it somehow comes up with this:
It says it costs $16 when in the code, it's clearly worth more, here's an example:
This is how the code is set out:
Here's the buy command:
I would also like to know how I can change the distance of when the text becomes visible and the level to purchase a house.
It says it costs $16 when in the code, it's clearly worth more, here's an example:
PHP код:
AddHouse(944,-2621.6487,790.8647,48.5785, 302.180999,300.722991,999.148437, 160000, 1, 4, 0);
PHP код:
AddHouse(houseid, Float:iconX, Float:iconY, Float:iconZ, Float:interiorX, Float:interiorY, Float:interiorZ, Costa, Sella, Interiora, virtualworld)
PHP код:
dcmd_buy(playerid,params[])
{
#pragma unused params
new str[255],str1[255],pname[24], housenumber;
housenumber = GetHouseID(playerid);
if(housenumber == -1) return SendClientMessage(playerid, c_r, "You are not in a house icon!");
GetPlayerName(playerid, pname, 24);
format(str1, sizeof(str1), "Houses/Users/%s", udb_encode(pname));
if(dini_Exists(str1))
{
if (dini_Int(str1, "Houseid")!=-255) return SendClientMessage(playerid, c_r, "You can only buy one house!");
}
format(str1, sizeof(str1), "Houses/houseid%d", housenumber);
if (strcmp(hInfo[housenumber][Name],"ForSale",true)) return SendClientMessage(playerid, c_r, "This house isn't for sale!");
if(GetPlayerScore(playerid)<hInfo[housenumber][Cost]) return SendClientMessage(playerid, c_r, "{FFF1AF}Your{00C0FF}level{FFAF00}isn't high enough!");
SendClientMessage(playerid, c_y, "You have bought the house!");
format(str, sizeof(str), "%s has bought houseid 0",pname);
print(str);
SetPlayerScore(playerid,GetPlayerScore(playerid)-hInfo[housenumber][Cost]);
dini_Set(str1, "Name", pname);
hInfo[housenumber][Name]=pname;
hInfo[housenumber][Locked] = dini_IntSet(str1,"Locked",0);
format(str1, sizeof(str1), "Houses/Users/%s", udb_encode(pname));
if (!dini_Exists(str1)) dini_Create(str1);
new Float:sy, Float:sx, Float:sz;
dini_IntSet(str1, "Houseid", housenumber);
if(!dini_Isset(str1,"Rentid"))
{
dini_IntSet(str1, "Rentid", -255);
}
GetPlayerPos(playerid, sx,sy,sz);
dini_FloatSet(str1, "SpawnX", sx);
dini_FloatSet(str1, "SpawnY", sy);
dini_FloatSet(str1, "SpawnZ", sz);
dini_IntSet(str1, "SpawnInt", GetPlayerInterior(playerid));
DestroyPickup(HousePickup[housenumber]);
HousePickup[housenumber] = CreatePickup(1272, 23, hInfo[housenumber][iconx], hInfo[housenumber][icony], hInfo[housenumber][iconz]);
return 1;
}