Buyhouse+buybiz bug
#2

Try that.
Код:
CMD:buyhouse(playerid, params[])
{
 new string[128], done;
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pHouse] && PlayerInfo[playerid][pVHouse] && PlayerInfo[playerid][pVIP] >= 3) return SendClientMessage(playerid, COLOR_GREY, "You already own two houses.");
 if(PlayerInfo[playerid][pHouse] && PlayerInfo[playerid][pVIP] < 3) return SendClientMessage(playerid, COLOR_GREY, "You already own a house.");
 for(new idx=1; idx<MAX_HOUSES; idx++)
 {
     if(IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]))
     {
   if(!strcmp("Infinity Roleplay", HouseInfo[idx][hOwner], false))
   {
       if(PlayerInfo[playerid][pMoney] < HouseInfo[idx][hPrice]) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to buy this house.");
    GiveDodMoney(playerid, -HouseInfo[idx][hPrice]);
    if(PlayerInfo[playerid][pHouse]) PlayerInfo[playerid][pVHouse] = idx;
    else PlayerInfo[playerid][pHouse] = idx;
       format(HouseInfo[idx][hOwner], 32, "%s", RPNU(playerid));
       format(string, sizeof(string), "{00C0FF}House of %s\nHouse Type: %s\nStatus: %s", HouseInfo[idx][hOwner], HT(idx), RHS(idx));
    UpdateDynamic3DTextLabelText(HouseInfo[idx][hText], COLOR_WHITE, string);
    SendClientMessage(playerid, COLOR_GREEN, " You have successfully bought a house.");
    SendClientMessage(playerid, COLOR_WHITE, " Type /househelp to view your house commands.");
    format(string, sizeof(string), "%s has bought house id %d.", RPN(playerid), idx);
    Log("logs/house.log", string);
    idx = MAX_HOUSES;
    done = 1;
   }
   if(idx == MAX_HOUSES-1 && !done)
   {
       SendClientMessage(playerid, COLOR_GREY, "This house is owned by someone else.");
   }
     }
     if(idx == MAX_HOUSES && !done)
     {
         SendClientMessage(playerid, COLOR_GREY, "You are not near a buyable house.");
     }
 }
 return 1;
}
Код:
CMD:buybiz(playerid, params[])
{
	new string[128], done;
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
   	if(PlayerInfo[playerid][pBiz] && PlayerInfo[playerid][pVBiz] && PlayerInfo[playerid][pVIP] >= 4) return SendClientMessage(playerid, COLOR_GREY, "You already own two businesses.");
	if(PlayerInfo[playerid][pBiz] && PlayerInfo[playerid][pVIP] < 4) return SendClientMessage(playerid, COLOR_GREY, "You already own a business.");
	for(new idx=1; idx<MAX_BIZ; idx++)
	{
	    if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]))
	    {
			if(!strcmp("Infinity Roleplay", BizInfo[idx][bOwner], false))
			{
			    if(PlayerInfo[playerid][pMoney] < BizInfo[idx][bPrice]) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to buy this business.");
				GiveDodMoney(playerid, -BizInfo[idx][bPrice]);
				if(PlayerInfo[playerid][pBiz]) PlayerInfo[playerid][pVBiz] = idx;
				else PlayerInfo[playerid][pBiz] = idx;
			    format(BizInfo[idx][bOwner], 32, "%s", RPNU(playerid));
			    format(string, sizeof(string), "Business of %s\nBusiness type: %s\n%s", BizInfo[idx][bOwner], RBT(idx), RBS(idx));
				UpdateDynamic3DTextLabelText(BizInfo[idx][bText], COLOR_WHITE, string);
				SendClientMessage(playerid, COLOR_GREEN, " You have successfully bought a business.");
				SendClientMessage(playerid, COLOR_WHITE, " Type /bizhelp to view your business commands.");
				format(string, sizeof(string), "%s has bought business id %d.", RPN(playerid), idx);
				Log("logs/business.log", string);
				idx = MAX_BIZ;
				done = 1;
			}
			if(idx == MAX_BIZ-1 && !done)
			{
			    SendClientMessage(playerid, COLOR_GREY, "This business is owned by someone else.");
			}
	    }
	    if(idx == MAX_BIZ && !done)
	    {
	        SendClientMessage(playerid, COLOR_GREY, "You are not near a buyable business.");
	    }
	}
	return 1;
}
Reply


Messages In This Thread
Buyhouse+buybiz bug - by Gazzy - 13.10.2013, 14:42
Re: Buyhouse+buybiz bug - by Spliffy - 13.10.2013, 15:52
Re: Buyhouse+buybiz bug - by Gazzy - 14.10.2013, 14:34
Re: Buyhouse+buybiz bug - by Gazzy - 14.10.2013, 14:42
Re: Buyhouse+buybiz bug - by Spliffy - 14.10.2013, 22:35
Re: Buyhouse+buybiz bug - by Gazzy - 15.10.2013, 15:34
Re: Buyhouse+buybiz bug - by DouglasRamirez - 15.10.2013, 15:59
Re: Buyhouse+buybiz bug - by Gazzy - 15.10.2013, 17:01

Forum Jump:


Users browsing this thread: 3 Guest(s)