04.04.2013, 12:48
I have problem here, please anyone help me? when i buy my biz, and type /vault inside the business, it said " you are no own business ". Does somethings wrong with my script below? :
pawn Код:
CMD:vault(playerid, params[])
{
new value, string[128];
new idx = PlayerInfo[playerid][pBiz];
if(PlayerInfo[playerid][pBiz] == 0 && PlayerInfo[playerid][pVBiz] == 0) 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;
}