22.09.2013, 07:27
I have problem with my business here
- When i /buybiz which first business (1st biz i buy mean Biz1 [Owner] biz2 [un-owned]), it's working properly and none bugged. But when i buy the secondly business, it's going bug and i cannot even /mybiz.
- When i'm at my BIZ1 and when i type /mybiz, it's working properly and none bugged. But when i'm at my BIZ2, and use /mybiz it's say, you are not near your business.
Please help me..
Here is my /mybiz code
This one is my /buybiz command
- When i /buybiz which first business (1st biz i buy mean Biz1 [Owner] biz2 [un-owned]), it's working properly and none bugged. But when i buy the secondly business, it's going bug and i cannot even /mybiz.
- When i'm at my BIZ1 and when i type /mybiz, it's working properly and none bugged. But when i'm at my BIZ2, and use /mybiz it's say, you are not near your business.
Please help me..
Here is my /mybiz code
pawn Код:
CMD:mybiz(playerid, params[])
{
for(new d = 0 ; d < MAX_BIZ; d++)
{
new idx = PlayerInfo[playerid][pVBiz];
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!PlayerInfo[playerid][pBiz] && !PlayerInfo[playerid][pVBiz]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a busines.");
SetPVarInt(playerid, "mybiz", d);
if(!IsPlayerInRangeOfPoint(playerid, 1, BizInfo[PlayerInfo[playerid][pBiz]][bX], BizInfo[PlayerInfo[playerid][pBiz]][bY], BizInfo[PlayerInfo[playerid][pBiz]][bZ]) || IsPlayerInRangeOfPoint(playerid, 2, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]))
{
SendClientMessageEx(playerid, COLOR_GRAD2, " You are not near your business!");
return 1;
}
if(IsPlayerInRangeOfPoint(playerid, 1, BizInfo[PlayerInfo[playerid][pBiz]][bX], BizInfo[PlayerInfo[playerid][pBiz]][bY], BizInfo[PlayerInfo[playerid][pBiz]][bZ]) || IsPlayerInRangeOfPoint(playerid, 2, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]))
{
ShowPlayerDialog(playerid,DIALOG_BIZMENU,DIALOG_STYLE_LIST,"BUSINESS ACCOUNT", "Balance\nWithdraw","Select","Cancel");
return 1;
}
}
return 1;
}
pawn Код:
CMD:buybiz(playerid, params[])
{
new string[128], done;
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pBiz] && PlayerInfo[playerid][pVBiz] && PlayerInfo[playerid][pDonateRank] >= 4) return SendClientMessage(playerid, COLOR_GREY, "You already own two businesses.");
if(PlayerInfo[playerid][pBiz] && PlayerInfo[playerid][pAdmin] < 2) 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("The State", BizInfo[idx][bOwner], false))
{
if(GetPVarInt(playerid, "Cash") < BizInfo[idx][bPrice]) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to buy this business.");
SetPVarInt(playerid, "Cash", GetPVarInt(playerid, "Cash") -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), "%s\n\n{FFFFFF}%s\nOwner: %s\nID: %d", RBS(idx), RBT(idx), BizInfo[idx][bOwner], idx);
UpdateDynamic3DTextLabelText(BizInfo[idx][bText], COLOR_WHITE, string);
SendClientMessage(playerid, COLOR_GREEN, " ========================================================[BUSINESS]========================================================");
SendClientMessage(playerid, COLOR_YELLOW, " {00FF00}[{FFFFFF} Corgratulation, you have successfully bought a business {00FF00}]{FFFFFF}");
SendClientMessage(playerid, COLOR_YELLOW, " {00FF00}[{FFFFFF} /lockbiz - Unlock/Lock your business {00FF00}]{FFFFFF}");
SendClientMessage(playerid, COLOR_YELLOW, " {00FF00}[{FFFFFF} /mybiz - to look your business balance and withdraw money from your biz {00FF00}]{FFFFFF}");
SendClientMessage(playerid, COLOR_YELLOW, " {00FF00}[{FFFFFF} Please type /help for more information {00FF00}]{FFFFFF}");
SendClientMessage(playerid, COLOR_RED, " WARNING: PLEASE TAKE SCREENSHOT OF YOUR BUSINESS");
SendClientMessage(playerid, COLOR_GREEN, " ==========================================================================================================================");
format(string, sizeof(string), "%s has bought business id %d.", RPN(playerid), idx);
Log("logs/business.log", string);
idx = MAX_BIZ;
done = 1;
SaveBiz();
}
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;
}