Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- NoteBook @ MartynasK
- Už idėją dėkoju *Jamaika
- */
- #include <a_samp>
- #include <Dini>
- #include <zcmd>
- #define MartynasK AUTORIUS
- #define VERSIJA "0.3"
- #define DIALOG_NOTEBOOK 9001
- #define DIALOG_VIEW 9002
- #define DIALOG_WRITE 9003
- public OnFilterScriptInit()
- {
- print( "# NoteBook v"VERSIJA" by MartynasK successfully loaded." );
- return 1;
- }
- public OnFilterScriptExit()
- {
- print( "# NoteBook v"VERSIJA" by MartynasK successfully unloaded." );
- return 1;
- }
- CMD:uzrasine( playerid )
- {
- 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" );
- return true;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if( dialogid == DIALOG_NOTEBOOK )
- {
- if( response )
- {
- switch( listitem )
- {
- 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" );
- case 1:
- {
- new
- String [ 170 ],
- uFailas [ 50 ],
- Vardas [ MAX_PLAYER_NAME ];
- GetPlayerName( playerid, Vardas, MAX_PLAYER_NAME );
- format( uFailas, sizeof( uFailas ), "Uzrasines/%s.ini", Vardas );
- if( !fexist( uFailas ) ) return SendClientMessage( playerid, 0xFFFFFFFF, "[ > ] {ff7e7e}Jūs dar neturite užrašų!" );
- new
- Uzrasas [ 110 ],
- YY = dini_Int( uFailas, "Metai" ),
- Menesis [ 11 ],
- DD = dini_Int( uFailas, "Diena" );
- format( Uzrasas, sizeof( Uzrasas ), "%s", dini_Get( uFailas, "Irasas" ) );
- format( Menesis, sizeof( Menesis ), "%s", dini_Get( uFailas, "Menesis" ) );
- format( String, sizeof( String ), "{ff7e7e}%i metų %s %i dienos įrašas: \n{ffffff}%s", YY, Menesis, DD, Uzrasas );
- ShowPlayerDialog( playerid, DIALOG_VIEW, DIALOG_STYLE_MSGBOX, "UŽRAŠAI", String, "Atgal", "" );
- return true;
- }
- }
- }
- }
- else if( dialogid == DIALOG_WRITE )
- {
- 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" );
- else if( response )
- {
- new
- Vardas [ MAX_PLAYER_NAME ],
- uFailas [ 60 ],
- Menesio [ 11 ],
- YY, MM, DD;
- 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" );
- 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" );
- GetPlayerName( playerid, Vardas, MAX_PLAYER_NAME );
- getdate( YY, MM, DD );
- format( uFailas, sizeof( uFailas ), "Uzrasines/%s.ini", Vardas );
- if( MM == 1 ) Menesio = "sausio";
- else if( MM == 2 ) Menesio = "vasario";
- else if( MM == 3 ) Menesio = "kovo";
- else if( MM == 4 ) Menesio = "balandžio";
- else if( MM == 5 ) Menesio = "gegužės";
- else if( MM == 6 ) Menesio = "birželio";
- else if( MM == 7 ) Menesio = "liepos";
- else if( MM == 8 ) Menesio = "rugpjūčio";
- else if( MM == 9 ) Menesio = "rugsėjo";
- else if( MM == 10 ) Menesio = "spalio";
- else if( MM == 11 ) Menesio = "lapkričio";
- else if( MM == 12 ) Menesio = "gruodžio";
- if( !fexist( uFailas ) )
- {
- dini_Create( uFailas );
- dini_Set( uFailas, "Irasas", inputtext );
- dini_IntSet( uFailas, "Metai", YY );
- dini_Set( uFailas, "Menesis", Menesio );
- dini_IntSet( uFailas, "Diena", DD );
- SendClientMessage( playerid, 0xFFFFFFFF, "[ > ] {ff7e7e}Įrašas sėkmingai įrašytas!" );
- return true;
- }
- else if( fexist( uFailas ) )
- {
- dini_Remove( uFailas );
- dini_Create( uFailas );
- dini_Set( uFailas, "Irasas", inputtext );
- dini_IntSet( uFailas, "Metai", YY );
- dini_Set( uFailas, "Menesis", Menesio );
- dini_IntSet( uFailas, "Diena", DD );
- SendClientMessage( playerid, 0xFFFFFFFF, "[ > ] {ff7e7e}Įrašas sėkmingai pakeistas!" );
- return true;
- }
- }
- }
- else if( dialogid == DIALOG_VIEW )
- {
- 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" );
- return true;
- }
- return 1;
- }
- #if !defined MartynasK
- #error Pakeites kreditus autorium netapsi. FilterScript autorius - MartynasK.
- #endif
Advertisement
Add Comment
Please, Sign In to add comment