SA-MP Forums Archive
Help - 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: Help - INI (/showthread.php?tid=496921)



Help - INI - Fjclip99 - 24.02.2014

Hi, i have one problem!

I have a command /unban that does:

new INI:File = INI_Open(fstring);
INI_WriteInt(File,"Banned",0);
INI_WriteString(File,"Banreason","0");
INI_WriteString(File,"Bantime","0");
INI_WriteString(File,"Banner","0");
INI_Close(File);

But now, in my INI file there are "Banned, Banreason...", but whene i type the command /unban it makes new ones at the top, as shown here: http://prntscr.com/2vf83s


Re: Help - INI - Threshold - 24.02.2014

As I've noticed, you are using tags in your INI whether this was intentional or not. Notice how under the first 'Banner' there is a '[data]' tag? These tags are used to separate your ini variables into customised sections. So in order to put the Banned, BanReason, BanTime etc. under that [data] tag, is simply add this:

pawn Код:
INI_SetTag(File, "data");
So your correct script would be:
pawn Код:
new INI:File = INI_Open(fstring);
INI_SetTag(File, "data");
INI_WriteInt(File,"Banned",0);
INI_WriteString(File,"Banreason","0");
INI_WriteString(File,"Bantime","0");
INI_WriteString(File,"Banner","0");
INI_Close(File);



Re: Help - INI - Fjclip99 - 24.02.2014

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
As I've noticed, you are using tags in your INI whether this was intentional or not. Notice how under the first 'Banner' there is a '[data]' tag? These tags are used to separate your ini variables into customised sections. So in order to put the Banned, BanReason, BanTime etc. under that [data] tag, is simply add this:

pawn Код:
INI_SetTag(File, "data");
So your correct script would be:
pawn Код:
new INI:File = INI_Open(fstring);
INI_SetTag(File, "data");
INI_WriteInt(File,"Banned",0);
INI_WriteString(File,"Banreason","0");
INI_WriteString(File,"Bantime","0");
INI_WriteString(File,"Banner","0");
INI_Close(File);
THANKS, That works great