30.09.2015, 17:33
Here is the thing, when I buy first business key is set to my account normally but I have little problems with second and third business keys.
This code doesn't set keys to second and third businesses
I will show you /buybusiness command
Thank you very much ...
Код:
if (PlayerData[playerid][pBusinessKey][0] == 0) return PlayerData[playerid][pBusinessKey][0] = id; if (PlayerData[playerid][pBusinessKey][1] == 0) return PlayerData[playerid][pBusinessKey][1] = id; if (PlayerData[playerid][pBusinessKey][2] == 0) return PlayerData[playerid][pBusinessKey][2] = id;
I will show you /buybusiness command
Код:
else if ((id = Business_Nearest(playerid)) != -1) { if (Business_GetCount(playerid) >= MAX_OWNABLE_BUSINESSES) return SendErrorMessage(playerid, "You can only own %d businesses at a time.", MAX_OWNABLE_BUSINESSES); if (BusinessData[id][bizOwner] != 0) return SendErrorMessage(playerid, "This business is already owned at the moment."); if (BusinessData[id][bizPrice] > GetMoney(playerid)) return SendErrorMessage(playerid, "You have insufficient funds for the purchase."); BusinessData[id][bizOwner] = GetPlayerSQLID(playerid); Business_Refresh(id); Business_Save(id); GiveMoney(playerid, -BusinessData[id][bizPrice]); SendServerMessage(playerid, "You have purchased \"%s\" for %s!", BusinessData[id][bizName], FormatNumber(BusinessData[id][bizPrice])); ShowPlayerFooter(playerid, "You have ~g~purchased~w~ a business!"); Log_Write("logs/biz_log.txt", "[%s] %s has purchased business ID: %d for %s.", ReturnDate(), ReturnName(playerid), id, FormatNumber(BusinessData[id][bizPrice])); if (PlayerData[playerid][pBusinessKey][0] == 0) return PlayerData[playerid][pBusinessKey][0] = id; if (PlayerData[playerid][pBusinessKey][1] == 0) return PlayerData[playerid][pBusinessKey][1] = id; if (PlayerData[playerid][pBusinessKey][2] == 0) return PlayerData[playerid][pBusinessKey][2] = id; }