SA-MP Forums Archive
Total accounts y_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: Total accounts y_ini (/showthread.php?tid=440247)



Total accounts y_ini - jackci - 29.05.2013

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


Re: Total accounts y_ini - IceCube! - 29.05.2013

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.


Re: Total accounts y_ini - jackci - 29.05.2013

It is global already

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


Re: Total accounts y_ini - IceCube! - 29.05.2013

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