SA-MP Forums Archive
I don''t understand why its not working - 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: I don''t understand why its not working (/showthread.php?tid=396498)



I don''t understand why its not working - NinjaChicken - 01.12.2012

ok i have a business system and when i buy the business it is saving to my profile but when i try and do any of the business commands it says i don't own a business please help

below is some code i think may be useful

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

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] == 6) format(string, sizeof(string), "Fast Food");
    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 LoadBiz()
{
    if(!fexist("biz.cfg")) fcreate("biz.cfg");
    new binfo[12][32];
    new string[256];
    new File:file = fopen("biz.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), "ID: %d\n%s\nOwner: %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));
                BizInfo[idx][bText] = CreateDynamic3DTextLabel(string, COLOR_TWAZURE, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]+0.3, 15);
            }
            idx++;
        }
    }
    print("Businesses loaded successfully.");
    return 1;
}

stock SaveBiz()
{
    if(!fexist("biz.cfg")) fcreate("biz.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("biz.cfg", io_write);
        }
        else
        {
            file = fopen("biz.cfg", io_append);
        }
        fwrite(file, string);
        fclose(file);
        idx++;
    }
    print("Businesses saved successfully.");
    return 1;
}

enum dmpInfo
{
    dmpMapIconID,
    Float: dmpPosX,
    Float: dmpPosY,
    Float: dmpPosZ,
    dmpMarkerType,
    dmpColor,
    dmpVW,
    dmpInt,
}



Re: I don''t understand why its not working - Claude_StreeT - 01.12.2012

I did not really, I'm Brazilian, I'll try to help you
From what I understand you could buy the company and can not use the commands
Well, if you use system companies like filterscript probably the type of command FS can not join the command type your GM


Re: I don''t understand why its not working - [HK]Ryder[AN] - 01.12.2012

can you show an example business command which is NOT working


Re: I don''t understand why its not working - NinjaChicken - 01.12.2012

all of them, /vault /bizlock