CMD:buybiz(playerid, params[])
{
new id = IsPlayerNearBizEnt(playerid);
if(id == -1 || id == 0) return SendClientMessage(playerid, COLOR_GREY, "You are not near a biz");
if(BusinessInfo[id][bOwned] != 0 || BusinessInfo[id][bPrice] == 0) return SendClientMessage(playerid, COLOR_GREY, "This biz is not for sale.");
if(PlayerInfo[playerid][BizID] != 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You already own a biz.");
if(PlayerInfo[playerid][Money] < BusinessInfo[id][bPrice]) return SendClientMessage(playerid, COLOR_LIGHTRED, "Sorry, you can not afford this biz.");
PlayerInfo[playerid][BizID] = id;
PlayerInfo[playerid][Money] -= BusinessInfo[id][bPrice];
GivePlayerMoney(playerid, -BusinessInfo[id][bPrice]);
BusinessInfo[id][bLocked] = 0;
BusinessInfo[id][bOwned] = 1;
BusinessInfo[id][bOwner] = RemoveUnderScore(playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Congratulations on your new biz! Use /bizhelp to get help, or /ask!");
return 1;
}
(80008) : error 017: undefined symbol "IsPlayerNearBizEnt"
(80012) : error 017: undefined symbol "BusinessInfo"
(80012) : warning 215: expression has no effect
(80012) : error 001: expected token: ";", but found "]"
(80012) : error 029: invalid expression, assumed zero
(80012) : fatal error 107: too many error messages on one line
Line 80008: new id = IsPlayerNearBizEnt(playerid);
Line 80012: if(BusinessInfo[id][bOwned] != 0 || BusinessInfo[id][bPrice] == 0) return SendClientMessage(playerid, COLOR_GREY, "This biz is not for sale.");
You must be use IsPlayerNearBizEnt in stock
_____________________ Los Aztecas = Neitheus_Olympus Bullet Town Roleplay |
CMD:buybusiness(playerid, params[])
{
new string[128], done;
if(PlayerInfo[playerid][pBusiness] != INVALID_BIZ_ID) return SendClientMessage(playerid, COLOR_GRAD5, "You already own a business.");
for(new idx=1; idx<MAX_BUSINESS; idx++)
{
if(!BizInfo[idx][bType]) return SendClientMessage(playerid, COLOR_GREY, "You cannot buy business that are not ready yet");
if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]))
{
if(!strcmp("Nobody", BizInfo[idx][bOwner], false))
{
if(PlayerInfo[playerid][pLevel] < BizInfo[idx][bLevel])
{
format(string, sizeof(string), " You must be Level %d to purchase this!", BizInfo[idx][bLevel]);
SendClientMessage(playerid, COLOR_GRAD5, string);
return 1;
}
if(GetPVarInt(playerid, "BuyBizConfirm") == 0)
{
SetPVarInt(playerid, "BuyBizConfirm", 1);
SendClientMessage(playerid, COLOR_WHITE, "You're about to buy this business. The money can't be returned once you have bought this business.");
SendClientMessage(playerid, COLOR_WHITE, "If you're sure you want to buy this business, please re-type the command (/buybusiness).");
return 1;
}
DeletePVar(playerid, "BuyBizConfirm");
if(GetPlayerCash(playerid) < BizInfo[idx][bPrice]) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to buy this business.");
GivePlayerCash(playerid, -BizInfo[idx][bPrice]);
PlayerInfo[playerid][pBusiness] = idx;
BizInfo[idx][bOwned] = 1;
format(BizInfo[idx][bOwner], 128, "%s", GetPlayerNameEx(playerid));
format(string, sizeof(string), "%s\nStatus: %s\n{DDFF00}%s\nEntrance Fee: $%d\nOwner: %s\nBusiness ID: %d",BizInfo[idx][bDescription],RBS(idx),RBT(idx),BizInfo[idx][bBizFee],BizInfo[idx][bOwner], idx);
UpdateDynamic3DTextLabelText(BizInfo[idx][bText], 0xDDFF00FF, string);
SendClientMessage(playerid, COLOR_GREEN, " You have successfully bought a business.");
SendClientMessage(playerid, COLOR_WHITE, " Type /businesshelp to view your business commands.");
BizInfo[PlayerInfo[playerid][pBusiness]][bStatus] = 0;
format(string, sizeof(string), "%s has bought business id %d.", GetPlayerNameEx(playerid), idx);
idx = MAX_BUSINESS;
done = 1;
}
if(idx == MAX_BUSINESS-1 && !done)
{
SendClientMessage(playerid, COLOR_GREY, "This business is owned by someone else.");
}
}
if(idx == MAX_BUSINESS-1 && !done)
{
SendClientMessage(playerid, COLOR_GREY, "You are not near a buyable business.");
}
}
return 1;
}