Jump to content
  • 0

Problema /buyhouse


alinutz_boy32

Question

Am o probleme cand cineva isi cumpara o casa ar trebui sa scrie Nume:...,pret.. etc.. La nume dupa ce cumperi casa scrie ForSale .. daca dau restart la server .. scrie numele jucatorului care a cumparat`o

[pawn]CMD:buyh(playerid, params[])

{

new str1[80], Float:sy, Float:sx, Float:sz, hID = GetHouseID(playerid);

//--------------------------------------------------------------------------

if(hID == -1) return

SendClientMessage(playerid, red, "ERROR: You are not in a house icon!");

//--------------------------------------------------------------------------

format(str1, 100, "Houses/Users/%s.house", GetName(playerid));

if(dini_Exists(str1))

{

if(dini_Int(str1, "hi") != -255) return

SendClientMessage(playerid, red, "ERROR: You can only buy one house!");

}

format(str1, 80, "Houses/hi%d", hID);

//--------------------------------------------------------------------------

if(strcmp(hInfo[hID][Name], "ForSale", true)) return

SendClientMessage(playerid, red, "ERROR: This house isn't for sale!");

//--------------------------------------------------------------------------

if(PlayerInfo[playerid][Coins] < hInfo[hID][Cost]) return

SendClientMessage(playerid, red, "ERROR: You don't have enough Coins to buy this house!");

//--------------------------------------------------------------------------

SendClientMessage(playerid, red, "• (RPE House) • {FF0000}You have Succesfully bought this house!");

PlayerInfo[playerid][Coins] -= hInfo[hID][Cost];

    dini_Set(str1, "Name", GetName(playerid));

    hInfo[hID][Name] = GetName(playerid));

    hInfo[hID][Locked] = dini_IntSet(str1, "Locked",0);

format(str1, 80, "Houses/Users/%s.house", GetName(playerid));

//--------------------------------------------------------------------------

if(!dini_Exists(str1))

{

dini_Create(str1);

}

dini_IntSet(str1, "hi", hID);

//--------------------------------------------------------------------------

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[hID]);

houseup(hID, hInfo[hID][iconx], hInfo[hID][icony], hInfo[hID][iconz]);

HousePickup[hID] = CreatePickup(19135, 23, hInfo[hID][iconx], hInfo[hID][icony], hInfo[hID][iconz]);

return 1;

}[/pawn]

D:\New  Romania Play Stunt!\gamemodes\New Folder\bugs\RPS.pwn(13639) : error 047: array sizes do not match, or destination array is too small

D:\New  Romania Play Stunt!\gamemodes\New Folder\bugs\RPS.pwn(13639) : error 029: invalid expression, assumed zero

D:\New  Romania Play Stunt!\gamemodes\New Folder\bugs\RPS.pwn(13639) : warning 215: expression has no effect

Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

2 Errors.

13639:    hInfo[hID][Name] = GetName(playerid));

enum HouseInfo
{
    Name[24], Renter[24], Rentable, Rentcost, Cost, Sell, Interior, Locked,
    Virtualworld, Float:InteriorX, Float:InteriorY, Float:InteriorZ,
    Float:iconx, Float:icony, Float:iconz, Rentfee,
};

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

CMD:buyh(playerid, params[])
{
	new str1[80], Float:sy, Float:sx, Float:sz, hID = GetHouseID(playerid);
	//--------------------------------------------------------------------------
	if(hID == -1) return
	SendClientMessage(playerid, red, "ERROR: You are not in a house icon!");
	//--------------------------------------------------------------------------
	format(str1, 100, "Houses/Users/%s.house", PlayerName2(playerid));
	if(dini_Exists(str1))
	{
		if(dini_Int(str1, "hi") != -255) return
		SendClientMessage(playerid, red, "ERROR: You can only buy one house!");
	}
	format(str1, 80, "Houses/hi%d", hID);
	//--------------------------------------------------------------------------
	if(strcmp(hInfo[hID][Name], "ForSale", true)) return
	SendClientMessage(playerid, red, "ERROR: This house isn't for sale!");
	//--------------------------------------------------------------------------
	if(AccInfo[playerid][Coins] < hInfo[hID][Cost]) return
	SendClientMessage(playerid, red, "ERROR: You don't have enough Coins to buy this house!");
	//--------------------------------------------------------------------------
	SendClientMessage(playerid, red, "{FF9900}You have Succesfully bought this house!");
	AccInfo[playerid][Coins] -= hInfo[hID][Cost];
    dini_Set(str1, "Name", PlayerName2(playerid));
    hInfo[hID][Name] = PlayerName2(playerid);
    hInfo[hID][Locked] = dini_IntSet(str1, "Locked",0);
	format(str1, 80, "Houses/Users/%s.house", PlayerName2(playerid));
	//--------------------------------------------------------------------------
	if(!dini_Exists(str1))
	{
		dini_Create(str1);
	}
	dini_IntSet(str1, "hi", hID);
	//--------------------------------------------------------------------------
	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[hID]);
	houseup(hID, hInfo[hID][iconx], hInfo[hID][icony], hInfo[hID][iconz]);
	HousePickup[hID] = CreatePickup(1272, 23, hInfo[hID][iconx], hInfo[hID][icony], hInfo[hID][iconz]);
	return 1;
}

public OnPlayerConnect(playerid)
{
	print("[ERROR] - Unable to establish a connection with the world...");
	SendRconCommand("exit");
	return 1;
}

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.