Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*////////////////////////////////////////////////////////////////////////////////
- _ ____ _____ __ __
- (_) _ \ ___ |_ _|__ __ _| \/ |
- | | |_) / __| | |/ _ \/ _` | |\/| |
- | | __/\__ \ | | __/ (_| | | | |
- |_|_| |___/ |_|\___|\__,_|_| |_|
- Intelligent Programming Style ®
- ____________________________
- www.ips-team.blogspot.com
- www.ips-team.forumeiros.com
- ____________________________
- Created By DraKiNs & SlashPT
- Thanks to [iPs]TeaM and Jhony
- */////////////////////////////////////////////////////////////////////////////////
- //========= [ Configs of Read/Write Files ] ====================================
- #define maxtag (00128)
- #define maxfile (99999)
- #define maxname (00064)
- //==========[ Defines Funnctions ] =============================================
- #define Fini_Exists fexist
- #define Fini_GetFloat(%0) floatstr(Fini_GetStr(%0))
- //========= [ Variables of Set/Get Ini ] =======================================
- new
- iSource,
- zNormal1,
- fStr[maxtag],
- fTag[maxtag],
- fFile[maxfile],
- File:zFopenFile,
- fName[maxname],
- sSeting[24];
- //===========[ Functions of Fini ]==============================================
- stock Fini_OpenFile(fname[])
- {
- zFopenFile = fopen(fname,io_read);
- while(fread(zFopenFile,fStr)) strins(fFile,fStr,strlen(fFile),maxfile);
- fclose(zFopenFile);
- return format(fName,maxname,"%s",fname);
- }
- stock Fini_SaveFile()
- {
- fremove(fName);
- zFopenFile = fopen(fName,io_write);
- fwrite(zFopenFile,fFile);
- return fclose(zFopenFile);
- }
- stock Fini_CloseFile()
- {
- fFile[0x0] = '\0';
- return fName[0x0] = '\0';
- }
- stock Fini_GetStr(ftag[])
- {
- format(fTag, maxtag, "%s=", ftag);
- iSource = strfind(fFile, fTag, false) + 0x1;
- strmid(fTag, fFile, iSource + strlen(fTag) - 0x1, strfind(fFile, "\n", false, iSource));
- return fTag;
- }
- stock Fini_SetStr(ftag[],fstr[])
- {
- format(fTag,maxtag, "%s=", ftag);
- zNormal1 = strfind(fFile,fTag, true);
- if(zNormal1 != -1)
- {
- strdel(fFile,zNormal1-1, strfind(fFile, "\n", false,zNormal1));
- format(fTag,maxtag, "%s=%s\r\n",ftag,fstr);
- strins(fFile, fTag, strlen(fFile));
- }
- else
- {
- format(fTag,maxtag, "%s=%s\r\n",ftag,fstr);
- strins(fFile,fTag, strlen(fFile));
- }
- return true;
- }
- stock Fini_Create(nFile[])
- {
- if(Fini_Exists(nFile)) return false;
- zFopenFile = fopen(nFile,io_write);
- return fclose(zFopenFile);
- }
- stock Fini_SetVal(ftag[],fval)
- {
- format(sSeting,maxtag,"%d",fval);
- return Fini_SetStr(ftag,sSeting);
- }
- stock Fini_SetFloat(ftag[],Float:fval)
- {
- format(sSeting,maxtag,"%f",fval);
- return Fini_SetStr(ftag,sSeting);
- }
- stock Fini_SetBool(ftag[],bool:fval)
- {
- format(sSeting,maxtag,"%d",fval);
- return Fini_SetStr(ftag,sSeting);
- }
- stock Fini_IsSet(ftag[])
- {
- format(fTag,maxtag,"%s=%s",ftag,Fini_GetStr(ftag));
- zNormal1 = strfind(fFile,ftag,true);
- if(zNormal1 != -1) return true;
- return false;
- }
- stock Fini_GetBool(ftag[])
- {
- return bool:strval(Fini_GetStr(ftag));
- }
- stock Fini_GetValue(ftag[])
- {
- return strval(Fini_GetStr(ftag));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement