y_INI File System Help - Multiple Lines and Values?
#1

Hi guys, i've been out of scripting for a couple of years so I've lost the hang of most of it.. just wondering how I would go about making a system using y_INI that has one file with multiple lines and values, example a property system where all the properties are stored in the one y_INI file with their own ID and values

Edit:
At the moment i've just got it looping through each property and it saves a seperate file for each property but it'd be nice to have them all saved in one file using y_ini
Reply
#2

Y_ini
Reply
#3

Didn't ask for the link to y_ini, it states i'm using y_ini so i think it's obvious i know where the files and information to y_ini is located, how ever I'm unsure on how to work y_ini the way i want to work it (which is obvious if you read my thread).
Reply
#4

use separate Tags for each property using INI_SetTag() function
Reply
#5

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
use separate Tags for each property using INI_SetTag() function
Thanks, I didn't know you could use settag like that, didn't really understand what it was for to be honest. It 50% worked, although I have a property limit of 899, and it only saved from 456, not 1. Here's the code I got:

pawn Код:
stock SaveHouses()
{
    new pathstring[126], tagstring[4];
    format(pathstring, sizeof(pathstring), "houses.ini");
    new INI:File = INI_Open(pathstring);
    for(new i = 1; i < sizeof(HouseData); i++)
    {
        format(tagstring, sizeof(tagstring), "%d", i);
        INI_SetTag(File, tagstring);
        INI_WriteInt(File, "Created", HouseData[i][Created]);
        INI_WriteString(File, "Owner", HouseData[i][Owner]);
        INI_WriteInt(File, "Locked", HouseData[i][Locked]);
        INI_WriteInt(File, "ForSale", HouseData[i][ForSale]);
        INI_WriteInt(File, "Owned", HouseData[i][Owned]);
        INI_WriteInt(File, "ForSaleSign", HouseData[i][ForSaleSign]);
        INI_WriteInt(File, "SalePrice", HouseData[i][SalePrice]);
        INI_WriteInt(File, "ForRent", HouseData[i][ForRent]);
        INI_WriteInt(File, "RentPrice", HouseData[i][RentPrice]);
        INI_WriteFloat(File, "EntranceA", HouseData[i][Entrance][0]);
        INI_WriteFloat(File, "EntranceX", HouseData[i][Entrance][1]);
        INI_WriteFloat(File, "EntranceY", HouseData[i][Entrance][2]);
        INI_WriteFloat(File, "EntranceZ", HouseData[i][Entrance][3]);
        INI_WriteFloat(File, "ExitA", HouseData[i][Exit][0]);
        INI_WriteFloat(File, "ExitX", HouseData[i][Exit][1]);
        INI_WriteFloat(File, "ExitY", HouseData[i][Exit][2]);
        INI_WriteFloat(File, "ExitZ", HouseData[i][Exit][3]);
        INI_WriteString(File, "Address", HouseData[i][Address]);
        INI_WriteFloat(File, "SaleSignA", HouseData[i][ForSaleSignPos][0]);
        INI_WriteFloat(File, "SaleSignX", HouseData[i][ForSaleSignPos][1]);
        INI_WriteFloat(File, "SaleSignY", HouseData[i][ForSaleSignPos][2]);
        INI_WriteFloat(File, "SaleSignZ", HouseData[i][ForSaleSignPos][3]);
        INI_WriteInt(File, "Interior", HouseData[i][Interior]);
        if(HouseData[i][ForSaleSign]) DestroyDynamicObject(HouseData[i][ForSaleSign]);
    }
    INI_Close(File);
    print("SaveHouses finished");
    return 1;
}

Also, how would I go about making a likewise load function where it has multiple tags?
Like I know how to load a file with the tag variable, but how would I make the tag loop like I have with the save function?

So you have:
pawn Код:
INI:other[// tag name goes here but i'd need to loop through HouseData](name[], value[])
{
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)