Total accounts y_ini
#1

Im new to scripting..

pawn Код:
new total;

    new fileToWrite[] = "AccountID.ini",
    INI:iniFile = INI_Open(fileToWrite);
    INI_WriteInt(iniFile, "total_accs", total++);
    INI_Close(iniFile);

    format(string,sizeof(string),"%s registered an account. Total: %d",name,playerid,total);
    SendClientMessageToAll(-1,string);
It resets to 0 everytime the server restarts
Reply
#2

A: Total should be a Global variable else once the total is saved it will be destroyed and go back to 0 once the total has been saved.

B: You should then load this using INI_Int(), I wont go into too much detail with this as I'm assuming you read the Y_INI Documentation.
Reply
#3

It is global already

pawn Код:
INI_Int("total_accs", total);
undefined symbol 'name'
undefined symbol 'value'
Reply
#4

pawn Код:
INI:name[filetag](name[], value[])
{

}
Name in your case AccountDB or w.e, and you havn't set a tag which means you cannot load the information you put into Y_INI...

Place INI_SetTag(File, "Main"); above the first saving line but after the file is opened.

This would make your tag "Main".

YOu DID read the Y_INI documentation correct? https://sampforum.blast.hk/showthread.php?tid=175565
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)