27.02.2012, 17:49
(
Последний раз редактировалось s3rious; 28.04.2012 в 07:45.
)
s3File - File Reading & Writing
After long time i want to start publish my script's. As first i will show my simple ini system s3File. I know exist much better file system, but is good if you will present yourself.
Version 1.2 changelog:
Код:
token s3 changed to INI - for easier write improved create function - tnx ******
Код:
optimized code added functions: - GetFile - SetFile - WriteHex - ReadHex Rebuilded Close & Load Function Bool is written as True or False (not 0/1)
This ini system was compared with dini. Result - s3File is 5 times faster than dini. Why? Because s3File will write values only one time. Load file -> write(or)read -> Close file. Predefined function for writing and reading has assigned file in global variable and handle with them until the script does not call Close function.
Writing
pawn Код:
INI_Load("myini.ini");
INI_Write("NAME", "s3rious");
INI_WriteInt("TEAM", 0);
INI_Close();
Reading
pawn Код:
INI_Load("myini.ini");
varA = INI_ReadInt("a");
varB = INI_ReadFloat("b");
INI_Close();
Be careful. When you load file make sure if called file exist. For create file you must use INI_Create("file.ini"); function. (with own name of file)
Download:
Version 1.1: http://pastebin.com/MYK5SXmH
Version 1.2: http://pastebin.com/pXd3qZr2
Version 1.4: http://pastebin.com/vJ7andKd
Version 1.5: http://pastebin.com/S7eQb1Sy