SA-MP Forums Archive
Loading with y_ini? - 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: Loading with y_ini? (/showthread.php?tid=508577)



Loading with y_ini? - arko123 - 22.04.2014

Hello everyone I have been trying to figure out how to use INI_ParseFile however I just don't get how it works like for istance how would I load a business when the business file is called business_1 in the path business/business_1 like all I see are user based loading systems and I haven't seen one tutorial that goes into what INI_ParseFile does, I've checked ******'s thread about it and I didn't grasp what he was talking about. Any help is much appreciated.


Re: Loading with y_ini? - Chenko - 22.04.2014

If you know how many businesses you have or the max amount you can have then you can do something like this:

pawn Код:
#define MAX_BIZ 10

enum b_
{
    Float:a,
    b,
};
new Biz[MAX_BIZ][b_];

new string[128];

stock LoadBusinesses()
{
    for(new i; i < MAX_BIZ; i++)
    {
        format(string, sizeof(string), "Businesses/Biz_%d", i);
        if(fexist(string))
        {
            INI_ParseFile(string, "LoadBiz", .bExtra = true, .extra = i);
        }
    }
    return 1;
}

forward LoadBiz(i);
public LoadBiz(i)
{
    //....
}