SA-MP Forums Archive
Business system help [Help] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Business system help [Help] (/showthread.php?tid=535040)



Business system help [Help] - Kaylen - 01.09.2014

Hello I have this filterscript its works Good but when i create business like "ammunation" i entered it and typed /buy
it says your not in 24-7 Can some one help me ?
pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#include <ZCMD>
#include <dini>
#include <dudb>
#include <dutils>
#include <YSI\y_ini>
#include <streamer>
#include <sscanf2>
#include <foreach>
#pragma unused ret_memcpy
#pragma tabsize 0
#define FILTERSCRIPT
// Color Defines
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_FADE1 0xE6E6E6E6
#define COLOR_PM1 0xA65FC7FF
#define COLOR_PM2 0xD35FC7FF
#define COLOR_FADE2 0xC8C8C8C8
#define COLOR_FADE3 0xAAAAAAAA
#define COLOR_FADE4 0x8C8C8C8C
#define COLOR_FADE5 0x6E6E6E6E
#define COLOR_OOC 0xE0FFFFFF
#define COLOR_GREY 0xAFAFAFFF
#define COLOR_LIGHTGREEN 0xADFF2FFF
#define COLOR_LIGHTRED 0xFF6347FF
#define COLOR_DARKRED 0xAA3333FF
#define COLOR_RED 0xFF0606FF
#define COLOR_LIGHTBLUE 0x33CCFFFF
#define COLOR_GREEN 0x33AA33FF
#define COLOR_YELLOW 0xFFFF00FF
#define COLOR_PURPLE 0xC2A2DAFF
#define COLOR_ORANGE 0xFF9900FF
#define COLOR_REPORT 0xFFFF91FF
#define COLOR_RADIO 0x8D8DFFFF
#define COLOR_DEPTRADIO 0xFFD700FF
#define COLOR_BLUE 0x2641FEFF
#define COLOR_MEDIC 0xFF8282FF
#define COLOR_NEWBIE 0x7DAEFFFF
#define COLOR_LIME 0x00FF00FF
#define COLOR_NEWS 0x049C7100
#define COLOR_CYAN 0x01FCFFFF
#define COLOR_VIP 0xC93CCEFF
#define COLOR_GOLD 0xFFD700FF

// Biz Defines
#define MAX_BIZ 201
#define COE "{F07B0F}"
#define CWE "{FFFFFF}"
#define CGE "{2A8A07}"

enum pInfo
{
    pAdmin,
    pCash,
    pBiz,
    pMaskOn,
    pHideOn,
    pVBiz
};
new PlayerInfo[MAX_PLAYERS][pInfo];

enum bizInfo
{
    bType,
    bStatus,
    bOwner[32],
    Float:bX,
    Float:bY,
    Float:bZ,
    bPickup,
    bMoney,
    bProducts,
    Text3D:bText,
    bSold,
    bLevel,
    bPrice,
    bAP
}
new BizInfo[MAX_BIZ][bizInfo];

public OnFilterScriptInit()
{
    LoadBiz();
    print("\n--------------------------------------");
    print(" Business System By EquinoX/Flaken");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    SaveBiz();
    return 1;
}
stock CheckFiles()
{
    if(!dini_Exists("businesses.cfg")) dini_Create("businesses.cfg");
    return 1;
}
stock LoadBiz()
{
    if(!fexist("businesses.cfg")) fcreate("businesses.cfg");
    new binfo[12][32];
    new string[256];
    new File:file = fopen("businesses.cfg", io_read);
    if(file)
    {
        new idx = 1;
        while(idx < MAX_BIZ)
        {
            fread(file, string);
            split(string, binfo, '|');
            BizInfo[idx][bType] = strval(binfo[0]);
            BizInfo[idx][bStatus] = strval(binfo[1]);
            format(BizInfo[idx][bOwner], 32, "%s", binfo[2]);
            BizInfo[idx][bX] = floatstr(binfo[3]);
            BizInfo[idx][bY] = floatstr(binfo[4]);
            BizInfo[idx][bZ] = floatstr(binfo[5]);
            BizInfo[idx][bMoney] = strval(binfo[6]);
            BizInfo[idx][bProducts] = strval(binfo[7]);
            BizInfo[idx][bSold] = strval(binfo[8]);
            BizInfo[idx][bLevel] = strval(binfo[9]);
            BizInfo[idx][bPrice] = strval(binfo[10]);
            BizInfo[idx][bAP] = strval(binfo[11]);
            if(BizInfo[idx][bType]) // If Business is owned
            {
                BizInfo[idx][bPickup] = CreateDynamicPickup(1272, 1, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ], 0);
                if(!strcmp("The State", BizInfo[idx][bOwner])) format(string, sizeof(string), "[Business ID: %d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: For Sale\nPrice: $%d", idx, RBT(idx), BizInfo[idx][bOwner], BizInfo[idx][bPrice]);
                //else format(string, sizeof(string), "ID: %d\n%s\nOwner: %s\nStatus: %s", idx, RBT(idx), BizInfo[idx][bOwner], RBS(idx));
                else format(string, sizeof(string), "[Business ID: %d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: %s", idx, RBT(idx), BizInfo[idx][bOwner], RBS(idx));
                BizInfo[idx][bText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]+0.3, 15);
            }
            idx++;
        }
    }
    print("Businesses loaded successfully.");
    return 1;
}

