Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ////////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////////
- ///// //////
- ///// Simple Indent Pawn - Pawn //////
- ///// www.ips-team.blogspot.com //////
- ///// //////
- ///// //////
- ///// Por DraKiNs //////
- ////////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////////
- //Includes
- #include <a_samp>
- //Config Here
- #define iMaxLines (5000)
- #define sFileImport "Startup.txt"
- #define sFileExport "samp.txt"
- new sCode[iMaxLines];
- new sTemp[iMaxLines];
- public OnFilterScriptInit()
- {
- new File:iFile = fopen(sFileImport, io_read);
- while(fread(iFile, sTemp))
- {
- strcat(sCode,sTemp);
- }
- fclose(iFile);
- sIndentCode(sCode);
- return true;
- }
- /*
- =================================================
- Indent Code
- @By iPs DraKiNs
- =================================================
- */
- sIndentCode(sStr[])
- {
- //Indent the Input String
- static
- sOutput[200],
- iCurrentBraces = 0,
- iCurrentChar = 0,
- iCurrentiLines = 0x0;
- new File:iFile = fopen(sFileExport, io_write);
- {
- for(new x = 0x0; sStr[x]; x++)
- {
- iCurrentBraces = ((sStr[x] == 0x7D) ? (iCurrentBraces - 1) : (iCurrentBraces));
- if(iCurrentBraces && !iCurrentiLines)
- {
- for(new i = 0x0; i < iCurrentBraces; i++)
- {
- sOutput[iCurrentChar++] = 0x20;
- sOutput[iCurrentChar++] = 0x20;
- iCurrentiLines++;
- }
- }
- iCurrentBraces = ((sStr[x] == 0x7B) ? (iCurrentBraces + 1) : (iCurrentBraces));
- iCurrentiLines = ((sStr[x] == '\n') ? (0x0) : (iCurrentiLines));
- sOutput[iCurrentChar] = sStr[x];
- fputchar(iFile,sOutput[iCurrentChar]);
- iCurrentChar++;
- }
- }
- fclose(iFile);
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement