Advertisement
Guest User

FaceBook [Blue-White + Traducere By Xpllor]

a guest
Mar 9th, 2012
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 27.39 KB | None | 0 0
  1. #include <  a_samp  >
  2. #include <  zcmd    >
  3. #include <  sscanf2 >
  4.  
  5. #define COLOR_RED           0xFF0000AA
  6. #define GREEN               0x00FF00AA
  7. #define COLOR_GREY          0xAFAFAFAA
  8. #define COLOR_ORANGE        0xFF9900AA
  9.  
  10. #define ONCONN              12200
  11. #define ONLOG               12300
  12. #define MYFB                1000
  13. #define FB                  12600
  14. #define MOD                 12700
  15. #define AgeSet              12800
  16. #define StatusSet           12900
  17. #define CountrySet          13000
  18. #define SexSet              13100
  19. #define LikesReset          13200
  20. #define ViewsReset          13300
  21. #define OcupationSet        13400
  22. #define PrivacySet          13500
  23. #define DELETE              13600
  24. #define Warning1            13700
  25. #define Warning2            13800
  26. #define OnCreateFaceBook    13900
  27. #define Dialog_LoginFAccount 16000
  28. #define Dialog_LoginFAccount2 17000
  29. #define Dialog_PlayerProfile    18000
  30. #define db_assoc            db:get_field_assoc
  31. #define db:                 db_
  32.  
  33. #define Use_Speed_Text      true
  34.  
  35. new const Languages[ ] = { "Romana", "English", "Polsky", "Slovensky", "Intalia", "Spanish", "Portugese", "German", "Swedish", "Bulgaria", "Arab" };
  36.  
  37. enum pInfo
  38. {
  39.     Age,
  40.     Likes,
  41.     Views,
  42.     Privacy,
  43.     Logged,
  44. };
  45. new P_DATA[ MAX_PLAYERS ][ pInfo ];
  46. new DB:Database;
  47. new pViewing[ MAX_PLAYERS ];
  48. //=============================== [ CallBacks ] ==============================//
  49. public OnFilterScriptInit( )
  50. {
  51.     Database = db:open( "FaceBook.db" );
  52.     db:query( Database, "CREATE TABLE IF NOT EXISTS `FProfiles` (`Nume` TEXT, \
  53.                                                                  `Password` TEXT, \
  54.                                                                  `Age` NUMERIC, \
  55.                                                                  `Sex` TEXT, \
  56.                                                                  `Country` TEXT, \
  57.                                                                  `Likes` NUMERIC, \
  58.                                                                  `Views` NUMERIC, \
  59.                                                                  `Privacy` NUMERIC, \
  60.                                                                  `Status` TEXT, \
  61.                                                                  `Ocupation` TEXT, \
  62.                                                                  `Expiration` TEXT)" );
  63.     return 1;
  64. }
  65. public OnFilterScriptExit( ) return db:close( Database );
  66. public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
  67. {
  68.     if ( dialogid == Dialog_LoginFAccount )
  69.     {
  70.         new DBResult:R, Query[ 256 ], FPassword[ 128 ], Field[ 128 ];
  71.         if ( !response ) return 1;
  72.         if ( sscanf( inputtext, "s[128]", FPassword ) ) return ShowPlayerDialog( playerid, Dialog_LoginFAccount, DIALOG_STYLE_INPUT, "Login your facebook account", "You need to type a password!", "Login", "Cancel" );
  73.         format( Query, sizeof( Query ), "SELECT * FROM `FProfiles` WHERE `Nume` = '%s'", PlayerName2( playerid ) );
  74.         R = db:query( Database, Query );
  75.         if ( R )
  76.         {
  77.             if ( db:num_rows( R ) )
  78.             {
  79.                 new DBResult:R2;
  80.                 format( Query, sizeof( Query ), "SELECT * FROM `FProfiles` WHERE `Nume` = '%s' AND `Password` = '%s'", PlayerName2( playerid ), FPassword );
  81.                 R2 = db:query( Database, Query );
  82.                 if ( db:num_rows( R2 ) )
  83.                 {
  84.                     db:get_field_assoc( R, "Age", Field, 128 );
  85.                     P_DATA[ playerid ][ Age ] = strval( Field );
  86.                     db:get_field_assoc( R, "Likes", Field, 128 );
  87.                     P_DATA[ playerid ][ Likes ] = strval( Field );
  88.                     db:get_field_assoc( R, "Views", Field, 128 );
  89.                     P_DATA[ playerid ][ Views ] = strval( Field );
  90.                     db:get_field_assoc( R, "Privacy", Field, 128 );
  91.                     P_DATA[ playerid ][ Privacy ] = strval( Field );
  92.  
  93.                     new Str[ 128 ];
  94.                     strcat( Str, "{FFFFFF}Te-ai {00C0FF}logat {FFFFFF}cu succes.\n\
  95.                                   {FFFFFF}Daca vrei sa {00C0FF}schimbi {FFFFFF}ceva de pe {00C0FF}face{FFFFFF}book-ul tau\n\
  96.                                   {FFFFFF}alege al doilea {00C0FF}buton{FFFFFF}.\n" );
  97.                     ShowPlayerDialog( playerid, ONLOG, DIALOG_STYLE_MSGBOX, "FaceBook", Str, "MyProfile", "Cancel" );
  98.  
  99.                     P_DATA[ playerid ][ Logged ] = 1;
  100.                 }
  101.                 else return ShowPlayerDialog( playerid, Dialog_LoginFAccount, DIALOG_STYLE_INPUT, "{00C0FF}Logheazate {FFFFFF}pe contul tau de {00C0FF}face{FFFFFF}book", "{FFFFFF}O {00C0FF}eroare {FFFFFF}a fost intampinata.\n{00C0FF}Parola {FFFFFF}invalida, mai incercati odata.", "Login", "Cancel" );
  102.                 db:free_result( R2 );
  103.             }
  104.             else return ShowPlayerDialog( playerid, Dialog_LoginFAccount2, DIALOG_STYLE_MSGBOX, "{00C0FF}Logheazate {FFFFFF}pe contul tau de {00C0FF}face{FFFFFF}book", "{FFFFFF}O {00C0FF}eroare {FFFFFF}a fost intampinata.\n{FFFFFF}Acest user nu are un {00C0FF}cont{FFFFFF}.\n{FFFFFF}Poti sa iti {00C0FF}creezi {FFFFFF}unul apasand pe 'create'.", "Cancel", "Create" );
  105.             db:free_result( R );
  106.         }
  107.     }
  108.     if ( dialogid == Dialog_LoginFAccount2 )
  109.     {
  110.         if ( !response ) return CallRemoteFunction( "OnPlayerCommandText", "is", playerid, "/cfacebook" );
  111.     }
  112.     if ( dialogid == OnCreateFaceBook+1 )
  113.     {
  114.         if ( !response ) return 1;
  115.         SetPVarInt( playerid, "CreatingProfile", 1 );
  116.         ShowPlayerDialog( playerid, StatusSet, DIALOG_STYLE_INPUT, "{00C0FF}Modifica", "{FFFFFF}Insereaza {00C0FF}statusul {FFFFFF}pe care il doresti\n{FFFFFF}sa apara pe profilul tau.", "Change", "Back" );
  117.         return 1;
  118.     }
  119.     if ( dialogid == ONLOG )
  120.     {
  121.         if( !response ) return 1;
  122.         FormatFBDialog( playerid );
  123.     }
  124.     if( dialogid == MYFB )
  125.     {
  126.         if( !response )
  127.         {
  128.             new str[ 312 ];
  129.             strcat( str, "{FFFFFF}Modifica: {00C0FF}Status'ul                \n\
  130.                           {FFFFFF}Modifica: {00C0FF}Ani                      \n\
  131.                           {FFFFFF}Modifica: {00C0FF}Sex'ul                   \n\
  132.                           {FFFFFF}Modifica: {00C0FF}Tara                     \n\
  133.                           {FFFFFF}Reseteaza: {00C0FF}Like'urile              \n\
  134.                           {FFFFFF}Reseteaza: {00C0FF}Vizualizarile profilului\n\
  135.                           {FFFFFF}Modifica: {00C0FF}Ocupatia                 \n\
  136.                           {FFFFFF}Modifica: {00C0FF}Privaturile              \n\
  137.                           {00C0FF}Iesi" );
  138.             ShowPlayerDialog( playerid, MOD, DIALOG_STYLE_LIST, "{00C0FF}Schimbarile Profilului", str, "Alege", "" );
  139.         }
  140.     }
  141.     if ( dialogid == FB )
  142.     {
  143.         new Query[ 256 ], string[ 128 ], Time[ 3 ];
  144.         if ( !response ) return 1;
  145.         if ( P_DATA[ pViewing[ playerid ] ][ Logged ] == 0 ) return SendClientMessage( playerid, COLOR_RED, "{00C0FF}Eroare: {FFFFFF}Player-ul trebuie sa fie logat pentru a primi like'uri." );
  146.        
  147.         format( Query, 256, "SELECT * FROM `FProfiles` WHERE `Nume` = '%s'", PlayerName2( playerid ) );
  148.         new DBResult:R2 = db:query( Database, Query );
  149.         gettime( Time[ 0 ], Time[ 1 ] );
  150.         getdate( .day = Time[ 2 ] );
  151.         if ( R2 )
  152.         {
  153.             if ( db:free_result( R2 ) )
  154.             {
  155.                 new Field[ 64 ], T2[ 3 ];
  156.  
  157.                 db:get_field_assoc( R2, "Expiration", Field, sizeof( Field ) );
  158.                 if ( !isnull( Field ) )
  159.                 {
  160.                     sscanf( Field, "p<|>iii", Time[ 2 ], Time[ 0 ], Time[ 1 ] );
  161.  
  162.                     gettime( T2[ 0 ], T2[ 1 ] );
  163.                     getdate( .day = T2[ 2 ] );
  164.  
  165.                     if ( Time[ 0 ] == 0 ) Time[ 0 ] = 24;
  166.                     if ( T2[ 2 ] == Time[ 2 ] )
  167.                     {
  168.                         if ( T2[ 0 ] == Time[ 0 ] )
  169.                         {
  170.                             if ( T2[ 1 ] < Time[ 1 ] )
  171.                             {
  172.                                 SendClientMessage( playerid, COLOR_RED, "{00C0FF}Eroare: {FFFFFF}Poti da 1 like/ora." );
  173.                                 format( string, sizeof( string ), "{FFFFFF}Poti {00C0FF}repeta {FFFFFF}procesul dupa {00C0FF}%d:%d !", Time[ 0 ], Time[ 1 ] );
  174.                                 SendClientMessage( playerid, COLOR_RED, string );
  175.                                 return 1;
  176.                             }
  177.                         }
  178.                         else if ( T2[ 0 ] < Time[ 0 ] )
  179.                         {
  180.                             SendClientMessage( playerid, COLOR_RED, "{00C0FF}Eroare: {FFFFFF}Poti da 1 like/ora." );
  181.                             format( string, sizeof( string ), "{FFFFFF}Poti {00C0FF}repeta {FFFFFF}procesul dupa {00C0FF}%d:%d !", Time[ 0 ], Time[ 1 ] );
  182.                             SendClientMessage( playerid, COLOR_RED, string );
  183.                             return 1;
  184.                         }
  185.                     }
  186.                 }
  187.                 format( Query, sizeof( Query ), "UPDATE `FProfiles` SET `Expiration` = '%d|%d|%d' WHERE `Nume` = '%s'", Time[ 2 ], ( Time[ 0 ] == 23 ) ? (0) : ( Time[ 0 ] + 1 ), Time[ 1 ], PlayerName2( playerid ) );
  188.                 db:query( Database, Query );
  189.             }
  190.             else db:free_result( R2 );
  191.         }
  192.         P_DATA[ pViewing[ playerid ] ][ Likes ]++;
  193.         GameTextForPlayer( playerid, "~w~Profil ~r~Like!", 5000, 5 );
  194.  
  195.         format( string, sizeof ( string ), "{00C0FF}Face{FFFFFF}book: {00C0FF}%s (ID:%d) {FFFFFF}i-a dat un {00C0FF}like {FFFFFF}lui {00C0FF}%s (ID:%d){FFFFFF} pe {00C0FF}Face{FFFFFF}book.", PlayerName2( playerid ), playerid, PlayerName2( pViewing[ playerid ] ), pViewing[ playerid ] );
  196.         SendClientMessageToAll( COLOR_GREY, string );
  197.     }
  198.     if ( dialogid == DELETE )
  199.     {
  200.         if ( !response ) return 1;
  201.        
  202.         new Query[ 256 ];
  203.         format( Query, sizeof( Query ), "DELETE FROM `FProfiles` WHERE `Nume` = '%s'", PlayerName2( playerid ) );
  204.         db:query( Database, Query );
  205.         SendClientMessage( playerid, COLOR_RED, "{FFFFFF}Ti-ai sters cu succes contul de {00C0FF}Face{FFFFFF}book." );
  206.         P_DATA[ playerid ][ Logged ] = 0;
  207.     }
  208.     if ( dialogid == MOD )
  209.     {
  210.         if ( response )
  211.         {
  212.             if ( listitem == 0 )
  213.             {
  214.                 ShowPlayerDialog( playerid, StatusSet, DIALOG_STYLE_INPUT, "{00C0FF}Modifica", "{FFFFFF}Adauga ce {00C0FF}status {FFFFFF}doresti tu sa\n{FFFFFF}apara pe profil:", "Schimba", "Inapoi" );
  215.             }
  216.             if ( listitem == 1 )
  217.             {
  218.                 ShowPlayerDialog( playerid, AgeSet, DIALOG_STYLE_INPUT, "{00C0FF}Modifica", "{FFFFFF}Te rog, adauga-ti {00C0FF}varsta {FFFFFF}mai jos.", "Schimba", "Inapoi" );
  219.             }
  220.             if ( listitem == 2 )
  221.             {
  222.                 ShowPlayerDialog( playerid, SexSet, DIALOG_STYLE_LIST, "{00C0FF}Alege'ti sexul", "{FFFFFF}Barbat\n{FFFFFF}Femeie", "Schimba", "Inapoi" );
  223.             }
  224.             if ( listitem == 3 )
  225.             {
  226.                 ShowPlayerDialog( playerid, CountrySet, DIALOG_STYLE_LIST, "{00C0FF}Modifica", "Romana\nEnglish\nPolsky\nSlovensky\nIntalia\nSpanish\nPortugese\nGerman\nSwedish\nBulgaria\nArab", "Schimba", "Inapoi" );
  227.             }
  228.             if ( listitem == 4 )
  229.             {
  230.                 ShowPlayerDialog( playerid, Warning1, DIALOG_STYLE_INPUT, "{00C0FF}Reseteaza", "{00C0FF}ATENTIE!: {FFFFFF}Esti sigur ca vrei sa resetezi {00C0FF}like-urile {FFFFFF}de pe {00C0FF}Face{FFFFFF}Book?", "Da", "Nu/Inapoi" );
  231.             }
  232.             if ( listitem == 5 )
  233.             {
  234.                 ShowPlayerDialog( playerid, Warning2, DIALOG_STYLE_INPUT, "{00C0FF}Reseteaza", "{00C0FF}ATENTIE!: {FFFFFF}Esti sigur ca vrei sa resetezi {00C0FF}like-urile {FFFFFF}de pe {00C0FF}Face{FFFFFF}Book?", "Da", "Nu/Inapoi" );
  235.             }
  236.             if ( listitem == 6 )
  237.             {
  238.                 ShowPlayerDialog( playerid, OcupationSet, DIALOG_STYLE_INPUT, "{00C0FF}Modifica", "{FFFFFF}Te rog, scrie mai jos ce {00C0FF}ocupatie {FFFFFF}ai.\n{FFFFFF}Exemplu: Dansatul", "Schimba", "Inapoi" );
  239.             }
  240.             if ( listitem == 7 )
  241.             {
  242.                 ShowPlayerDialog( playerid, PrivacySet, DIALOG_STYLE_INPUT, "{00C0FF}Modifica", "{FFFFFF}Te rog, scrie {00C0FF}0 {FFFFFF}daca vrei ca playeri sa-ti vada profilul\n{FFFFFF}sau scrie {00C0FF}1 {FFFFFF}ca profilul sa fie privat.", "Schimba", "Inapoi" );
  243.             }
  244.             if ( listitem == 8 )
  245.             {
  246.                 return 1;
  247.             }
  248.         }
  249.         else
  250.         {
  251.             new str[ 312 ];
  252.             strcat( str, "{FFFFFF}Modifica: {00C0FF}Status'ul                \n\
  253.                           {FFFFFF}Modifica: {00C0FF}Ani                      \n\
  254.                           {FFFFFF}Modifica: {00C0FF}Sex'ul                   \n\
  255.                           {FFFFFF}Modifica: {00C0FF}Tara                     \n\
  256.                           {FFFFFF}Reseteaza: {00C0FF}Like'urile              \n\
  257.                           {FFFFFF}Reseteaza: {00C0FF}Vizualizarile profilului\n\
  258.                           {FFFFFF}Modifica: {00C0FF}Ocupatia                 \n\
  259.                           {FFFFFF}Modifica: {00C0FF}Privaturile              \n\
  260.                           {00C0FF}Iesi" );
  261.             ShowPlayerDialog( playerid, MOD, DIALOG_STYLE_LIST, "{00C0FF}Schimbarile Profilului", str, "Alege", "" );
  262.         }
  263.         return 1;
  264.     }
  265.     if ( dialogid == StatusSet )
  266.     {
  267.         if ( !response ) return FormatFBDialog( playerid );
  268.  
  269.         new Query[ 256 ];
  270.         format( Query, sizeof( Query ), "UPDATE `FProfiles` SET `Status` = '%s' WHERE `Nume` = '%s'", inputtext, PlayerName2( playerid ) );
  271.         db:query( Database, Query );
  272.         GameTextForPlayer( playerid, "~r~Status ~w~ Setat!", 5000,5 );
  273.         if ( GetPVarInt( playerid, "CreatingProfile" ) == 1 )
  274.         {
  275.             ShowPlayerDialog( playerid, AgeSet, DIALOG_STYLE_INPUT, "{00C0FF}Modifica", "{FFFFFF}Te rog introduceti {00C0FF}varsta {FFFFFF}mai jos:", "Schimba", "Inapoi" );
  276.         }
  277.         return 1;
  278.     }
  279.     if ( dialogid == AgeSet )
  280.     {
  281.         if ( !response ) return FormatFBDialog( playerid );
  282.         if ( sscanf( inputtext, "i", inputtext[ 0 ] ) ) return ShowPlayerDialog( playerid, AgeSet, DIALOG_STYLE_INPUT, "{00C0FF}Modifica", "{FFFFFF}Te rog insereaza {00C0FF}o valoare {FFFFFF}corecta:", "Urmatoarea", "Cancel" );
  283.         if ( inputtext[ 0 ] < 0 || inputtext[ 0 ] > 99 ) return ShowPlayerDialog( playerid, DIALOG_STYLE_INPUT, AgeSet, "{00C0FF}Modifica", "{00C0FF}Eroare: {FFFFFF}Nu cred ca ai mai putin de 0 ani sau mai mult de 99 de ani.", "Urmatoarea", "Cancel" );
  284.        
  285.         new Query[ 256 ];
  286.         format( Query, sizeof( Query ), "UPDATE `FProfiles` SET `Age` = '%d' WHERE `Nume` = '%s'", inputtext[ 0 ], PlayerName2( playerid ) );
  287.         db:query( Database, Query );
  288.         GameTextForPlayer( playerid, "~r~Age ~w~Set!", 5000,5 );
  289.         P_DATA[ playerid ][ Age ] = inputtext[ 0 ];
  290.         if ( GetPVarInt( playerid, "CreatingProfile" ) == 1 )
  291.         {
  292.             ShowPlayerDialog( playerid, SexSet, DIALOG_STYLE_LIST, "{00C0FF}Selecteazati sexul", "{FFFFFF}Barbat\n{FFFFFF}Femeie", "Schimba", "Inapoi" );
  293.         }
  294.         return 1;
  295.     }
  296.     if ( dialogid == SexSet )
  297.     {
  298.         if ( !response ) return FormatFBDialog( playerid );
  299.         if ( listitem == 0 )
  300.         {
  301.             new Query[ 256 ];
  302.             format( Query, sizeof( Query ), "UPDATE `FProfiles` SET `Sex` = 'Male' WHERE `Nume` = '%s'", PlayerName2( playerid ) );
  303.             db:query( Database, Query );
  304.             GameTextForPlayer( playerid, "~r~Sex ~w~Set!", 5000, 5 );
  305.             if ( GetPVarInt( playerid, "CreatingProfile" ) == 1 )
  306.             {
  307.                 ShowPlayerDialog( playerid, CountrySet, DIALOG_STYLE_LIST, "{00C0FF}Modifica", "Romana\nEnglish\nPolsky\nSlovensky\nIntalia\nSpanish\nPortugese\nGerman\nSwedish\nBulgaria\nArab", "Schimba", "Inapoi" );
  308.             }
  309.         }
  310.         if ( listitem == 1 )
  311.         {
  312.             new Query[ 256 ];
  313.             format( Query, sizeof( Query ), "UPDATE `FProfiles` SET `Sex` = 'Female' WHERE `Nume` = '%s'", PlayerName2( playerid ) );
  314.             db:query( Database, Query );
  315.             GameTextForPlayer( playerid, "~r~Sex ~w~Set!", 5000, 5 );
  316.             if ( GetPVarInt( playerid, "CreatingProfile" ) == 1 )
  317.             {
  318.                 ShowPlayerDialog( playerid, CountrySet, DIALOG_STYLE_LIST, "{FF9900}Modify", "Romana\nEnglish\nPolsky\nSlovensky\nIntalia\nSpanish\nPortugese\nGerman\nSwedish\nBulgaria\nArab", "Schimba", "Inapoi" );
  319.             }
  320.         }
  321.         return 1;
  322.     }
  323.     if ( dialogid == CountrySet )
  324.     {
  325.         if ( !response ) return FormatFBDialog( playerid );
  326.  
  327.         new Query[ 256 ];
  328.         format( Query, sizeof( Query ), "UPDATE `FProfiles` SET `Country` = '%s' WHERE `Nume` = '%s'", Languages[ listitem ], PlayerName2( playerid ) );
  329.         db:query( Database, Query );
  330.         GameTextForPlayer( playerid, "~r~Your country have been ~w~Set!", 5000, 5 );
  331.         if ( GetPVarInt( playerid, "CreatingProfile" ) == 1 )
  332.         {
  333.             ShowPlayerDialog( playerid, OcupationSet, DIALOG_STYLE_INPUT, "{00C0FF}Modifica", "{FFFFFF}Scrie mai jos {00C0FF}ocupatia {FFFFFF}ta\n{FFFFFF}Exemplu: {00C0FF}Dansez", "Schimba", "Inapoi" );
  334.         }
  335.         return 1;
  336.     }
  337.     if ( dialogid == Warning1 )
  338.     {
  339.         if ( !response ) return FormatFBDialog( playerid );
  340.         new Query[ 256 ];
  341.         format( Query, sizeof( Query ), "UPDATE `FProfiles` SET `Likes` = '0' WHERE `Nume` = '%s' ", PlayerName2( playerid ) );
  342.         db:query( Database, Query );
  343.  
  344.         ShowPlayerDialog( playerid, DIALOG_STYLE_MSGBOX, LikesReset, "{00C0FF}Reseteaza", "{FFFFFF}Ti-ai {00C0FF}resetat {FFFFFF}likeurile", "Inapoi", "" );
  345.         P_DATA[ playerid ][ Likes ] = 0;
  346.         return 1;
  347.     }
  348.     if ( dialogid == Warning2 )
  349.     {
  350.         if ( !response ) return FormatFBDialog( playerid );
  351.         new Query[ 256 ];
  352.         format( Query, sizeof( Query ), "UPDATE `FProfiles` SET `Views` = '0' WHERE `Nume` = '%s' ", PlayerName2( playerid ) );
  353.         db:query( Database, Query );
  354.  
  355.         ShowPlayerDialog( playerid, ViewsReset, DIALOG_STYLE_MSGBOX, "{00C0FF}Reseteaza", "{FFFFFF}Ti-ai {00C0FF}resetat {FFFFFF}vizualizarile profilului", "Inapoi", "" );
  356.         P_DATA[ playerid ][ Views ] = 0;
  357.         return 1;
  358.     }
  359.     if ( dialogid == OcupationSet )
  360.     {
  361.         if ( !response ) return FormatFBDialog( playerid );
  362.         new Query[ 256 ];
  363.         format( Query, sizeof( Query ), "UPDATE `FProfiles` SET `Ocupation` = '%s' WHERE `Nume` = '%s'", inputtext, PlayerName2( playerid ) );
  364.         db:query( Database, Query );
  365.         GameTextForPlayer( playerid, "~r~Ocupatia a fost ~w~Setata!", 5000, 5 );
  366.         if ( GetPVarInt( playerid, "CreatingProfile" ) == 1 )
  367.         {
  368.             ShowPlayerDialog( playerid, PrivacySet, DIALOG_STYLE_INPUT, "{00C0FF}Modifica", "{FFFFFF}Daca vrei ca profilul sa fie {00C0FF}public {FFFFFF}scrie {00C0FF}0{FFFFFF}.\n{FFFFFF}Daca vrei ca profilul sa fie {00C0FF}privat {FFFFFF}scrie {00C0FF}1{FFFFFF}.", "Change", "Back" );
  369.         }
  370.         return 1;
  371.     }
  372.     if ( dialogid == PrivacySet )
  373.     {
  374.         if ( !response ) return FormatFBDialog( playerid );
  375.         if ( sscanf( inputtext, "i", inputtext[ 0 ] ) ) return ShowPlayerDialog( playerid, PrivacySet, DIALOG_STYLE_INPUT, "{FF9900}Modify", "{FF0000}Please type only numbers in the dialog!", "Change", "Back" );
  376.         if ( inputtext[ 0 ] < 0 || inputtext[ 0 ] > 1 ) return ShowPlayerDialog( playerid, PrivacySet, DIALOG_STYLE_INPUT, "{FF9900}Modify", "{FF0000}ERROR!: Type values between 1 and 0\n{FFFFFF}{FF0000}Please type 0 to player can watch your profile\nor type 1 to can't watch your profile!", "Change", "Back" );
  377.  
  378.         new Query[ 256 ];
  379.         format( Query, sizeof( Query ), "UPDATE `FProfiles` SET `Privacy` = '%d' WHERE `Nume` = '%s'", inputtext[ 0 ], PlayerName2( playerid ) );
  380.         db:query( Database, Query );
  381.         GameTextForPlayer( playerid, "~r~Privatul profilului tau a fost ~w~Setata!", 5000, 5 );
  382.         P_DATA[ playerid ][ Privacy ] = inputtext[ 0 ];
  383.         return 1;
  384.     }
  385.     if ( dialogid == OnCreateFaceBook )
  386.     {
  387.         if ( !response ) return 1;
  388.         new FPassword[ 128 ];
  389.         if ( sscanf( inputtext, "s[128]", FPassword ) ) return ShowPlayerDialog( playerid, OnCreateFaceBook, 1, "{FF9900}New profile", "You need to type a password for create your facebook account!", "Proced", "Cancel" );
  390.         if ( strlen( FPassword ) < 3 || strlen( FPassword ) > 24 ) return ShowPlayerDialog( playerid, OnCreateFaceBook, 1, "{FF9900}New profile", "Password is need to be between 3 and 24 caracters!", "Proced", "Cancel" );
  391.  
  392.         new Query[ 256 ], str[ 256 ];
  393.        
  394.         format( Query, sizeof( Query ), "INSERT INTO `FProfiles` VALUES('%s','%s','N/A','N/A','N/A','0','0','0','N/A','N/A','00|00|00')", PlayerName2( playerid ), FPassword );
  395.         db:query( Database, Query );
  396.  
  397.         P_DATA[ playerid ][ Logged ] = 1;
  398.         SendClientMessage( playerid, GREEN, "{FFFFFF}Te-ai {00C0FF}inregistrat {FFFFFF}cu succes. Te rog urmareste {00C0FF}instructiunile {FFFFF}pentru a seta: {00C0FF}statusul, ani, sexul..etc" );
  399.         format( str, sizeof( str ), "{FFFFFF}Contul tau de {00C0FF}Face{FFFFFF}Book a fost creat cu:\n{00C0FF}Username - {FFFFFF}%s\n{00C0FF}Parola - {FFFFFF}%s.\n\nPentru a schimba setarile apasa pe butonul {00C0FF}Settings{FFFFFF}.", PlayerName2( playerid ), FPassword );
  400.         ShowPlayerDialog( playerid, OnCreateFaceBook+1, DIALOG_STYLE_MSGBOX, "{00C0FF}Face{FFFFFF}Book", str, "Settings", "Cancel" );
  401.     }
  402.     return 1;
  403. }
  404. public OnPlayerConnect( playerid )
  405. {
  406.     new Query[ 256 ], DBResult:R;
  407.  
  408.     format( Query, sizeof( Query ), "SELECT * FROM `FProfiles` WHERE `Nume` = '%s'", PlayerName2( playerid ) );
  409.     R = db:query( Database, Query );
  410.     if ( R )
  411.     {
  412.         if ( db:num_rows( R ) )
  413.         {
  414.             SendClientMessage( playerid, COLOR_RED, "{00C0FF}INFO: {FFFFFF}Tu ai cont de FaceBook, logheazate cu /flogin [parola]" );
  415.         }
  416.         else
  417.         {
  418.             SendClientMessage( playerid, COLOR_RED, "{00C0FF}INFO: {FFFFFF}Tu nu ai cont de FaceBook, daca vrei creaza unul cu /cfacebook" );
  419.         }
  420.         db:free_result( R );
  421.     }
  422.  
  423.     P_DATA[ playerid ][ Age ] = 0;
  424.     P_DATA[ playerid ][ Likes ] = 0;
  425.     P_DATA[ playerid ][ Views ] = 0;
  426.     P_DATA[ playerid ][ Privacy ] = 0;
  427.     P_DATA[ playerid ][ Logged ] = 0;
  428.     #if defined Use_Speed_Text
  429.     #endif
  430.     return 1;
  431. }
  432. public OnPlayerDisconnect( playerid, reason )
  433. {
  434.     new Query[ 256 ] ;
  435.     format( Query, sizeof( Query ), "UPDATE `FProfiles` SET `Likes` = '%d', `Views` = '%d' WHERE `Nume` = '%s'", P_DATA[ playerid ][ Likes ], P_DATA[ playerid ][ Views ], PlayerName2( playerid ) );
  436.     db:query( Database, Query );
  437.     P_DATA[ playerid ][ Logged ] = 0;
  438.     return 1;
  439. }
  440. //============================= [ Commands ] =================================//
  441. CMD:cfacebook( playerid, params[ ] )
  442. {
  443.     new Query[ 256 ], DBResult:R;
  444.     if ( P_DATA[ playerid ][ Logged ] == 1 ) return SendClientMessage( playerid, COLOR_RED, "{FFFFFF}Tu ai deja cont de {00C0FF}Face{FFFFFF}Book si esti logat pe el." );
  445.  
  446.     format( Query, sizeof( Query ), "SELECT * FROM `FProfiles` WHERE `Nume` = '%s'", PlayerName2( playerid ) );
  447.     R = db:query( Database, Query );
  448.     if ( R )
  449.     {
  450.         if ( db:num_rows( R ) )
  451.         {
  452.             SendClientMessage( playerid, COLOR_RED, "{00C0FF}Eroare: {FFFFFF}Deja ai cont, logheazate cu /flogin [parola]" );
  453.         }
  454.         else
  455.         {
  456.             new str[ 256 ];
  457.             format( str, sizeof( str ), "{FFFFFF}Salut {00C0FF}%s{FFFFFF}, acesta este un dialog care te va ajuta la creerea\n\
  458.                                          {FFFFFF}propiului tau cont de FaceBook\n\n\
  459.                                          {FFFFFF}Te rog scrie {00C0FF}parola {FFFFFF}care o dorest la profil::", PlayerName2( playerid ) );
  460.             ShowPlayerDialog( playerid, OnCreateFaceBook, 1, "{FF9900}New profile", str, "Gata", "Cancel" );
  461.         }
  462.     }
  463.     return 1;
  464. }
  465. CMD:facebook( playerid, params[ ] )
  466. {
  467.     new Player, str[ 256 ], str2[ 512 ];
  468.     if ( sscanf( params, "u", Player ) )
  469.     {
  470.         if ( P_DATA[ playerid ][ Logged ] == 0 ) return SendClientMessage( playerid, COLOR_RED, "{00C0FF}Eroare: {FFFFFF}Trebuie sa fii logat in contul de FaceBook, scrie /flogin [parola]" );
  471.         FormatFBDialog( playerid );
  472.         SendClientMessage( playerid, COLOR_GREY, "{FFFFFF}Te uiti la {00C0FF}Face{FFFFFF}Book-ul tau, poti vizualiza {00C0FF}Face{FFFFFF}Book-ul unui player scriind {00C0FF}/facebook [PlayerID]" );
  473.     }
  474.     else
  475.     {
  476.         if ( Player == playerid )
  477.         {
  478.             FormatFBDialog( playerid );
  479.             SendClientMessage( playerid, COLOR_GREY, "{FFFFFF}Te uiti la {00C0FF}Face{FFFFFF}Book-ul tau, poti vizualiza {00C0FF}Face{FFFFFF}Book-ul unui player scriind {00C0FF}/facebook [PlayerID]" );
  480.         }
  481.         else
  482.         {
  483.             new Query[ 256 ], DBResult:R, DBResult:R2, pField[ 4 ][ 128 ];
  484.             if ( !IsPlayerConnected( Player ) ) return SendClientMessage( playerid, COLOR_RED, "{00C0FF}Eroare: {FFFFFF}Player-ul nu este conectat." );
  485.             if ( P_DATA[ Player ][ Privacy ] == 1 ) return SendClientMessage( playerid, COLOR_RED, "{FFFFFF}Acest player are contul {00C0FF}privat{FFFFFF}." );
  486.  
  487.             format( Query, sizeof( Query ), "SELECT * FROM `FProfiles` WHERE `Nume` = '%s'", PlayerName2( Player ) );
  488.             R2 = db:query( Database, Query );
  489.             if ( R2 )
  490.             {
  491.                 if ( db:num_rows( R2 ) )
  492.                 {
  493.                     format( Query, sizeof( Query ), "SELECT `Status`, `Sex`, `Country`, `Ocupation` FROM `FProfiles` WHERE `Nume` = '%s'", PlayerName2( playerid ) );
  494.                     R = db:query( Database, Query );
  495.                     if ( R )
  496.                     {
  497.                         if ( db:num_rows( R ) )
  498.                         {
  499.                             db:get_field_assoc( R, "Status", pField[ 0 ], 128 );
  500.                             db:get_field_assoc( R, "Sex", pField[ 1 ], 128 );
  501.                             db:get_field_assoc( R, "Country", pField[ 2 ], 128 );
  502.                             db:get_field_assoc( R, "Ocupation", pField[ 3 ], 128 );
  503.                             format( str, sizeof( str ), "{00C0FF}Face{FFFFFF}Book-ul lui %s\n\n\
  504.                                                          {00C0FF}Status: {FFFFFF}%s\n\
  505.                                                          {00C0FF}Ani: {FFFFFF}%d\n\
  506.                                                          {00C0FF}Sex: {FFFFFF}%s\n\
  507.                                                          {00C0FF}Tara: {FFFFFF}%s\n", PlayerName2( Player ), pField[ 0 ], P_DATA[ Player ][ Age ], pField[ 1 ], pField[ 2 ] );
  508.                             format( str2, sizeof( str2 ), "{00C0FF}Likeurile lui %s: {FFFFFF}%d\n\
  509.                                                          {00C0FF}Vizualizarile Profilului: {FFFFFF}%d\n\
  510.                                                          {00C0FF}Ocupatie: {FFFFFF}%s\n\
  511.                                                          {00C0FF}Privacitatea Contului: {FFFFFF}%d\n", str, P_DATA[ Player ][ Likes ], P_DATA[ Player ][ Views ], pField[ 3 ], P_DATA[ Player ][ Privacy ] );
  512.                             ShowPlayerDialog( playerid, FB, DIALOG_STYLE_MSGBOX, "{00C0FF}Face{FFFFFF}Book", str2, "Like", "Cancel" );
  513.                             pViewing[ playerid ] = Player;
  514.                             P_DATA[ Player ][ Views ]++;
  515.                         }
  516.                         else db:free_result( R );
  517.                     }
  518.                 }
  519.                 else return SendClientMessage( playerid, COLOR_RED, "{00C0FF}Eroare: {FFFFFF}Acest user nu are cont de {00C0FF}Face{FFFFFF}Book." );
  520.             }
  521.         }
  522.     }
  523.     return 1;
  524. }
  525. CMD:flogin( playerid, params[ ] )
  526. {
  527.     if ( P_DATA[ playerid ][ Logged ] == 1 ) return SendClientMessage( playerid, COLOR_RED, "{FFFFFF}Deja esti logat pe contul tau de {00C0FF}Face{FFFFFF}Book." );
  528.  
  529.     ShowPlayerDialog( playerid, Dialog_LoginFAccount, DIALOG_STYLE_INPUT, "{FFFFFF}Logare {00C0FF}Face{FFFFFF}Book", "{FFFFFF}Salut,\n{FFFFFF}Te rog scrie parola contului de {00C0FF}Face{FFFFFF}Book, pentru a te loga pe el:", "Login", "Cancel" );
  530.     return 1;
  531. }
  532. CMD:dfacebook( playerid, params[ ] )
  533. {
  534.     new Query[ 256 ], DBResult:R;
  535.  
  536.     format( Query, sizeof( Query ), "SELECT * FROM `FProfiles` WHERE `Nume` = '%s'", PlayerName2( playerid ) );
  537.     R = db:query( Database, Query );
  538.     if ( db:num_rows( R ) )
  539.     {
  540.         if ( P_DATA[ playerid ][ Logged ] == 1 )
  541.         {
  542.             ShowPlayerDialog( playerid, DELETE, DIALOG_STYLE_MSGBOX, "{FFFFFF}Stergerea contului {00C0FF}Face{FFFFFF}Book.", "{FFFFFF}Esti sigur ca vrei sa stergi profilul de {00C0FF}Face{FFFFFF}Book?\n\n{00C0FF}Atentie: {FFFFFF}Toate detaliile vor fi sterse!\n{00C0FF}Continui?", "Da", "Nu" );
  543.         }
  544.         else
  545.         {
  546.             SendClientMessage( playerid, COLOR_RED, "{00C0FF}Eroare: {FFFFFF}Trebuie sa fii logat pe profil pentru al putea sterge" );
  547.             SendClientMessage( playerid, COLOR_RED, "{00C0FF}Foloseste: {FFFFFF}/flogin [parola]" );
  548.         }
  549.     }
  550.     else return SendClientMessage( playerid, COLOR_RED, "{FFFFFF}Tu nu ai cont de {00C0FF}Face{FFFFFF}Book, pentru ati creea unul scrie /cfacebook!" );
  551.     return 1;
  552. }
  553. //=============================== [ Stock's ] ================================//
  554. stock FormatFBDialog( playerid )
  555. {
  556.     new Query[ 256 ], str[ 256 ], str2[ 512 ], DBResult:R, pField[ 4 ][ 128 ];
  557.     format( Query, sizeof( Query ), "SELECT `Status`, `Sex`, `Country`, `Ocupation` FROM `FProfiles` WHERE `Nume` = '%s'", PlayerName2( playerid ) );
  558.     R = db:query( Database, Query );
  559.     if ( R )
  560.     {
  561.         if ( db:num_rows( R ) )
  562.         {
  563.             db:get_field_assoc( R, "Status", pField[ 0 ], 128 );
  564.             db:get_field_assoc( R, "Sex", pField[ 1 ], 128 );
  565.             db:get_field_assoc( R, "Country", pField[ 2 ], 128 );
  566.             db:get_field_assoc( R, "Ocupation", pField[ 3 ], 128 );
  567.             format( str, sizeof( str ), "{00C0FF}Profilul Tau\n\n\
  568.                                          {00C0FF}Status: {FFFFFF}%s\n\
  569.                                          {00C0FF}Ani: {FFFFFF}%d\n\
  570.                                          {00C0FF}Sex: {FFFFFF}%s\n\
  571.                                          {00C0FF}Tara: {FFFFFF}%s\n", pField[ 0 ], P_DATA[ playerid ][ Age ], pField[ 1 ], pField[ 2 ] );
  572.             format( str2, sizeof( str2 ), "{00C0FF}Likeurile lui %s: {FFFFFF}%d\n\
  573.                                          {00C0FF}Vizualizari Profil: {FFFFFF}%d\n\
  574.                                          {00C0FF}Ocupatie: {FFFFFF}%s\n\
  575.                                          {00C0FF}Privacitatea: {FFFFFF}%d\n", str, P_DATA[ playerid ][ Likes ], P_DATA[ playerid ][ Views ], pField[ 3 ], P_DATA[ playerid ][ Privacy ] );
  576.             ShowPlayerDialog( playerid, MYFB, DIALOG_STYLE_MSGBOX, "{00C0FF}Face{FFFFFF}Book", str2, "Cancel", "Settings" );
  577.         }
  578.         else db:free_result( R );
  579.     }
  580.     return 1;
  581. }
  582. stock PlayerName2( i ) { new n[ 24 ]; GetPlayerName( i, n, 24 ); return n; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement