Quicker way of doing this? - 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: Quicker way of doing this? (
/showthread.php?tid=318668)
Quicker way of doing this? -
2KY - 16.02.2012
pawn Код:
forward LoadFaction_faction(factionid, name[], value[]);
public LoadFaction_faction(factionid, name[], value[])
{
INI_String("Name", facInfo[factionid][facName], 64);
INI_Int("Type", facInfo[factionid][facType]);
INI_String("Rank1", facInfo[factionid][facRank1], 32);
INI_String("Rank2", facInfo[factionid][facRank2], 32);
INI_String("Rank3", facInfo[factionid][facRank3], 32);
INI_String("Rank4", facInfo[factionid][facRank4], 32);
INI_String("Rank5", facInfo[factionid][facRank5], 32);
return true;
}
for( new f = 0; f < MAX_FACTIONS; f++ ) //Reload factions!
{
format(facStr, sizeof(facStr), "RPMod/Factions/%d.ini", f);
if(fexist(facStr))
{
INI_ParseFile(facStr, "LoadFaction_%s", .bExtra = true, .extra = f);
}
}
This function (re)loads all of my faction data in my dynamic faction system, it uses Y_INI because it's faster with large amounts of files and this system (at its very minimum) is set to support 100 separate faction files, so it's needed.
Re: Quicker way of doing this? -
Aldo. - 16.02.2012
Quote:
Originally Posted by 2KY
pawn Код:
forward LoadFaction_faction(factionid, name[], value[]); public LoadFaction_faction(factionid, name[], value[]) { INI_String("Name", facInfo[factionid][facName], 64); INI_Int("Type", facInfo[factionid][facType]); INI_String("Rank1", facInfo[factionid][facRank1], 32); INI_String("Rank2", facInfo[factionid][facRank2], 32); INI_String("Rank3", facInfo[factionid][facRank3], 32); INI_String("Rank4", facInfo[factionid][facRank4], 32); INI_String("Rank5", facInfo[factionid][facRank5], 32); return true; }
for( new f = 0; f < MAX_FACTIONS; f++ ) //Reload factions! { format(facStr, sizeof(facStr), "RPMod/Factions/%d.ini", f); if(fexist(facStr)) { INI_ParseFile(facStr, "LoadFaction_%s", .bExtra = true, .extra = f); } }
This function (re)loads all of my faction data in my dynamic faction system, it uses Y_INI because it's faster with large amounts of files and this system (at its very minimum) is set to support 100 separate faction files, so it's needed.
|
What do you mean by quicker way?
Re: Quicker way of doing this? -
2KY - 16.02.2012
'quicker' I refer to, when I guess it's not the correct terminology. I mean more efficient. A way of doing something so it is executed faster.