Business upgrade
#1

Hello everyone, the problem I'm facing right now is the following -

On my server you can own 1 business as a REGULAR player and 2 businesses as a VIP player (same with houses).

When I try to upgrade my house(s) it works perfectly, but when I buy 2 businesses and try to upgrade them, it only allows me to upgrade the first one (regular) and when I go inside the second one (VIP) it says "You are not inside your business".

Normal bizzes are "PlayerInfo[playerid][pBiz]" , VIP bizzes are "PlayerInfo[playerid][pVBiz]".

Here's the house command if you need it to compare between the biz and house upgrade commands to see whats wrong and so on.

(The difference is that Houses are being upgraded from the outside, where the pickup is, but the Bizzes are being upgraded from the inside.)

House upgrade command:

Код:
CMD:houseupgrade(playerid, params[])
{
	new string[128], idx = PlayerInfo[playerid][pHouse], price;
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!PlayerInfo[playerid][pHouse]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a house.");
	if(!PlayerInfo[playerid][pVHouse])
	{
	    if(!IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ])) return SendClientMessage(playerid, COLOR_GREY, "You are not near your house.");
	}
	else
	{
	    new done;
   	    if(!IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]))
 		{
	 		done ++;
	   	    idx = PlayerInfo[playerid][pVHouse];
	   	    if(!IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ])) done ++;
		}
		if(done == 2) return SendClientMessage(playerid, COLOR_GREY, "You are not near your house.");

	}
	if(sscanf(params, "s[8]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /houseupgrade [confirm]");
	if(HouseInfo[idx][hLevel] >= 10) return SendClientMessage(playerid, COLOR_GREY, "Your house already has the maximum level possible.");
	if(!strcmp(params, "confirm", true))
	{
	    if(!PlayerInfo[playerid][pVIP])price = 50000;
	    if(PlayerInfo[playerid][pVIP] == 1) price = 37500;
	    else if(PlayerInfo[playerid][pVIP] == 2) price = 25000;
	    else if(PlayerInfo[playerid][pVIP] == 3) price = 12500;
	    else if(PlayerInfo[playerid][pVIP] == 4) price = 0;
		if(PlayerInfo[playerid][pMoney] < price)
		{
		    format(string, sizeof(string), "You need $%d to upgrade your house.", price);
			SendClientMessage(playerid, COLOR_GREY, string);
			return 1;
		}
		HouseInfo[idx][hLevel] ++;
		GiveZaiatMoney(playerid, -price);
		format(string, sizeof(string), " You have upgraded your house to level %d.", HouseInfo[idx][hLevel]);
		SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
		format(string, sizeof(string), "ID: %d\nHouse (Lvl: %d)\nOwner: %s\nStatus: %s", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], RHS(idx));
		UpdateDynamic3DTextLabelText(HouseInfo[idx][hText], COLOR_WHITE, string);
	}
	return 1;
}
Biz upgrade command:
Код:
CMD:bizupgrade(playerid, params[])
{
	new string[128], idx = PlayerInfo[playerid][pBiz];
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!PlayerInfo[playerid][pBiz]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a business.");
    if(GetPlayerVirtualWorld(playerid)-100 != idx) return SendClientMessage(playerid, COLOR_GREY, "You are not inside your business.");
	if(sscanf(params, "s[8]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bizupgrade [confirm]");
	if(BizInfo[idx][bLevel] >= 5) return SendClientMessage(playerid, COLOR_GREY, "Your business already has the maximum level possible.");
	if(!strcmp(params, "confirm", true))
	{
	    if(strval(RPBL(playerid)) == 1 && RPBS(playerid) >= 100) {BizInfo[idx][bLevel]++; SendClientMessage(playerid, COLOR_LIGHTBLUE, " You have upgraded your business to level 2.");}
	    else if(strval(RPBL(playerid)) == 2 && RPBS(playerid) >= 300) {BizInfo[idx][bLevel]++; SendClientMessage(playerid, COLOR_LIGHTBLUE, " You have upgraded your business to level 3.");}
	    else if(strval(RPBL(playerid)) == 3 && RPBS(playerid) >= 700) {BizInfo[idx][bLevel]++; SendClientMessage(playerid, COLOR_LIGHTBLUE, " You have upgraded your business to level 4.");}
	    else if(strval(RPBL(playerid)) == 4 && RPBS(playerid) >= 1200) {BizInfo[idx][bLevel]++; SendClientMessage(playerid, COLOR_LIGHTBLUE, " You have upgraded your business to level 5.");}
	    else
		{
		    if(strval(RPBL(playerid)) == 1) format(string, sizeof(string), "Your business needs to sell %d more products to level up.", 100 -RPBS(playerid));
		    else if(strval(RPBL(playerid)) == 2) format(string, sizeof(string), "Your business needs to sell %d more products to level up.", 300 -RPBS(playerid));
		    else if(strval(RPBL(playerid)) == 3) format(string, sizeof(string), "Your business needs to sell %d more products to level up.", 700 -RPBS(playerid));
		    else if(strval(RPBL(playerid)) == 4) format(string, sizeof(string), "Your business needs to sell %d more products to level up.", 1200 -RPBS(playerid));
			SendClientMessage(playerid, COLOR_GREY, string);
		}
	}
	return 1;
}
I guess it's something easy to fix, not sure (haven't opened pawno since more than year lol), I tried several times, but unlucky...

P.S.: Thanks in advance to everyone who ATLEAST tries to help, you will be +Repped for sure, have a nice day!
Reply


Messages In This Thread
Business upgrade - by Dizzle - 30.06.2015, 15:23
Re: Business upgrade - by Suicidal.Banana - 30.06.2015, 15:51
Re: Business upgrade - by Dizzle - 30.06.2015, 16:07
Re: Business upgrade - by Suicidal.Banana - 30.06.2015, 16:18

Forum Jump:


Users browsing this thread: 1 Guest(s)