stock SaveBiz()
{
    if(!fexist("businesses.cfg")) fcreate("businesses.cfg");
    new idx = 1, File:file;
    new string[256];
    while(idx < MAX_BIZ)
    {
        format(string, sizeof(string), "%d|%d|%s|%f|%f|%f|%d|%d|%d|%d|%d|%d\r\n", BizInfo[idx][bType], BizInfo[idx][bStatus], BizInfo[idx][bOwner], BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ], BizInfo[idx][bMoney], BizInfo[idx][bProducts], BizInfo[idx][bSold], BizInfo[idx][bLevel], BizInfo[idx][bPrice], BizInfo[idx][bAP]);
        if(idx == 1)
        {
            file = fopen("businesses.cfg", io_write);
        }
        else
        {
            file = fopen("businesses.cfg", io_append);
        }
        fwrite(file, string);
        fclose(file);
        idx++;
    }
    print("Businesses saved successfully.");
}
public OnPlayerConnect( playerid )
{
SendClientMessage(playerid, COLOR_GREY,"This server is using Flaken's business system!");
return 1;
}

CMD:createbiz(playerid, params[])
{
    new type, string[128];
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
//    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
    if(sscanf(params, "i", type))
    {
        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /createbiz [type]");
        SendClientMessage(playerid, COLOR_GREY, "TYPES: 1) 24/7 | 2) Clothes Shop | 3) Ammunation | 4) Club | 5) Advertisement Agency | 6) Fast Food | 7) Casino");
        return 1;
    }
    if(type < 1 || type > 7) return SendClientMessage(playerid, COLOR_GREY, "Businesses are between 1 and 7.");
    for(new idx=1; idx<MAX_BIZ; idx++)
    {
        if(!BizInfo[idx][bType])
        {
            //g_bizRobber[idx] = -1;
            // Getting Business Setup
            new Float:X, Float:Y, Float:Z;
            GetPlayerPos(playerid, X, Y, Z);
            // Making Business
            BizInfo[idx][bType] = type;
            BizInfo[idx][bStatus] = 0;
            format(BizInfo[idx][bOwner], 32, "The State");
            BizInfo[idx][bX] = X;
            BizInfo[idx][bY] = Y;
            BizInfo[idx][bZ] = Z;
            BizInfo[idx][bMoney] = 0;
            BizInfo[idx][bProducts] = 0;
            BizInfo[idx][bSold] = 0;
            BizInfo[idx][bLevel] = 1;
            BizInfo[idx][bPrice] = 500000;
            BizInfo[idx][bPickup] = CreateDynamicPickup(1272, 1, X, Y, Z, 0);
            format(string, sizeof(string), "[Business ID: %d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: For Sale\nPrice: $%d", idx, RBT(idx), BizInfo[idx][bOwner], BizInfo[idx][bPrice]);
            BizInfo[idx][bText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, X, Y, Z, 15);
            format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has created business ID %d.", RPN(playerid), idx);
            //SendAdminMessage(COLOR_DARKRED, 1, string);
            Log("logs/business.log", string);
            idx = MAX_BIZ;
        }
    }
    return 1;
}

