SA-MP Forums Archive
Bizz save problem - 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: Bizz save problem (/showthread.php?tid=383745)



Bizz save problem - N0FeaR - 08.10.2012

When i add a bizz and after i restart my server the bizz is just disappear

pawn Код:
idx = 0;
    while (idx < sizeof(BizzInfo))
    {
        new coordsstring[256];
        format(coordsstring, sizeof(coordsstring), "%s,%d,%d,%d,%f,%f,%f,%f,%f,%f,%s,%d,%d,%d,%d\n",
        BizzInfo[idx][bName],
        BizzInfo[idx][bLock],
        BizzInfo[idx][bHours],
        BizzInfo[idx][bPrice],
        BizzInfo[idx][bEnterX],
        BizzInfo[idx][bEnterY],
        BizzInfo[idx][bEnterZ],
        BizzInfo[idx][bExitX],
        BizzInfo[idx][bExitY],
        BizzInfo[idx][bExitZ],
        BizzInfo[idx][bOwner],
        BizzInfo[idx][bOwned],
        BizzInfo[idx][bInterior],
        BizzInfo[idx][bType],
        BizzInfo[idx][bMoney]);
        if(idx == 0)
        {
            file2 = fopen("bizz.cfg", io_write);
        }
        else
        {
            file2 = fopen("bizz.cfg", io_append);
        }
        fwrite(file2, coordsstring);
        idx++;
        fclose(file2);



Re: Bizz save problem - HyDrAtIc - 08.10.2012

Hey N0Fear

Well does it show any errors when you compile the script? or it just the biz disappear after you restart server?


Re: Bizz save problem - N0FeaR - 08.10.2012

Quote:
Originally Posted by James_Nick
Посмотреть сообщение
Hey N0Fear

Well does it show any errors when you compile the script? or it just the biz disappear after you restart server?
No errors, the biz just disappear after restart.


Re: Bizz save problem - HyDrAtIc - 08.10.2012

Can you show the original system? or this is it?


Re: Bizz save problem - N0FeaR - 08.10.2012

Yes is the original.


Re: Bizz save problem - Red_Dragon. - 08.10.2012

I think he does not have a saving system, If i am right use Y_INI


Re: Bizz save problem - HyDrAtIc - 08.10.2012

Then,where is your biz saving system?


Re: Bizz save problem - N0FeaR - 08.10.2012

Quote:
Originally Posted by Red_Dragon.
Посмотреть сообщение
I think he does not have a saving system, If i am right use Y_INI
This one is the save. i use it on public OnPropUpdate()

pawn Код:
idx = 0;
    while (idx < sizeof(BizzInfo))
    {
        new coordsstring[256];
        format(coordsstring, sizeof(coordsstring), "%s,%d,%d,%d,%f,%f,%f,%f,%f,%f,%s,%d,%d,%d,%d\n",
        BizzInfo[idx][bName],
        BizzInfo[idx][bLock],
        BizzInfo[idx][bHours],
        BizzInfo[idx][bPrice],
        BizzInfo[idx][bEnterX],
        BizzInfo[idx][bEnterY],
        BizzInfo[idx][bEnterZ],
        BizzInfo[idx][bExitX],
        BizzInfo[idx][bExitY],
        BizzInfo[idx][bExitZ],
        BizzInfo[idx][bOwner],
        BizzInfo[idx][bOwned],
        BizzInfo[idx][bInterior],
        BizzInfo[idx][bType],
        BizzInfo[idx][bMoney]);
        if(idx == 0)
        {
            file2 = fopen("bizz.cfg", io_write);
        }
        else
        {
            file2 = fopen("bizz.cfg", io_append);
        }
        fwrite(file2, coordsstring);
        idx++;
        fclose(file2);



Re: Bizz save problem - HyDrAtIc - 08.10.2012

Quote:
Originally Posted by N0FeaR
Посмотреть сообщение
This one is the save. i use it on public OnPropUpdate()

pawn Код:
idx = 0;
    while (idx < sizeof(BizzInfo))
    {
        new coordsstring[256];
        format(coordsstring, sizeof(coordsstring), "%s,%d,%d,%d,%f,%f,%f,%f,%f,%f,%s,%d,%d,%d,%d\n",
        BizzInfo[idx][bName],
        BizzInfo[idx][bLock],
        BizzInfo[idx][bHours],
        BizzInfo[idx][bPrice],
        BizzInfo[idx][bEnterX],
        BizzInfo[idx][bEnterY],
        BizzInfo[idx][bEnterZ],
        BizzInfo[idx][bExitX],
        BizzInfo[idx][bExitY],
        BizzInfo[idx][bExitZ],
        BizzInfo[idx][bOwner],
        BizzInfo[idx][bOwned],
        BizzInfo[idx][bInterior],
        BizzInfo[idx][bType],
        BizzInfo[idx][bMoney]);
        if(idx == 0)
        {
            file2 = fopen("bizz.cfg", io_write);
        }
        else
        {
            file2 = fopen("bizz.cfg", io_append);
        }
        fwrite(file2, coordsstring);
        idx++;
        fclose(file2);

Ok,This what I ment I told you where is the original biz system what I mean the biz system code,this is the saving system can you give the original biz system?


Sorry for not making you understanding what I'm saying but just my english is bad I ain't a english person.


Re: Bizz save problem - N0FeaR - 08.10.2012

pawn Код:
enum bInfo
{
    bName[128],
    bLock,
    bHours,
    bPrice,
    Float:bEnterX,
    Float:bEnterY,
    Float:bEnterZ,
    Float:bExitX,
    Float:bExitY,
    Float:bExitZ,
    bOwner[64],
    bOwned,
    bInterior,
    bPickupID,
    bType, // 0: None, 1: Gun Shop, 2: Bar, 3: Restaurant, 4: Store
    bMoney,
};

new BizzInfo[58][bInfo];

}

public LoadBizz()
{
    new arrCoords[23][64];
    new strFromFile2[256];
    new File: file = fopen("bizz.cfg", io_read);
    if (file)
    {
        new idx;
        while (idx < sizeof(BizzInfo))
        {
            fread(file, strFromFile2);
            split(strFromFile2, arrCoords, '|');
            BizzInfo[idx][bName] = strval(arrCoords[0]);
            BizzInfo[idx][bLock] = strval(arrCoords[1]);
            BizzInfo[idx][bHours] = strval(arrCoords[2]);
            BizzInfo[idx][bPrice] = strval(arrCoords[3]);
            BizzInfo[idx][bPrice] = strval(arrCoords[3]);
            BizzInfo[idx][bEnterX] = floatstr(arrCoords[4]);
            BizzInfo[idx][bEnterY] = floatstr(arrCoords[5]);
            BizzInfo[idx][bEnterZ] = floatstr(arrCoords[6]);
            BizzInfo[idx][bExitX] = floatstr(arrCoords[7]);
            BizzInfo[idx][bExitY] = floatstr(arrCoords[8]);
            BizzInfo[idx][bExitZ] = floatstr(arrCoords[9]);
            strmid(BizzInfo[idx][bOwner], arrCoords[10], 0, strlen(arrCoords[1]), 255);
            BizzInfo[idx][bOwned] = strval(arrCoords[11]);
            BizzInfo[idx][bInterior] = strval(arrCoords[12]);
            BizzInfo[idx][bType] = strval(arrCoords[13]);
            BizzInfo[idx][bMoney] = strval(arrCoords[14]);
            idx++;
        }
        fclose(file);
    }
    return 1;
}