Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //______________________________________________________________________________
- /*
- To use this, you need to create one folder named "Converter" in scriptfiles and
- two files named "input.cfg" and "output.cfg" in "Converter" folder.Then, paste
- the strcmp command in "input.cfg", open the server, and in console, write
- "convert".Then, verify the "output.cfg" file.There you will see the zcmd command
- converted.Good luck!
- */
- //______________________________________________________________________________
- #include " a_samp "
- //______________________________________________________________________________
- public OnRconCommand ( cmd [ ] )
- {
- if ( !strcmp ( cmd , "convert" , true ) )
- {
- new
- File:inputfile = fopen ( "Converter/input.cfg" , io_read ) ;
- if ( inputfile )
- {
- new
- inputline [ 800 ] ;
- while ( fread ( inputfile , inputline ) )
- {
- if ( strfind ( inputline , "strcmp" , true ) != -1 )
- {
- new
- zcmdchar = -1 ;
- for ( new p ; p < strlen ( inputline ) ; p++ )
- {
- if ( inputline [ p ] == '/' )
- {
- zcmdchar = p ;
- break ;
- }
- }
- if ( zcmdchar != -1 && inputline [ zcmdchar + 1 ] != '/' )
- {
- new
- File:output ;
- if ( !fexist ( "Converter/output.cfg" ) )
- output = fopen ( "Converter/output.cfg" , io_write ) ;
- else output = fopen ( "Converter/output.cfg" , io_append ) ;
- if ( output )
- {
- new
- command [ 32 ] ;
- format ( command , sizeof ( command ) , "%s" , inputline [ zcmdchar + 1 ] ) ;
- new
- end = strfind ( command , "\"" , true ) ;
- strdel ( command , end , strlen ( command ) ) ;
- new
- findbracket = strfind ( inputline , "{" , true , zcmdchar ) ;
- format ( inputline , sizeof ( inputline ) , "CMD:%s(playerid, params[])" , command ) ;
- if ( findbracket != -1 ) strins ( inputline , "\n{" , strlen ( inputline ) ) ;
- strins ( inputline , "\n" , strlen ( inputline ) ) ;
- fwrite ( output , inputline ) ;
- fclose ( output ) ;
- continue ;
- }
- }
- }
- new
- File:outputfile ;
- if ( !fexist ( "Converter/output.cfg" ) )
- outputfile = fopen ( "Converter/output.cfg" , io_write ) ;
- else outputfile = fopen ( "Converter/output.cfg" , io_append ) ;
- if ( outputfile )
- {
- fwrite ( outputfile , inputline ) ;
- fclose ( outputfile ) ;
- }
- }
- }
- }
- return ( 1 ) ;
- }
- //______________________________________________________________________________
Advertisement
Add Comment
Please, Sign In to add comment