CMD:deletebiz(playerid, params[])
{
    new id, string[128];
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
//    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
    if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /deletebiz [bizid]");
    if(!BizInfo[id][bType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid business id.");
    foreach(Player, i)
    {
        if(IsPlayerConnected(i) && PlayerInfo[i][pBiz] == id)
        {
            PlayerInfo[playerid][pBiz] = 0;
            format(string, sizeof(string), " Adminstrator %s has deleted your business.", RPN(playerid));
            SendClientMessage(i, COLOR_WHITE, string);
        }
    }
    if(!strcmp("The State", BizInfo[id][bOwner]))
    {
        format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has deleted business ID %d.", RPN(playerid), id);
    }
    else
    {
        format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has deleted %s's business. (ID %d)", RPN(playerid), BizInfo[id][bOwner], id);
    }
    //SendAdminMessage(COLOR_DARKRED, 1, string);
    Log("logs/business.log", string);
    BizInfo[id][bType] = 0;
    BizInfo[id][bStatus] = 0;
    format(BizInfo[id][bOwner], 32, "");
    BizInfo[id][bX] = 0;
    BizInfo[id][bY] = 0;
    BizInfo[id][bZ] = 0;
    BizInfo[id][bMoney] = 0;
    BizInfo[id][bProducts] = 0;
    DestroyDynamicPickup(BizInfo[id][bPickup]);
    DestroyDynamic3DTextLabel(BizInfo[id][bText]);
    return 1;
}
CMD:bizhelp(playerid, params[])
{
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    SendClientMessage(playerid, COLOR_YELLOW, "BUSINESS: {FFFFFF}/buybiz");
    if(PlayerInfo[playerid][pBiz] || PlayerInfo[playerid][pVBiz]) SendClientMessage(playerid, COLOR_YELLOW, "BUSINESS OWNER: {FFFFFF}/vault /lock /buyproducts /sellbiztomarket");
    return 1;
}
CMD:vault(playerid, params[])
{
    new value, string[128];
    new idx = PlayerInfo[playerid][pBiz];
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    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 > PlayerInfo[playerid][pCash]) 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;
}
/*CMD:buyproducts(playerid, params[])
{
    new amount, price, string[128];
    new idx = PlayerInfo[playerid][pBiz];
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!PlayerInfo[playerid][pBiz] && !PlayerInfo[playerid][pVBiz]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a business.");
    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, "i", amount)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /buyproducts [amount]");
    if(amount < 0) return SendClientMessage(playerid, COLOR_GREY, "Invalid products amount.");
    if(Products < amount)
    {
        format(string, sizeof(string), "The products dropoff currently has %d products only.", Products);
        SendClientMessage(playerid, COLOR_GREY, string);
        return 1;
    }
    price = amount*20;
    if(PlayerInfo[playerid][pCash] < price)
    {
        format(string, sizeof(string), "You don't have that much money on you. ($%d)", price);
        SendClientMessage(playerid, COLOR_GREY, string);
        return 1;
    }
    if(BizInfo[idx][bProducts]+amount > 500) return SendClientMessage(playerid, COLOR_GREY, "Your business can't hold that much products.");
    GivePlayerCash(playerid, -price);
    BizInfo[idx][bProducts] += amount;
    Products -= amount;
    format(string, sizeof(string), "* %s has purchased %d products for $%d.", RPN(playerid), amount, price);
    SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
    format(string, sizeof(string), "Packages Dropoff\n{FFFF00}/deliverpackages to deliver crates\nAvailable Products: %d/20000", Products);
    UpdateDynamic3DTextLabelText(ProductsText, COLOR_RED, string);
    return 1;
}*/

/*CMD:lockb(playerid, params[])
{
    new string[128], idx, done, lockdone;
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pBiz])
    {
        if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[PlayerInfo[playerid][pBiz]][bX], BizInfo[PlayerInfo[playerid][pBiz]][bY], BizInfo[PlayerInfo[playerid][pBiz]][bZ]))
        {
            if(!BizInfo[PlayerInfo[playerid][pBiz]][bStatus])
            {
                BizInfo[PlayerInfo[playerid][pBiz]][bStatus] = 1;
                format(string, sizeof(string), "[Business ID: %d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: %s", PlayerInfo[playerid][pBiz], RBT(PlayerInfo[playerid][pBiz]), BizInfo[PlayerInfo[playerid][pBiz]][bOwner], RBS(PlayerInfo[playerid][pBiz]));
                UpdateDynamic3DTextLabelText(BizInfo[PlayerInfo[playerid][pBiz]][bText], COLOR_WHITE, string);
                format(string, sizeof(string), "* %s takes out their business keys and unlocks it.", RPN(playerid));
                SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                GameTextForPlayer(playerid, "~g~Business Unlocked", 3500, 3);
            }
            else if(BizInfo[PlayerInfo[playerid][pBiz]][bStatus])
            {
                BizInfo[PlayerInfo[playerid][pBiz]][bStatus] = 0;
                format(string, sizeof(string), "[Business ID: %d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: %s", PlayerInfo[playerid][pBiz], RBT(PlayerInfo[playerid][pBiz]), BizInfo[PlayerInfo[playerid][pBiz]][bOwner], RBS(PlayerInfo[playerid][pBiz]));
                UpdateDynamic3DTextLabelText(BizInfo[PlayerInfo[playerid][pBiz]][bText], COLOR_WHITE, string);
                format(string, sizeof(string), "* %s takes out their business keys and locks it.", RPN(playerid));
                SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                GameTextForPlayer(playerid, "~r~Business Locked", 3500, 3);
   }
            done = 1;
            lockdone = 1;
            }
        }
        return 1;
    }*/

CMD:buybiz(playerid, params[])
{
    new string[128], done;
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pBiz] == 1) return SendClientMessage(playerid, COLOR_GREY, "You already own a businesses.");
    //if(PlayerInfo[playerid][pBiz] && PlayerInfo[playerid][pVIP] < 4) return SendClientMessage(playerid, COLOR_GREY, "You already own a business.");
    for(new idx=1; idx<MAX_BIZ; idx++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]))
        {
            if(!strcmp("The State", BizInfo[idx][bOwner], false))
            {
                if(GetPlayerMoney(playerid) < BizInfo[idx][bPrice]) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to buy this business.");
                {
                GivePlayerCash(playerid, -BizInfo[idx][bPrice]);
                if(PlayerInfo[playerid][pBiz]) PlayerInfo[playerid][pVBiz] = idx;
                else PlayerInfo[playerid][pBiz] = idx;
                format(BizInfo[idx][bOwner], 32, "%s", RPNU(playerid));
                format(string, sizeof(string), "[Business ID: %d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: %s", idx, RBT(idx), BizInfo[idx][bOwner], RBS(idx));
                UpdateDynamic3DTextLabelText(BizInfo[idx][bText], COLOR_WHITE, string);
                SendClientMessage(playerid, COLOR_GREEN, " You have successfully bought a business.");
                SendClientMessage(playerid, COLOR_WHITE, " Type /bizhelp to view your business commands.");
                BizInfo[idx][bProducts] = 99999;
                format(string, sizeof(string), "%s has bought business id %d.", RPN(playerid), idx);
                Log("logs/business.log", string);
                idx = MAX_BIZ;
                done = 1;
            }
            if(idx == MAX_BIZ-1 && !done)
            {
                SendClientMessage(playerid, COLOR_GREY, "This business is owned by someone else.");
            }
        }
        if(idx == MAX_BIZ-1 && !done)
        {
            SendClientMessage(playerid, COLOR_GREY, "You are not near a buyable business.");
        }
    }
}
    return 1;
}



