[Plugin] [REL]tfile 3.0 Best file system!
#1

I present you, my new plugin named tfile 3.0, is based on C++ fstream and it's better than standard file.inc (more characters available)

Why it is better then others file systems?
Almost all to set one value to file must use one function, in my plugin you use one function to save or get unlimited number of data

Functions:

fGetData(const file[], const format[], {Float,_}:...)
Get the data from the file
  • const file[] - name of a file
  • const format[] - list of keys and value types to get from file, see below*
  • {Float,_}:... - arguments to save data from file
Return numbers of getting values from file


fSaveData(const file[], const format[], {Float,_}:...)
Saves data to the file
  • const file[] - name of a file
  • const format[] - the same as fGetData*
  • {Float,_}:... - arguments (values) to save in the file
Returns true if all is correct


fAddData(const file[], const string[], bool:exist = false)
Add data to the file
  • const file[] - name of a file
  • const string[] - text to save in file
  • bool:exist = false - file must exist, default no
Returns true if all is correct


fDeleteData(const file[], const key[])
Deletes the data from the file
  • const file[] - file name
  • const key[] - key or list of keys separated by ,
Returns true if all is correct


fKeyExist(const file[], const key[])
Check if key or keys (max 32) exist in file
  • const file[] - file name
  • const key[] - key or list of keys separated by ,
For one key returns true/false, for more returns number that represented by bits which one key exist or not


fCreate(const file[], const string[])
Creates a file and saves something to him
  • const file[] - file name
  • const string[] - text to save in file
Returns true if all is correct

Additional functions

fConvertTags(const file[], oldtag, newtag)
Convert diverting char
  • const file[] - file name
  • oldtag - old diverting char, for example '='
  • newtag - new diverting char, for example '-'
Returns true if all is correct


fChangeConfig(keytab = '=', nicelook = false, ignorekeycase = false, keysize = 30, linesize = 256)
  • keytab = '=' - diverting char
  • nicelook = false - if true file looks "key = value" is false "key=value"
  • ignorekeycase = false - whether to ignore case when searching for a key in a file
  • keysize = 30 - max length of key name
  • linesize = 256 - max size of one line in file
Returns true if all is correct



*What is the format? i explain the example
pawn Code:
new pass[24], Float:hp, sex = 'F';
GetPlayerHealth(playerid, hp);
fSaveData("test.txt", "Money<d>Pass<s>HP<f>sex<c>", GetPlayerMoney(playerid), pass, hp, sex);
and in file we find:
Quote:

Money=10000
Pass=mama
HP=100.0
sex=F

and the same to get:
pawn Code:
new money, pass[24], Float:hp, sex;
fGetData("test.txt", "Money<d>Pass<s>HP<f>sex<c>", money, pass, hp, sex);
SetPlayerMoney(playerid, money);
SetPlayerHealth(playerid, hp);
<i> or <d> - number
<s> - string, text
<f> - float value
<c> - one char

pawn Code:
new x = fKeyExist("test.txt", "Money,Score,sex,Money");
if(x & 1) // if Money exist
    print("Money exist");

if(x & 2) // if Score exist
    print("Score exist");

if(x & 4) // if sex exist
    print("sex exist");

if(x & 8) // if Money exist
    print("Money exist");
pawn Code:
fDeleteData("test.txt", "Money,sex");
after that file looks:
Quote:

Pass=mama
HP=100.0

pawn Code:
new str[64];
format(str, sizeof str, "Money=%d\nScore=%d\nVIP=1\n", GetPlayerMoney(playerid), GetPlayerScore(playerid));
fAddData("test.txt", str);
Download:
tfile3.inc; Mirror
tfile.dll; Mirror
tfile.so; Mirror

Source Code; Mirror
Reply


Messages In This Thread
[REL]tfile 3.1 Best ini files system #update 16.07.12 - by Terminator3 - 25.06.2012, 19:22
Re: [REL]tfile 3.0 Best file system! - by zgintasz - 25.06.2012, 19:26
Re: [REL]tfile 3.0 Best file system! - by Littlehelper - 25.06.2012, 19:37
Re: [REL]tfile 3.0 Best file system! - by TheArcher - 25.06.2012, 19:58
Re: [REL]tfile 3.0 Best file system! - by Face9000 - 25.06.2012, 20:13
Re : [REL]tfile 3.0 Best file system! - by Vukilore - 25.06.2012, 21:12
Re: Re : [REL]tfile 3.0 Best file system! - by Terminator3 - 25.06.2012, 21:29
Re: [REL]tfile 3.0 Best file system! - by rVar - 25.06.2012, 22:06
Re: [REL]tfile 3.0 Best file system! - by Terminator3 - 25.06.2012, 22:25
Re: Re : [REL]tfile 3.0 Best file system! - by TheArcher - 25.06.2012, 22:34
Re: [REL]tfile 3.0 Best file system! - by Prumpuz - 01.07.2012, 15:41
Re: [REL]tfile 3.0 Best file system! - by KingHual - 01.07.2012, 16:06
Re: [REL]tfile 3.0 Best file system! - by Terminator3 - 01.07.2012, 16:18
Re: [REL]tfile 3.0 Best file system! - by Terminator3 - 01.07.2012, 17:21
Re: [REL]tfile 3.0 Best file system! - by KingHual - 01.07.2012, 18:07
Re: [REL]tfile 3.0 Best file system! - by Kaperstone - 02.07.2012, 15:34
Re: [REL]tfile 3.0 Best file system! - by Niko_boy - 02.07.2012, 16:32
Re: [REL]tfile 3.0 Best file system! - by Edvin - 03.07.2012, 08:30
Re: [REL]tfile 3.0 Best file system! - by Terminator3 - 10.07.2012, 08:56
Re: [REL]tfile 3.0 Best file system! - by NeyMar96 - 16.07.2012, 16:00
Re: [REL]tfile 3.0 Best file system! - by Terminator3 - 16.07.2012, 17:06
Re: [REL]tfile 3.0 Best file system! - by TheArcher - 16.07.2012, 17:17
Re: [REL]tfile 3.0 Best file system! - by Terminator3 - 16.07.2012, 17:24
Re: [REL]tfile 3.0 Best file system! - by NeyMar96 - 16.07.2012, 17:49
Re: [REL]tfile 3.0 Best file system! - by TheArcher - 16.07.2012, 18:04
Re: [REL]tfile 3.0 Best file system! - by Terminator3 - 16.07.2012, 19:11
Re: [REL]tfile 3.0 Best file system! - by NeyMar96 - 16.07.2012, 19:26
Re: [REL]tfile 3.0 Best file system! - by Terminator3 - 16.07.2012, 20:54
Re: [REL]tfile 3.0 Best file system! - by NeyMar96 - 18.07.2012, 12:28
Re: [REL]tfile 3.0 Best file system! - by Terminator3 - 18.07.2012, 13:19
Re: [REL]tfile 3.0 Best file system! - by Prumpuz - 20.07.2012, 20:55
Re: [REL]tfile 3.0 Best file system! - by devil77771 - 24.08.2012, 21:57
Re: [REL]tfile 3.0 Best file system! - by Terminator3 - 24.08.2012, 23:18
Re: [REL]tfile 3.0 Best file system! - by devil77771 - 25.08.2012, 00:46
Re: [REL]tfile 3.0 Best file system! - by Terminator3 - 26.08.2012, 13:52

Forum Jump:


Users browsing this thread: 1 Guest(s)