CMD:buy(playerid, params[])
{
? ?static
? ? ? ?id = -1;
? ?if ((id = House_Nearest(playerid)) != -1)
? ?{
? ? ? ?if (House_GetCount(playerid) >= MAX_OWNABLE_HOUSES)
? ? ? ? ? ?return SendErrorMessage(playerid, "You can only own %d houses at a time.", MAX_OWNABLE_HOUSES);
? ? ? ?if (HouseData != 0)
? ? ? ? ? ?return SendErrorMessage(playerid, "This house is already owned at the moment.");
? ? ? ?if (HouseData > GetMoney(playerid))
? ? ? ? ? ?return SendErrorMessage(playerid, "You have insufficient funds for the purchase.");
? ? ? ?HouseData = GetPlayerSQLID(playerid);
? ? ? ?House_Refresh(id);
? ? ? ?House_Save(id);
? ? ? ?GiveMoney(playerid, -HouseData);
? ? ? ?SendServerMessage(playerid, "You have purchased \"%s\" for %s!", HouseData, FormatNumber(HouseData));
? ? ? ?ShowPlayerFooter(playerid, "You have ~g~purchased~w~ a house!");
? ? ? ?Log_Write("logs/house_log.txt", " %s has purchased house ID: %d for %s.", ReturnDate(), ReturnName(playerid), id, FormatNumber(HouseData));
? ?}
? ?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 != 0)
? ? ? ? ? ?return SendErrorMessage(playerid, "This business is already owned at the moment.");
? ? ? ?if (BusinessData > GetMoney(playerid))
? ? ? ? ? ?return SendErrorMessage(playerid, "You have insufficient funds for the purchase.");
? ? ? ?BusinessData = GetPlayerSQLID(playerid);
? ? ? ?Business_Refresh(id);
? ? ? ?Business_Save(id);
? ? ? ?GiveMoney(playerid, -BusinessData);
? ? ? ?SendServerMessage(playerid, "You have purchased \"%s\" for %s!", BusinessData, FormatNumber(BusinessData));
? ? ? ?ShowPlayerFooter(playerid, "You have ~g~purchased~w~ a business!");
? ? ? ?Log_Write("logs/biz_log.txt", " %s has purchased business ID: %d for %s.", ReturnDate(), ReturnName(playerid), id, FormatNumber(BusinessData));
? ?}
? ?else if ((id = Business_Inside(playerid)) != -1)
? ?{
? ? ? ?if (BusinessData != 0 || !BusinessData)
? ? ? ? ? ?return SendErrorMessage(playerid, "This business is closed!");
? ? ? ?if (BusinessData == 5) {
? ? ? ? ? ?Business_CarMenu(playerid, id);
? ? ? ?} else {
? ? ? ? ? ?Business_PurchaseMenu(playerid, id);
? ? ? ?}
? ?}
? ?return 1;
}
Business_ProductMenu(playerid, bizid)
{
? ?if (bizid == -1 || !BusinessData)
? ? ? ?return 0;
? ?static
? ? ? ?string;
? ?switch (BusinessData)
? ?{
? ? ? ?case 1, 6:
? ? ? ?{
? ? ? ? ? ?format(string, sizeof(string), "Mobile Phone - %s\nGPS System - %s\nSpray Paint - %s\nBackpack - %s\nWater Bottle - %s\nSoda Bottle - %s\nLottery Ticket - %s\nPortable Radio - %s\nCan of Fuel - %s\nCrowbar - %s\nBoombox - %s\nMask - %s\nFirst Aid Kit - %s\nRepair Kit - %s\nNOS Canister - %s\nBaseball Bat - %s\nFrozen Pizza - %s\nFrozen Burger - %s",
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData)
? ? ? ? ? ?);
? ? ? ? ? ?Dialog_Show(playerid, EditProduct, DIALOG_STYLE_LIST, "Business: Modify Item", string, "Modify", "Cancel");
? ? ? ?}
? ? ? ?case 2:
? ? ? ?{
? ? ? ? ? ?format(string, sizeof(string), "Magazine - %s\nAmmo Cartridge - %s\nArmored Vest - %s\nDesert Eagle - %s\nRemington 870 - %s\nM14 Rifle - %s",
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData)
? ? ? ? ? ?);
? ? ? ? ? ?Dialog_Show(playerid, EditProduct, DIALOG_STYLE_LIST, "Business: Modify Item", string, "Modify", "Cancel");
? ? ? ?}
? ? ? ?case 3:
? ? ? ?{
? ? ? ? ? ?format(string, sizeof(string), "Clothes - %s\nGlasses - %s\nHats - %s\nBandana - %s",
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData)
? ? ? ? ? ?);
? ? ? ? ? ?Dialog_Show(playerid, EditProduct, DIALOG_STYLE_LIST, "Business: Modify Item", string, "Modify", "Cancel");
? ? ? ?}
? ? ? ?case 4:
? ? ? ?{
? ? ? ? ? ?format(string, sizeof(string), "Water - %s\nSoda - %s\nFrench Fries - %s\nCheeseburger - %s\nChicken Burger - %s\nChicken Nuggets - %s\nSalad - %s",
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData)
? ? ? ? ? ?);
? ? ? ? ? ?Dialog_Show(playerid, EditProduct, DIALOG_STYLE_LIST, "Business: Modify Item", string, "Modify", "Cancel");
? ? ? ?}
? ? ? ?case 7:
? ? ? ?{
? ? ? ? ? ?string = 0;
? ? ? ? ? ?for (new i = 0; i < sizeof(g_aFurnitureTypes); i ) {
? ? ? ? ? ? ? ?format(string, sizeof(string), "%s%s - %s\n", string, g_aFurnitureTypes, FormatNumber(BusinessData));
? ? ? ? ? ?}
? ? ? ? ? ?Dialog_Show(playerid, EditProduct, DIALOG_STYLE_LIST, "Business: Modify Item", string, "Modify", "Cancel");
? ? ? ?}
? ?}
? ?return 1;
}
Business_PurchaseMenu(playerid, bizid)
{
? ?if (bizid == -1 || !BusinessData)
? ? ? ?return 0;
? ?static
? ? ? ?string;
? ?switch (BusinessData)
? ?{
? ? ? ?case 1, 6:
? ? ? ?{
? ? ? ? ? ?format(string, sizeof(string), "Mobile Phone - %s\nGPS System - %s\nSpray Paint - %s\nBackpack - %s\nWater Bottle - %s\nSoda Bottle - %s\nLottery Ticket - %s\nPortable Radio - %s\nCan of Fuel - %s\nCrowbar - %s\nBoombox - %s\nMask - %s\nFirst Aid Kit - %s\nRepair Kit - %s\nNOS Canister - %s\nBaseball Bat - %s\nFrozen Pizza - %s\nFrozen Burger - %s",
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData)
? ? ? ? ? ?);
? ? ? ? ? ?Dialog_Show(playerid, BusinessBuy, DIALOG_STYLE_LIST, BusinessData, string, "Purchase", "Cancel");
? ? ? ?}
? ? ? ?case 2:
? ? ? ?{
? ? ? ? ? ?format(string, sizeof(string), "Magazine - %s\nAmmo Cartridge - %s\nArmored Vest - %s\nDesert Eagle - %s\nRemington 870 - %s\nM14 Rifle - %s",
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData)
? ? ? ? ? ?);
? ? ? ? ? ?Dialog_Show(playerid, BusinessBuy, DIALOG_STYLE_LIST, BusinessData, string, "Purchase", "Cancel");
? ? ? ?}
? ? ? ?case 3:
? ? ? ?{
? ? ? ? ? ?format(string, sizeof(string), "Clothes - %s\nGlasses - %s\nHats - %s\nBandana - %s",
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData)
? ? ? ? ? ?);
? ? ? ? ? ?Dialog_Show(playerid, BusinessBuy, DIALOG_STYLE_LIST, BusinessData, string, "Purchase", "Cancel");
? ? ? ?}
? ? ? ?case 4:
? ? ? ?{
? ? ? ? ? ?format(string, sizeof(string), "Water - %s\nSoda - %s\nFrench Fries - %s\nCheeseburger - %s\nChicken Burger - %s\nChicken Nuggets - %s\nSalad - %s",
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData),
? ? ? ? ? ? ? ?FormatNumber(BusinessData)
? ? ? ? ? ?);
? ? ? ? ? ?Dialog_Show(playerid, BusinessBuy, DIALOG_STYLE_LIST, BusinessData, string, "Purchase", "Cancel");
? ? ? ?}
? ? ? ?case 7:
? ? ? ?{
? ? ? ? ? ?string = 0;
? ? ? ? ? ?for (new i = 0; i < sizeof(g_aFurnitureTypes); i ) {
? ? ? ? ? ? ? ?format(string, sizeof(string), "%s%s - %s\n", string, g_aFurnitureTypes, FormatNumber(BusinessData));
? ? ? ? ? ?}
? ? ? ? ? ?Dialog_Show(playerid, BusinessBuy, DIALOG_STYLE_LIST, BusinessData, string, "Purchase", "Cancel");
? ? ? ?}
? ?}
? ?return 1;
} ?