Advertisement
Guest User

Untitled

a guest
Dec 18th, 2013
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.95 KB | None | 0 0
  1. #include < zcmd >
  2. #include < sscanf >
  3.  
  4. // #define USE_DIR // Daca vrei sa se salveze fisierele intr-un anumit folder sterge "//"
  5.  
  6. #if defined USE_DIR
  7.     #define _Dir(%0)    "/Folder/%0" // "Folder" = numele folderului in care vrei sa se salveze
  8. #endif
  9.  
  10. CMD:savecomm( playerid, params[ ] )
  11. {
  12.     new
  13.         szCom[ 100 ],
  14.         szF[ MAX_PLAYER_NAME +5 ],
  15.         szName[ MAX_PLAYER_NAME +1 ]
  16.     ;
  17.    
  18.     GetPlayerName( playerid, szName, sizeof( szName ) );
  19.    
  20.     if( sscanf( params, "s[100]", szCom ) ) return SendClientMessage( playerid, -1, "Syntax: /test <text>");
  21.     {
  22.         format( szF, MAX_PLAYER_NAME +5, "%s.txt", szName );
  23.        
  24.         #if defined USE_DIR
  25.         format( szF, MAX_PLAYER_NAME +10, "_Dir(%s.txt)", szName );
  26.         #endif
  27.        
  28.         if( !fexist( szF ) )
  29.         {
  30.             new
  31.                 File:iFile = fopen( szF, io_write );
  32.                
  33.             fwrite( iFile, szCom );
  34.             fclose( iFile );
  35.         }
  36.         else return SendClientMessage( playerid, -1, "Exista deja.");
  37.     }
  38.     return 1;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement