Buying a House Issue
#1

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:

PHP код:
AddHouse(944,-2621.6487,790.8647,48.5785302.180999,300.722991,999.148437160000140); 
This is how the code is set out:

PHP код:
AddHouse(houseidFloat:iconXFloat:iconYFloat:iconZFloat:interiorXFloat:interiorYFloat:interiorZCostaSellaInterioravirtualworld
Here's the buy command:

PHP код:
dcmd_buy(playerid,params[])
{
    
#pragma unused params
    
new str[255],str1[255],pname[24], housenumber;
    
housenumber GetHouseID(playerid);
    if(
housenumber == -1) return SendClientMessage(playeridc_r"You are not in a house icon!");
    
GetPlayerName(playeridpname24);
    
format(str1sizeof(str1), "Houses/Users/%s"udb_encode(pname));
    if(
dini_Exists(str1))
    {
        if (
dini_Int(str1"Houseid")!=-255) return SendClientMessage(playeridc_r"You can only buy one house!");
    }
    
format(str1sizeof(str1), "Houses/houseid%d"housenumber);
    if (
strcmp(hInfo[housenumber][Name],"ForSale",true)) return SendClientMessage(playeridc_r"This house isn't for sale!");
    if(
GetPlayerScore(playerid)<hInfo[housenumber][Cost]) return SendClientMessage(playeridc_r"{FFF1AF}Your{00C0FF}level{FFAF00}isn't high enough!");
    
SendClientMessage(playeridc_y"You have bought the house!");
    
format(strsizeof(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(str1sizeof(str1), "Houses/Users/%s"udb_encode(pname));
    if (!
dini_Exists(str1)) dini_Create(str1);
    new 
Float:syFloat:sxFloat:sz;
    
dini_IntSet(str1"Houseid"housenumber);
    if(!
dini_Isset(str1,"Rentid"))
    {
        
dini_IntSet(str1"Rentid", -255);
    }
    
GetPlayerPos(playeridsx,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(127223hInfo[housenumber][iconx], hInfo[housenumber][icony], hInfo[housenumber][iconz]);
    return 
1;

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.
Reply
#2

try using this:

(Just to test)
PHP код:
AddHouse(944,-2621.6487,790.8647,48.5785302.180999,300.722991,999.1484371611111140); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)