/buybiz bugged
#1

Hey when just create biz the cost is 999999 and I change to 250k$ and success , But I cant still to buy but I have the cash on me even more , Thats says : " You don't have enough money to buy this business. "

Код:
CMD:buybiz(playerid, params[])
{
	new string[128], done;
   	if(PlayerInfo[playerid][pBiz] && PlayerInfo[playerid][pVBiz]) return SendClientMessage(playerid, COLOR_GREY, "You already own two businesses.");
	for(new idx=1; idx<MAX_BIZ; idx++)
	{
	    if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]))
	    {
			if(!strcmp("The State", BizInfo[idx][bOwner], false))
			{
			    if(PlayerInfo[playerid][pCash] < BizInfo[idx][bPrice]) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to buy this business.");
				GivePlayerCash(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), "ID: %d\nBusiness of %s\nBusiness type: %s\n%s", idx,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-1 && !done)
	    {
	        SendClientMessage(playerid, COLOR_GREY, "You are not near a buyable business.");
	    }
	}
	return 1;
}
Reply
#2

pawn Код:
new PlayerCash = PlayerInfo[playerid][pCash];
if(PlayerCash < BizInfo[idx][bPrice]) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to buy this business.");

or

if(PlayerInfo[playerid][pCash] > BizInfo[idx][bPrice]) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to buy this business.");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)