/buybiz problem
#1

pawn Код:
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;
}
That's the command.

pawn Код:
(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

Lines with errors:
pawn Код:
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.");
I would appriciate any help, so do not hesitate to post here and help me.
Reply
#2

You must be use IsPlayerNearBizEnt in stock



_____________________
Los Aztecas = Neitheus_Olympus

Bullet Town Roleplay
Reply
#3

Quote:
Originally Posted by Lloyde
Посмотреть сообщение
You must be use IsPlayerNearBizEnt in stock



_____________________
Los Aztecas = Neitheus_Olympus

Bullet Town Roleplay
What do you mean? I didnt understand.
Reply
#4

Quote:
Originally Posted by benjaminjones
Посмотреть сообщение
What do you mean? I didnt understand.
This is my sample for buying business
pawn Код:
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;
}
Reply
#5

Show us the place where "IsPlayerNearBizEnt" is coded.
....
Reply
#6

Well, I cant find it in the script by searching for it. It's only at line 80008.
Reply
#7

What script are you using?
Reply
#8

Lock and Achieve. The problem has been solved.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)