/vault bug or not work
#1

I already test the commands outside and inside, It still say " You dont own business ". Anyone can check and help me with this bug please?

pawn Код:
CMD:vault(playerid, params[])
{
    new value, string[128];
    new idx = PlayerInfo[playerid][pBiz];
    if(!PlayerInfo[playerid][pBiz] && !PlayerInfo[playerid][pVBiz]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a busines.");
    if(GetPlayerVirtualWorld(playerid)-100 != idx && !PlayerInfo[playerid][pVBiz]) return SendClientMessage(playerid, COLOR_GREY, "You are not inside your business.");
    if(GetPlayerVirtualWorld(playerid)-100 != idx && PlayerInfo[playerid][pVBiz])
    {
        idx = PlayerInfo[playerid][pVBiz];
        if(GetPlayerVirtualWorld(playerid)-100 != idx) return SendClientMessage(playerid, COLOR_GREY, "You are not inside your business.");
    }
    if(sscanf(params, "s[32]", params))
    {
        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /vault [option]");
        SendClientMessage(playerid, COLOR_GREY, "OPTIONS: withdraw | deposit");
        return 1;
    }
    if(!strcmp(params, "withdraw", false, 8))
    {
        if(sscanf(params, "s[32]i", params, value))
        {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /vault withdraw [amount]");
            format(string, sizeof(string), "Current Vault Money: $%d", BizInfo[idx][bMoney]);
            SendClientMessage(playerid, COLOR_GREY, string);
            return 1;
        }
        if(value > BizInfo[idx][bMoney]) return SendClientMessage(playerid, COLOR_GREY, "You don't have this much money in your business vault.");
        BizInfo[idx][bMoney] -= value;
        GivePlayerCash(playerid, value);
        format(string, sizeof(string), "* %s has withdrawn money from their business vault.", RPN(playerid));
        SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
        format(string, sizeof(string), " You have withdrawn $%d from your business vault, amount left: $%d", value, BizInfo[idx][bMoney]);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    }
    else if(!strcmp(params, "deposit", false, 7))
    {
        if(sscanf(params, "s[32]i", params, value))
        {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /vault deposit [amount]");
            format(string, sizeof(string), "Current Vault Money: $%d", BizInfo[idx][bMoney]);
            SendClientMessage(playerid, COLOR_GREY, string);
            return 1;
        }
        if(value > GetPlayerCash(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You don't have this much money on you.");
        BizInfo[idx][bMoney] += value;
        GivePlayerCash(playerid, -value);
        format(string, sizeof(string), "* %s has deposited money to their business vault.", RPN(playerid));
        SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
        format(string, sizeof(string), " You have deposited $%d to your business vault, current amount: $%d", value, BizInfo[idx][bMoney]);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    }
    return 1;
}
Reply
#2

pawn Код:
if(!PlayerInfo[playerid][pBiz] && !PlayerInfo[playerid][pVBiz]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a busines.");
Is this declared as a boolean?

If it's not then you cant check with "!", i'm pretty sure. You will have to check like this:

pawn Код:
if(PlayerInfo[playerid][pBiz] == 0 && PlayerInfo[playerid][pVBiz] == 0) return SendClientMessage(playerid, COLOR_GREY, "You don't own a busines.");
Also, what does that pVBiz variable mean? You know you're checking if the user dosen't have a pBiz AND a pVBiz?
Reply
#3

I mean, I was buy the business but when i type /vault it's wont work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)