Advertisement
MartisK

Notebook // v0.3 © MartynasK

Jan 26th, 2014
410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.15 KB | None | 0 0
  1. /*
  2.  
  3.         NoteBook @ MartynasK
  4.         Už idėją dėkoju *Jamaika
  5.  
  6. */
  7.  
  8. #include <a_samp>
  9. #include <Dini>
  10. #include <zcmd>
  11.  
  12. #define MartynasK       AUTORIUS
  13. #define VERSIJA         "0.3"
  14. #define DIALOG_NOTEBOOK 9001
  15. #define DIALOG_VIEW     9002
  16. #define DIALOG_WRITE    9003
  17.  
  18. public OnFilterScriptInit()
  19. {
  20.         print( "# NoteBook v"VERSIJA" by MartynasK successfully loaded." );
  21.         return 1;
  22. }
  23.  
  24. public OnFilterScriptExit()
  25. {
  26.         print( "# NoteBook v"VERSIJA" by MartynasK successfully unloaded." );
  27.         return 1;
  28. }
  29.  
  30. CMD:uzrasine( playerid )
  31. {
  32.         ShowPlayerDialog( playerid, DIALOG_NOTEBOOK, DIALOG_STYLE_LIST, "UŽRAŠINĖ", "{ff7e7e}> Sukurti naują įrašą\n{ff7e7e}> Peržiūrėti paskutinį įrašą", "Atlikti", "Uždaryti" );
  33.         return true;
  34. }
  35.  
  36. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  37. {
  38.         if( dialogid == DIALOG_NOTEBOOK )
  39.         {
  40.                 if( response )
  41.                 {
  42.                     switch( listitem )
  43.                     {
  44.                         case 0: ShowPlayerDialog( playerid, DIALOG_WRITE, DIALOG_STYLE_INPUT, "NAUJAS ĮRAŠAS", "{ffffff}Įveskite tekstą, kuris bus įrašytas į užrašinę:", "Įrašyti", "Atgal" );
  45.                         case 1:
  46.                         {
  47.                                 new
  48.                                         String  [ 170 ],
  49.                                         uFailas [ 50 ],
  50.                                         Vardas  [ MAX_PLAYER_NAME ];
  51.  
  52.                                 GetPlayerName( playerid, Vardas, MAX_PLAYER_NAME );
  53.                                 format( uFailas, sizeof( uFailas ), "Uzrasines/%s.ini", Vardas );
  54.  
  55.                                 if( !fexist( uFailas ) ) return SendClientMessage( playerid, 0xFFFFFFFF, "[ > ] {ff7e7e}Jūs dar neturite užrašų!" );
  56.  
  57.                                 new
  58.                                         Uzrasas [ 110 ],
  59.                                         YY = dini_Int( uFailas, "Metai" ),
  60.                                         Menesis [ 11 ],
  61.                                         DD = dini_Int( uFailas, "Diena" );
  62.                                    
  63.                     format( Uzrasas, sizeof( Uzrasas ), "%s", dini_Get( uFailas, "Irasas" ) );
  64.                     format( Menesis, sizeof( Menesis ), "%s", dini_Get( uFailas, "Menesis" ) );
  65.  
  66.                                 format( String, sizeof( String ), "{ff7e7e}%i metų %s %i dienos įrašas: \n{ffffff}%s", YY, Menesis, DD, Uzrasas );
  67.                                 ShowPlayerDialog( playerid, DIALOG_VIEW, DIALOG_STYLE_MSGBOX, "UŽRAŠAI", String, "Atgal", "" );
  68.                                 return true;
  69.                         }
  70.             }
  71.         }
  72.         }
  73.  
  74.         else if( dialogid == DIALOG_WRITE )
  75.         {
  76.                 if( !response ) ShowPlayerDialog( playerid, DIALOG_NOTEBOOK, DIALOG_STYLE_LIST, "UŽRAŠINĖ", "{ff7e7e}> Sukurti naują įrašą\n{ff7e7e}> Peržiūrėti paskutinį įrašą", "Atlikti", "Uždaryti" );
  77.                 else if( response )
  78.                 {
  79.                     new
  80.                             Vardas  [ MAX_PLAYER_NAME ],
  81.                             uFailas [ 60 ],
  82.                             Menesio [ 11 ],
  83.                             YY, MM, DD;
  84.  
  85.                     if( strlen( inputtext ) > 100 ) return ShowPlayerDialog( playerid, DIALOG_WRITE, DIALOG_STYLE_INPUT, "NAUJAS ĮRAŠAS", "{ff0000}Įvestas tekstas per ilgas! Didžiausias leistinas simbolių kiekis: 100.\n\n{ffffff}Įveskite tekstą, kuris bus įrašytas į užrašinę:", "Įrašyti", "Atgal" );
  86.                     if( strlen( inputtext ) < 10 ) return ShowPlayerDialog( playerid, DIALOG_WRITE, DIALOG_STYLE_INPUT, "NAUJAS ĮRAŠAS", "{ff0000}Įvestas tekstas per trumpas! Turite įrašyti bent 10 simbolių.\n\n{ffffff}Įveskite tekstą, kuris bus įrašytas į užrašinę:", "Įrašyti", "Atgal" );
  87.  
  88.                     GetPlayerName( playerid, Vardas, MAX_PLAYER_NAME );
  89.                     getdate( YY, MM, DD );
  90.                     format( uFailas, sizeof( uFailas ), "Uzrasines/%s.ini", Vardas );
  91.                
  92.                     if( MM == 1 )       Menesio = "sausio";
  93.             else if( MM == 2 )      Menesio = "vasario";
  94.                 else if( MM == 3 )      Menesio = "kovo";
  95.                 else if( MM == 4 )      Menesio = "balandžio";
  96.                 else if( MM == 5 )      Menesio = "gegužės";
  97.                 else if( MM == 6 )      Menesio = "birželio";
  98.                 else if( MM == 7 )      Menesio = "liepos";
  99.                 else if( MM == 8 )      Menesio = "rugpjūčio";
  100.                 else if( MM == 9 )      Menesio = "rugsėjo";
  101.                 else if( MM == 10 ) Menesio = "spalio";
  102.                 else if( MM == 11 )     Menesio = "lapkričio";
  103.                 else if( MM == 12 )     Menesio = "gruodžio";
  104.                
  105.                     if( !fexist( uFailas ) )
  106.                     {
  107.                             dini_Create( uFailas );
  108.  
  109.                             dini_Set( uFailas, "Irasas", inputtext );
  110.                             dini_IntSet( uFailas, "Metai", YY );
  111.                             dini_Set( uFailas, "Menesis", Menesio );
  112.                             dini_IntSet( uFailas, "Diena", DD );
  113.  
  114.                             SendClientMessage( playerid, 0xFFFFFFFF, "[ > ] {ff7e7e}Įrašas sėkmingai įrašytas!" );
  115.                             return true;
  116.                     }
  117.                     else if( fexist( uFailas ) )
  118.                     {
  119.                             dini_Remove( uFailas );
  120.  
  121.                             dini_Create( uFailas );
  122.  
  123.                             dini_Set( uFailas, "Irasas", inputtext );
  124.                             dini_IntSet( uFailas, "Metai", YY );
  125.                             dini_Set( uFailas, "Menesis", Menesio );
  126.                             dini_IntSet( uFailas, "Diena", DD );
  127.  
  128.                             SendClientMessage( playerid, 0xFFFFFFFF, "[ > ] {ff7e7e}Įrašas sėkmingai pakeistas!" );
  129.                             return true;
  130.                     }
  131.                 }
  132.         }
  133.  
  134.         else if( dialogid == DIALOG_VIEW )
  135.         {
  136.                 if( response ) ShowPlayerDialog( playerid, DIALOG_NOTEBOOK, DIALOG_STYLE_LIST, "UŽRAŠINĖ", "{ff7e7e}> Sukurti naują įrašą\n{ff7e7e}> Peržiūrėti paskutinį įrašą", "Atlikti", "Uždaryti" );
  137.                 return true;
  138.         }
  139.  
  140.         return 1;
  141. }
  142.  
  143. #if !defined MartynasK
  144.     #error Pakeites kreditus autorium netapsi. FilterScript autorius - MartynasK.
  145. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement