Problem with /buyhouse | Dcmd
#1

When I do /buyhouse, it doesnt load the money and subtract it from the player. Its saved correctly before you ask. I know that for sure. But take a look if you think you can help.

Код:
dcmd_buyhouse(playerid,params[])
{
    new pName[24], PlayerFile[50],HouseFile[50],owner[24],renter[24],housetext[250];
	GetPlayerName(playerid, pName, sizeof(pName));
	format(PlayerFile, sizeof(PlayerFile), "/LVRP/users/%s.ini", pName);
	PlayerInfo[playerid][Money] = dini_Int(PlayerFile,"Money");
	new houseid = GetHouseID(playerid);
	format(HouseFile,sizeof(HouseFile),"/LVRP/houses/%d.ini",GetHouseID(playerid));
	format(owner,sizeof(owner),"%s",dini_Get(HouseFile,"Owner"));

	if(houseid == -255) return SendClientMessage(playerid,COLOR_RED,"You are not at a house!");
	if(dini_Int(PlayerFile,"House") != 0) return SendClientMessage(playerid,COLOR_RED,"You already own a house!");
	if(!strcmp(owner,"Nobody",true))
	{
	    if(dini_Int(PlayerFile,"Money") >= dini_Int(HouseFile,"HPrice"))
	    {
	        dini_Set(HouseFile,"Owner",pName);
	        dini_IntSet(PlayerFile,"House",houseid);
	        dini_IntSet(PlayerFile,"Money",dini_Int(PlayerFile,"Money")-dini_Int(HouseFile,"HPrice"));
	        Delete3DTextLabel(HouseText[houseid]);
	        format(renter,sizeof(renter),"%s",dini_Get(HouseFile,"Renter"));
	        format(housetext,sizeof(housetext),"Owner: %s || Renter: %s\nPrice: $%d || Rent: $%d\nHouseID: %d",pName,renter,HouseInfo[houseid][HPrice],HouseInfo[houseid][Rent],houseid);
	    	HouseText[houseid] = Create3DTextLabel(housetext,COLOR_LIGHTBLUE,dini_Float(HouseFile,"OutX"),dini_Float(HouseFile,"OutY"),dini_Float(HouseFile,"OutZ"),30.0,0,1);
		}
		else return SendClientMessage(playerid,COLOR_RED,"NOT ENOUGH MONEY!");
	}
    else return SendClientMessage(playerid,COLOR_RED,"THIS HOUSE IS ALREADY OWNED!");
	return 1;
	#pragma unused params
}
Reply


Messages In This Thread
Problem with /buyhouse | Dcmd - by Tyler_Idy - 02.12.2010, 13:35
Re: Problem with /buyhouse | Dcmd - by Jochemd - 02.12.2010, 14:40
Re: Problem with /buyhouse | Dcmd - by Tyler_Idy - 03.12.2010, 04:22
Re: Problem with /buyhouse | Dcmd - by Tyler_Idy - 03.12.2010, 14:31
Re: Problem with /buyhouse | Dcmd - by Ash. - 03.12.2010, 14:34
Re: Problem with /buyhouse | Dcmd - by Tyler_Idy - 04.12.2010, 15:29

Forum Jump:


Users browsing this thread: 1 Guest(s)