SA-MP Forums Archive
Saving strings with Dini - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Saving strings with Dini (/showthread.php?tid=260455)



Saving strings with Dini - [RVRP]Tyler - 09.06.2011

I know Dini is outdated blah blah blah but I'm just practicing with it and I'm having some trouble saving a string with it.

It looks a little something like this:

Код:
enum FactionInformation
{
FactionName[24]
};

new factions[5][FactionInformation];

public SaveFactions
{
      	    dini_Set(file, "Faction 1 Name:", FactionInfo[1][FactionName]);
}

public LoadFactions
{
 blahahahaha
{
	    FactionInfo[1][FactionName] = dini_Get(file, "Faction 1 Name:");
}
Basically, I'm trying to save the faction name as a string but I get the error "Array sizes do not match" on every single one that is supposed to be a string, like that.


Re: Saving strings with Dini - futuretrucker - 09.06.2011

With dini (not sure but) you need to select the file you want to save into first. Also make
pawn Код:
public LoadFactions
into:
pawn Код:
public LoadFactions()



Re: Saving strings with Dini - [RVRP]Tyler - 09.06.2011

Quote:
Originally Posted by futuretrucker
Посмотреть сообщение
With dini (not sure but) you need to select the file you want to save into first. Also make
pawn Код:
public LoadFactions
into:
pawn Код:
public LoadFactions()
I know that obviously.. I said this is just what it looks like I didn't copy my work.


Re: Saving strings with Dini - Mean - 09.06.2011

Change the size of the [24] string to something higher (128, 256...). I'm pretty sure it'll work.

I know it is a waste of memory, but sometimes old methods like this need HUGE strings for nothing.
Before, I used strtok, and I needed always a 256 size tmp. If I put anything lower, bam, that error appears.