Help - INI
#1

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
Reply
#2

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);
Reply
#3

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)