CMD:sellbiztomarket(playerid, params[])
{
    new string[128];
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!PlayerInfo[playerid][pBiz] && !PlayerInfo[playerid][pVBiz]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a business.");
    if(sscanf(params, "s[8]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellbiztomarket confirm");
    if(!strcmp(params, "confirm", true))
    {
        new done;
        if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[PlayerInfo[playerid][pBiz]][bX], BizInfo[PlayerInfo[playerid][pBiz]][bY], BizInfo[PlayerInfo[playerid][pBiz]][bZ]))
        {
            GivePlayerCash(playerid, (75*BizInfo[PlayerInfo[playerid][pBiz]][bPrice])/100);
            BizInfo[PlayerInfo[playerid][pBiz]][bStatus] = 0;
            format(BizInfo[PlayerInfo[playerid][pBiz]][bOwner], 32, "The State");
            format(string, sizeof(string), "[Business ID:% d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: For Sale\nPrice: $%d", PlayerInfo[playerid][pBiz], RBT(PlayerInfo[playerid][pBiz]), BizInfo[PlayerInfo[playerid][pBiz]][bOwner], BizInfo[PlayerInfo[playerid][pBiz]][bPrice]);
            UpdateDynamic3DTextLabelText(BizInfo[PlayerInfo[playerid][pBiz]][bText], COLOR_WHITE, string);
            SendClientMessage(playerid, COLOR_GREEN, " You have successfully sold your business to The State. (75 percent of original price was paid back)");
            format(string, sizeof(string), "%s has sold business id %d to the market.", RPN(playerid), PlayerInfo[playerid][pBiz]);
            Log("logs/business.log", string);
            PlayerInfo[playerid][pBiz] = 0;
            done = 1;
        }
        if(!done)
        {
            new idx = PlayerInfo[playerid][pVBiz];
            if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]))
            {
                GivePlayerCash(playerid, (75*BizInfo[idx][bPrice])/100);
                BizInfo[idx][bStatus] = 0;
                format(BizInfo[idx][bOwner], 32, "The State");
                format(string, sizeof(string), "[Business ID: %d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: For Sale\nPrice: $%d", idx, RBT(idx), BizInfo[idx][bOwner], BizInfo[idx][bPrice]);
                UpdateDynamic3DTextLabelText(BizInfo[idx][bText], COLOR_WHITE, string);
                SendClientMessage(playerid, COLOR_GREEN, " You have successfully sold your business to The State. (75 percent of original price was paid back)");
                format(string, sizeof(string), "%s has sold business id %d to the market.", RPN(playerid), idx);
                Log("logs/business.log", string);
                PlayerInfo[playerid][pVBiz] = 0;
                done = 1;
            }
        }
        if(!done)
        {
            SendClientMessage(playerid, COLOR_GREY, "You are not near your business.");
            return 1;
        }
    }
    return 1;
}
CMD:enter(playerid, params[])
{
    new string[128];
    for(new idx=1; idx<MAX_BIZ; idx++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]))
        {
            if(!BizInfo[idx][bStatus] && PlayerInfo[playerid][pBiz] != idx && !PlayerInfo[playerid][pVBiz]) return SendClientMessage(playerid, COLOR_GREY, "This business is closed.");
            if(BizInfo[idx][bType] == 1) // 24/7 Business
            {
                format(string, sizeof(string), "* %s pushes the door and enters the shop.", RPN(playerid));
                SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                SetPlayerPos(playerid, -27.3025,-57.6649,1003.5469);
                SetPlayerFacingAngle(playerid, 357.5915);
                SetCameraBehindPlayer(playerid);
                SetPlayerInterior(playerid, 6);
                SetPlayerVirtualWorld(playerid, idx+100);
                format(string, sizeof(string), "** Welcome to %s's 24/7 Market (( /list & /buy )) **", BizInfo[idx][bOwner]);
                SendClientMessage(playerid, COLOR_ORANGE, string);
                return 1;
            }
            else if(BizInfo[idx][bType] == 2) // Clothes Shop Business
            {
                format(string, sizeof(string), "* %s pushes the door and enters the shop.", RPN(playerid));
                SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                SetPlayerPos(playerid, 207.0638,-139.9965,1003.5078);
                SetPlayerFacingAngle(playerid, 356.3849);
                SetCameraBehindPlayer(playerid);
                SetPlayerInterior(playerid, 3);
                SetPlayerVirtualWorld(playerid, idx+100);
                format(string, sizeof(string), "** Welcome to %s's Clothes Shop (( /buyclothes(old) & /buytoys )) **", BizInfo[idx][bOwner]);
                SendClientMessage(playerid, COLOR_ORANGE, string);
                return 1;
            }
            else if(BizInfo[idx][bType] == 3) // Ammunation Business
            {
                format(string, sizeof(string), "* %s pushes the door and enters the shop.", RPN(playerid));
                SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                SetPlayerPos(playerid, 285.8044,-85.9956,1001.5229);
                SetPlayerFacingAngle(playerid, 358.9898);
                SetCameraBehindPlayer(playerid);
                SetPlayerInterior(playerid, 4);
                SetPlayerVirtualWorld(playerid, idx+100);
                format(string, sizeof(string), "** Welcome to %s's Ammunation (( /list & /buy /buyweapon )) **", BizInfo[idx][bOwner]);
                SendClientMessage(playerid, COLOR_ORANGE, string);
                return 1;
            }
            else if(BizInfo[idx][bType] == 4) // Club Business
            {
                format(string, sizeof(string), "* %s pushes the door and enters the shop.", RPN(playerid));
                SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                SetPlayerPos(playerid, 493.4252,-24.3061,1000.6797);
                SetPlayerFacingAngle(playerid, 0.2432);
                SetCameraBehindPlayer(playerid);
                SetPlayerInterior(playerid, 17);
                SetPlayerVirtualWorld(playerid, idx+100);
                format(string, sizeof(string), "** Welcome to %s's Club (( /list & /buy )) **", BizInfo[idx][bOwner]);
                SendClientMessage(playerid, COLOR_ORANGE, string);
                return 1;
            }
            else if(BizInfo[idx][bType] == 5) // Advertisement Agency
            {
                format(string, sizeof(string), "* %s pushes the door and enters the shop.", RPN(playerid));
                SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                SetPlayerPos(playerid, 834.1631,7.4883,1004.1797);
                SetPlayerFacingAngle(playerid, 86.7239);
                SetCameraBehindPlayer(playerid);
                SetPlayerInterior(playerid, 3);
                SetPlayerVirtualWorld(playerid, idx+100);
                format(string, sizeof(string), "** Welcome to %s's Advertisement Agency (( /ad )) **", BizInfo[idx][bOwner]);
                SendClientMessage(playerid, COLOR_ORANGE, string);
                return 1;
            }
            else if(BizInfo[idx][bType] == 6) // Fast Food
            {
                format(string, sizeof(string), "* %s pushes the door and enters the shop.", RPN(playerid));
                SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                SetPlayerPos(playerid, 372.3830,-133.2579,1001.4922);
                SetPlayerFacingAngle(playerid, 0.4216);
                SetCameraBehindPlayer(playerid);
                SetPlayerInterior(playerid, 5);
                SetPlayerVirtualWorld(playerid, idx+100);
                format(string, sizeof(string), "** Welcome to %s's Fast Food (( /list /buy )) **", BizInfo[idx][bOwner]);
                SendClientMessage(playerid, COLOR_ORANGE, string);
                return 1;
            }
            else if(BizInfo[idx][bType] == 7) // Casino
            {
                format(string, sizeof(string), "* %s pushes the door and enters the casino.", RPN(playerid));
                SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                SetPlayerPos(playerid, 2233.8032,1712.2303,1011.7632);
                SetPlayerFacingAngle(playerid, 0.4216);
                SetCameraBehindPlayer(playerid);
                SetPlayerInterior(playerid, 1);
                SetPlayerVirtualWorld(playerid, idx+100);
                format(string, sizeof(string), "** Welcome to %s's Casino (( /list /buy )) **", BizInfo[idx][bOwner]);
                SendClientMessage(playerid, COLOR_ORANGE, string);
                return 1;
            }
        }
    }
    return 1;
}
CMD:exit(playerid, params[])
{
    new done, string[128];
    if(IsPlayerInRangeOfPoint(playerid, 5, 2233.8032,1712.2303,1011.7632) || IsPlayerInRangeOfPoint(playerid, 2, -27.3025,-57.6649,1003.5469) || IsPlayerInRangeOfPoint(playerid, 2, 207.0638,-139.9965,1003.5078) || IsPlayerInRangeOfPoint(playerid, 2, 285.8044,-85.9956,1001.5229) || IsPlayerInRangeOfPoint(playerid, 2, 493.4252,-24.3061,1000.6797) || IsPlayerInRangeOfPoint(playerid, 2, 834.1631,7.4883,1004.1797) || IsPlayerInRangeOfPoint(playerid, 2, 372.3830,-133.2579,1001.4922))
    {
        new idx;
        idx = GetPlayerVirtualWorld(playerid)-100;
        if(!done && idx < MAX_BIZ && BizInfo[idx][bType])
        {
            if(BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ])
            {
                idx = GetPlayerVirtualWorld(playerid)-100;
                if(!done && idx < MAX_BIZ && BizInfo[idx][bType])
                {
                    SetPlayerPos(playerid, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]);
                    SetPlayerInterior(playerid, 0);
                    SetPlayerVirtualWorld(playerid, 0);
                }
                done = 1;
                return 1;
            }
            format(string, sizeof(string), "* %s pushes the door and exits the shop.", RPN(playerid));
            if(PlayerInfo[playerid][pMaskOn] == 1)
            {
                format(string, sizeof(string), "* Stranger pushes the door and exits the shop.");
            }
            else
            {
                format(string, sizeof(string), "* %s pushes the door and exits the shop.", RPN(playerid));
            }
            SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
            SetPlayerPos(playerid, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]);
            SetPlayerInterior(playerid, 0);
            SetPlayerVirtualWorld(playerid, 0);
        }
        done = 1;
    }
    return 1;
}
CMD:bused(playerid, params[])
{
    new string[128];
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
//    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
    SendClientMessage(playerid, COLOR_ORANGE, "[Used Businesses]:");
    for(new idx=1; idx<MAX_BIZ; idx++)
    {
        if(BizInfo[idx][bType])
        {
            format(string, sizeof(string), "ID: %d | Type: %s | Level: %d | Price: $%d | Products: %d | Vault: $%d | Owner: %s", idx, RBT(idx), BizInfo[idx][bLevel], BizInfo[idx][bPrice],BizInfo[idx][bProducts], BizInfo[idx][bMoney], BizInfo[idx][bOwner]);
            SendClientMessage(playerid, COLOR_ORANGE, string);
        }
    }
    return 1;
}
CMD:bedit(playerid, params[])
{
    new bizid, string[128], input;
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
//    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
    if(sscanf(params, "s[32]", params))
    {
        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bedit [option] [bizid]");
        SendClientMessage(playerid, COLOR_GREY, "OPTIONS: location | price | level | products | vault | truckers");
        return 1;
    }
    if(!strcmp(params, "location", true, 8))
    {
        if(sscanf(params, "s[32]i", params, bizid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bedit location [bizid]");
        new idx=bizid;
        if(!BizInfo[bizid][bType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid business id.");
        GetPlayerPos(playerid, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ]);
        DestroyDynamicPickup(BizInfo[bizid][bPickup]);
        BizInfo[bizid][bPickup] = CreateDynamicPickup(1272, 1, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ], 0);
        DestroyDynamic3DTextLabel(BizInfo[bizid][bText]);
        if(!strcmp("The State", BizInfo[idx][bOwner])) format(string, sizeof(string), "[Business ID: %d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: For Sale\nPrice: $%d", idx, RBT(idx), BizInfo[idx][bOwner], BizInfo[idx][bPrice]);
        else format(string, sizeof(string), "[Business ID: %d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: %s", idx, RBT(idx), BizInfo[idx][bOwner], RBS(idx));
        BizInfo[bizid][bText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ]+0.3, 15);
        format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has changed business ID %d's location.", NORPN(playerid), bizid);
        //SendAdminMessage(COLOR_DARKRED, 1, string);
        Log("logs/business.log", string);
    }
    else if(!strcmp(params, "price", true, 5))
    {
        if(sscanf(params, "s[32]ii", params, bizid, input)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bedit price [bizid] [price]");
        if(!BizInfo[bizid][bType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid business id.");
        if(strcmp("The State", BizInfo[bizid][bOwner])) return SendClientMessage(playerid, COLOR_GREY, "You can't edit the price of owned businesses.");
        BizInfo[bizid][bPrice] = input;
        format(string, sizeof(string), "[Business ID: %d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: For Sale\nPrice: $%d", bizid, RBT(bizid), BizInfo[bizid][bOwner], BizInfo[bizid][bPrice]);
        UpdateDynamic3DTextLabelText(BizInfo[bizid][bText], COLOR_WHITE, string);
        format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has set business ID %d's price to $%d.", NORPN(playerid), bizid, input);
        //SendAdminMessage(COLOR_DARKRED, 1, string);
        Log("logs/business.log", string);
    }
    else if(!strcmp(params, "level", true, 5))
    {
        // L1: 0 | L2: 100 | L3: 300 | L4: 700 | L5: 1200
        if(sscanf(params, "s[32]ii", params, bizid, input)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bedit level [bizid] [level]");
        if(!BizInfo[bizid][bType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid business id.");
        if(input < 0 || input > 5) return SendClientMessage(playerid, COLOR_GREY, "Levels are between 1 and 5.");
        BizInfo[bizid][bLevel] = input;
        if(input == 1) BizInfo[bizid][bSold] = 0;
        if(input == 2) BizInfo[bizid][bSold] = 100;
        if(input == 3) BizInfo[bizid][bSold] = 300;
        if(input == 4) BizInfo[bizid][bSold] = 700;
        if(input == 5) BizInfo[bizid][bSold] = 1200;
        format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has set business ID %d's level to %d.", NORPN(playerid), bizid, input);
        //SendAdminMessage(COLOR_DARKRED, 1, string);
        Log("logs/business.log", string);
    }
    else if(!strcmp(params, "products", true, 8))
    {
        if(sscanf(params, "s[32]ii", params, bizid, input)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bedit products [bizid] [amount]");
        if(!BizInfo[bizid][bType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid business id.");
        if(input < 0) return SendClientMessage(playerid, COLOR_GREY, "Products can't be negative.");
        BizInfo[bizid][bProducts] = input;
        format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has set business ID %d's products to %d.", NORPN(playerid), bizid, input);
        //SendAdminMessage(COLOR_DARKRED, 1, string);
        Log("logs/business.log", string);
    }
    else if(!strcmp(params, "vault", true, 5))
    {
        if(sscanf(params, "s[32]ii", params, bizid, input)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bedit vault [bizid] [amount]");
        if(!BizInfo[bizid][bType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid business id.");
        if(input < 0) return SendClientMessage(playerid, COLOR_GREY, "Vault money can't be negative.");
        BizInfo[bizid][bMoney] = input;
        format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has set business ID %d's vault money to $%d.", NORPN(playerid), bizid, input);
        //SendAdminMessage(COLOR_DARKRED, 1, string);
        Log("logs/business.log", string);
    }
    else if(!strcmp(params, "truckers", true, 8))
    {
        if(sscanf(params, "s[32]ii", params, bizid, input)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bedit truckers [bizid] [type] (1=Accepting | 2=NotAccepting");
        if(!BizInfo[bizid][bAP])
        {
            BizInfo[bizid][bAP] = 1;
            format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has set business ID %d to accept truckers.", NORPN(playerid), bizid);
            //SendAdminMessage(COLOR_DARKRED, 1, string);
            Log("logs/business.log", string);
        }
        else
        {
            BizInfo[bizid][bAP] = 0;
            format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has set business ID %d to NOT accept truckers.", NORPN(playerid), bizid);
            //SendAdminMessage(COLOR_DARKRED, 1, string);
            Log("logs/business.log", string);
        }
    }
    return 1;
}
CMD:gotobiz(playerid, params[])
{
    new idx, string[128];
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
//    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
    if(sscanf(params, "i", idx)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gotobiz [bizid]");
    if(!BizInfo[idx][bType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid business id.");
    SetPlayerVirtualWorld(playerid, 0);
    SetPlayerInterior(playerid, 0);
    SetPlayerPos(playerid, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]);
    format(string, sizeof(string), " You have teleported to business ID %d.", idx);
    SendClientMessage(playerid, COLOR_WHITE, string);
    return 1;
}

CMD:asellbiz(playerid, params[])
{
    new bizid, string[128];
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
//    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
    if(sscanf(params, "i", bizid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /asellbiz [bizid]");
    if(!BizInfo[bizid][bType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid business id.");
    if(!strcmp("The State", BizInfo[bizid][bOwner], true)) return SendClientMessage(playerid, COLOR_GREY, "This business is not owned by anybody.");
    foreach(Player, i)
    {
        if(IsPlayerConnected(i) && PlayerInfo[i][pBiz] == bizid)
        {
            PlayerInfo[i][pBiz] = 0;
            format(string, sizeof(string), " Administrator %s has sold your business.", RPN(playerid));
            SendClientMessage(i, COLOR_WHITE, string);
        }
    }
    format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has sold %s's business. (ID %d)", RPN(playerid), BizInfo[bizid][bOwner], bizid);
    //SendAdminMessage(COLOR_DARKRED, 1, string);
    Log("logs/business.log", string);
    BizInfo[bizid][bStatus] = 0;
    format(BizInfo[bizid][bOwner], 32, "The State");
    format(string, sizeof(string), "[Business ID: %d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: For Sale\nPrice: $%d", bizid, RBT(bizid), BizInfo[bizid][bOwner], BizInfo[bizid][bPrice]);
    UpdateDynamic3DTextLabelText(BizInfo[bizid][bText], COLOR_WHITE, string);
    return 1;
}
stock GivePlayerCash(playerid, money)
{
    SetPVarInt(playerid, "Cash", GetPVarInt(playerid, "Cash")+money);
    GivePlayerMoney(playerid, money);
    return 1;
}
stock fcreate(filename[])
{
    if (fexist(filename)) return false;
    new File:fhnd;
    fhnd=fopen(filename,io_write);
    if (fhnd) {
        fclose(fhnd);
        return true;
    }
    return false;
}
stock RBT(bizid)
{
    new string[24];
    if(!BizInfo[bizid][bType]) format(string, sizeof(string), "None");
    else if(BizInfo[bizid][bType] == 1) format(string, sizeof(string), "24/7 Market");
    else if(BizInfo[bizid][bType] == 2) format(string, sizeof(string), "Clothes Shop");
    else if(BizInfo[bizid][bType] == 3) format(string, sizeof(string), "Ammunation");
    else if(BizInfo[bizid][bType] == 4) format(string, sizeof(string), "Club");
    //else if(BizInfo[bizid][bType] == 5) format(string, sizeof(string), "Advertisement Agency");
    else if(BizInfo[bizid][bType] == 5) format(string, sizeof(string), "Adv. Agency");
    else if(BizInfo[bizid][bType] == 6) format(string, sizeof(string), "Fast Food");
    else if(BizInfo[bizid][bType] == 7) format(string, sizeof(string), "Casino");
    return string;
}
stock RHS(bizid)
{
    new string[16];
    if(!HouseInfo[bizid][hStatus]) format(string, sizeof(string), "Closed");
    else if(HouseInfo[bizid][hStatus]) format(string, sizeof(string), "Open");
    return string;
}

stock RBS(bizid)
{
    new string[16];
    if(!BizInfo[bizid][bStatus]) format(string, sizeof(string), "Closed");
    else if(BizInfo[bizid][bStatus]) format(string, sizeof(string), "Open");
    return string;
}

stock RPBP(playerid)
{
    new string[32];
    if(!PlayerInfo[playerid][pBiz]) format(string, sizeof(string), "None");
    else if(PlayerInfo[playerid][pBiz]) format(string, sizeof(string), "%d", BizInfo[PlayerInfo[playerid][pBiz]][bProducts]);
    return string;
}
stock RPN(playerid)
{
    new string[25];
    if(PlayerInfo[playerid][pMaskOn] == 0)format(string, sizeof(string), "%s", RemoveUnderScore(playerid));
    else if(PlayerInfo[playerid][pMaskOn] == 1)format(string, sizeof(string), "Stranger");
    return string;
}
stock Log(sz_fileName[], sz_input[]) {

    new sz_logEntry[156], i_dateTime[2][3], File: fileHandle = fopen(sz_fileName, io_append);
    gettime(i_dateTime[0][0], i_dateTime[0][1], i_dateTime[0][2]);
    getdate(i_dateTime[1][0], i_dateTime[1][1], i_dateTime[1][2]);
    format(sz_logEntry, sizeof(sz_logEntry), "[%i/%i/%i - %i:%i:%i] %s\r\n", i_dateTime[1][0], i_dateTime[1][1], i_dateTime[1][2], i_dateTime[0][0], i_dateTime[0][1], i_dateTime[0][2], sz_input);
    fwrite(fileHandle, sz_logEntry);
    return fclose(fileHandle);
}
stock SendNearbyMessage(playerid, Float:radius, string[], col1, col2, col3, col4, col5)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    new Float:ix, Float:iy, Float:iz;
    new Float:cx, Float:cy, Float:cz;
    foreach(Player, i)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerInterior(playerid) == GetPlayerInterior(i) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
            {
                GetPlayerPos(i, ix, iy, iz);
                cx = (x - ix);
                cy = (y - iy);
                cz = (z - iz);
                if(((cx < radius/16) && (cx > -radius/16)) && ((cy < radius/16) && (cy > -radius/16)) && ((cz < radius/16) && (cz > -radius/16)))
                {
                    SendClientMessage(i, col1, string);
                }
                else if(((cx < radius/8) && (cx > -radius/8)) && ((cy < radius/8) && (cy > -radius/8)) && ((cz < radius/8) && (cz > -radius/8)))
                {
                    SendClientMessage(i, col2, string);
                }
                else if(((cx < radius/4) && (cx > -radius/4)) && ((cy < radius/4) && (cy > -radius/4)) && ((cz < radius/4) && (cz > -radius/4)))
                {
                    SendClientMessage(i, col3, string);
                }
                else if(((cx < radius/2) && (cx > -radius/2)) && ((cy < radius/2) && (cy > -radius/2)) && ((cz < radius/2) && (cz > -radius/2)))
                {
                    SendClientMessage(i, col4, string);
                }
                else if(((cx < radius) && (cx > -radius)) && ((cy < radius) && (cy > -radius)) && ((cz < radius) && (cz > -radius)))
                {
                    SendClientMessage(i, col5, string);
                }
            }
        }
    }
    return 1;
}
stock RPNU(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}
stock NORPN(playerid)
{
    new astring[25];
    if(PlayerInfo[playerid][pHideOn] == 0)format(astring, sizeof(astring), "%s", RemoveUnderScore(playerid));
    else if(PlayerInfo[playerid][pHideOn] == 1)format(astring, sizeof(astring), "Anon");
    return astring;
}
stock RemoveUnderScore(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    for(new i = 0; i < MAX_PLAYER_NAME; i++)
    {
        if(name[i] == '_') name[i] = ' ';
    }
    return name;
}
stock split(const strsrc[], strdest[][], delimiter)
{
    new i, li;
    new aNum;
    new len;
    while(i <= strlen(strsrc))
    {
        if(strsrc[i] == delimiter || i == strlen(strsrc))
        {
            len = strmid(strdest[aNum], strsrc, li, i, 128);
            strdest[aNum][len] = 0;
            li = i+1;
            aNum++;
        }
        i++;
    }
    return 1;
}



Re: Business system help [Help] - Stanford - 01.09.2014

What about posting the /buy command...


Re: Business system help [Help] - Kaylen - 01.09.2014

When i type /buy it say your not in 24-7 , its works in 24-7 only , and commands /lockb not working can you help me ?
And How to add buy Commands for another business ? like ammu casino /ads


Re: Business system help [Help] - Barnwell - 01.09.2014

make this
Код:
 CMD:lockb(playerid, params[])
{
    new string[128], idx, done, lockdone;
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pBiz])
    {
        if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[PlayerInfo[playerid][pBiz]][bX], BizInfo[PlayerInfo[playerid][pBiz]][bY], BizInfo[PlayerInfo[playerid][pBiz]][bZ]))
        {
            if(!BizInfo[PlayerInfo[playerid][pBiz]][bStatus])
            {
                BizInfo[PlayerInfo[playerid][pBiz]][bStatus] = 1;
                format(string, sizeof(string), "[Business ID: %d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: %s", PlayerInfo[playerid][pBiz], RBT(PlayerInfo[playerid][pBiz]), BizInfo[PlayerInfo[playerid][pBiz]][bOwner], RBS(PlayerInfo[playerid][pBiz]));
                UpdateDynamic3DTextLabelText(BizInfo[PlayerInfo[playerid][pBiz]][bText], COLOR_WHITE, string);
                format(string, sizeof(string), "* %s takes out their business keys and unlocks it.", RPN(playerid));
                SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                GameTextForPlayer(playerid, "~g~Business Unlocked", 3500, 3);
            }
            else if(BizInfo[PlayerInfo[playerid][pBiz]][bStatus])
            {
                BizInfo[PlayerInfo[playerid][pBiz]][bStatus] = 0;
                format(string, sizeof(string), "[Business ID: %d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: %s", PlayerInfo[playerid][pBiz], RBT(PlayerInfo[playerid][pBiz]), BizInfo[PlayerInfo[playerid][pBiz]][bOwner], RBS(PlayerInfo[playerid][pBiz]));
                UpdateDynamic3DTextLabelText(BizInfo[PlayerInfo[playerid][pBiz]][bText], COLOR_WHITE, string);
                format(string, sizeof(string), "* %s takes out their business keys and locks it.", RPN(playerid));
                SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                GameTextForPlayer(playerid, "~r~Business Locked", 3500, 3);
   }
            done = 1;
            lockdone = 1;
            }
        }
        return 1;
    }