Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include < a_samp >
- #include < zcmd >
- #include < sscanf2 >
- #define COLOR_RED 0xFF0000AA
- #define GREEN 0x00FF00AA
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_ORANGE 0xFF9900AA
- #define ONCONN 12200
- #define ONLOG 12300
- #define MYFB 1000
- #define FB 12600
- #define MOD 12700
- #define AgeSet 12800
- #define StatusSet 12900
- #define CountrySet 13000
- #define SexSet 13100
- #define LikesReset 13200
- #define ViewsReset 13300
- #define OcupationSet 13400
- #define PrivacySet 13500
- #define DELETE 13600
- #define Warning1 13700
- #define Warning2 13800
- #define OnCreateFaceBook 13900
- #define Dialog_LoginFAccount 16000
- #define Dialog_LoginFAccount2 17000
- #define Dialog_PlayerProfile 18000
- #define db_assoc db:get_field_assoc
- #define db: db_
- #define Use_Speed_Text true
- new const Languages[ ] = { "Romana", "English", "Polsky", "Slovensky", "Intalia", "Spanish", "Portugese", "German", "Swedish", "Bulgaria", "Arab" };
- enum pInfo
- {
- Age,
- Likes,
- Views,
- Privacy,
- Logged,
- };
- new P_DATA[ MAX_PLAYERS ][ pInfo ];
- new DB:Database;
- new pViewing[ MAX_PLAYERS ];
- //=============================== [ CallBacks ] ==============================//
- public OnFilterScriptInit( )
- {
- Database = db:open( "FaceBook.db" );
- db:query( Database, "CREATE TABLE IF NOT EXISTS `FProfiles` (`Nume` TEXT, \
- `Password` TEXT, \
- `Age` NUMERIC, \
- `Sex` TEXT, \
- `Country` TEXT, \
- `Likes` NUMERIC, \
- `Views` NUMERIC, \
- `Privacy` NUMERIC, \
- `Status` TEXT, \
- `Ocupation` TEXT, \
- `Expiration` TEXT)" );
- return 1;
- }
- public OnFilterScriptExit( ) return db:close( Database );
- public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
- {
- if ( dialogid == Dialog_LoginFAccount )
- {
- new DBResult:R, Query[ 256 ], FPassword[ 128 ], Field[ 128 ];
- if ( !response ) return 1;
- 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" );
- format( Query, sizeof( Query ), "SELECT * FROM `FProfiles` WHERE `Nume` = '%s'", PlayerName2( playerid ) );
- R = db:query( Database, Query );
- if ( R )
- {
- if ( db:num_rows( R ) )
- {
- new DBResult:R2;
- format( Query, sizeof( Query ), "SELECT * FROM `FProfiles` WHERE `Nume` = '%s' AND `Password` = '%s'", PlayerName2( playerid ), FPassword );
- R2 = db:query( Database, Query );
- if ( db:num_rows( R2 ) )
- {
- db:get_field_assoc( R, "Age", Field, 128 );
- P_DATA[ playerid ][ Age ] = strval( Field );
- db:get_field_assoc( R, "Likes", Field, 128 );
- P_DATA[ playerid ][ Likes ] = strval( Field );
- db:get_field_assoc( R, "Views", Field, 128 );
- P_DATA[ playerid ][ Views ] = strval( Field );
- db:get_field_assoc( R, "Privacy", Field, 128 );
- P_DATA[ playerid ][ Privacy ] = strval( Field );
- new Str[ 128 ];
- strcat( Str, "{FFFFFF}Te-ai {00C0FF}logat {FFFFFF}cu succes.\n\
- {FFFFFF}Daca vrei sa {00C0FF}schimbi {FFFFFF}ceva de pe {00C0FF}face{FFFFFF}book-ul tau\n\
- {FFFFFF}alege al doilea {00C0FF}buton{FFFFFF}.\n" );
- ShowPlayerDialog( playerid, ONLOG, DIALOG_STYLE_MSGBOX, "FaceBook", Str, "MyProfile", "Cancel" );
- P_DATA[ playerid ][ Logged ] = 1;
- }
- 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" );
- db:free_result( R2 );
- }
- 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" );
- db:free_result( R );
- }
- }
- if ( dialogid == Dialog_LoginFAccount2 )
- {
- if ( !response ) return CallRemoteFunction( "OnPlayerCommandText", "is", playerid, "/cfacebook" );
- }
- if ( dialogid == OnCreateFaceBook+1 )
- {
- if ( !response ) return 1;
- SetPVarInt( playerid, "CreatingProfile", 1 );
- 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" );
- return 1;
- }
- if ( dialogid == ONLOG )
- {
- if( !response ) return 1;
- FormatFBDialog( playerid );
- }
- if( dialogid == MYFB )
- {
- if( !response )
- {
- new str[ 312 ];
- strcat( str, "{FFFFFF}Modifica: {00C0FF}Status'ul \n\
- {FFFFFF}Modifica: {00C0FF}Ani \n\
- {FFFFFF}Modifica: {00C0FF}Sex'ul \n\
- {FFFFFF}Modifica: {00C0FF}Tara \n\
- {FFFFFF}Reseteaza: {00C0FF}Like'urile \n\
- {FFFFFF}Reseteaza: {00C0FF}Vizualizarile profilului\n\
- {FFFFFF}Modifica: {00C0FF}Ocupatia \n\
- {FFFFFF}Modifica: {00C0FF}Privaturile \n\
- {00C0FF}Iesi" );
- ShowPlayerDialog( playerid, MOD, DIALOG_STYLE_LIST, "{00C0FF}Schimbarile Profilului", str, "Alege", "" );
- }
- }
- if ( dialogid == FB )
- {
- new Query[ 256 ], string[ 128 ], Time[ 3 ];
- if ( !response ) return 1;
- 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." );
- format( Query, 256, "SELECT * FROM `FProfiles` WHERE `Nume` = '%s'", PlayerName2( playerid ) );
- new DBResult:R2 = db:query( Database, Query );
- gettime( Time[ 0 ], Time[ 1 ] );
- getdate( .day = Time[ 2 ] );
- if ( R2 )
- {
- if ( db:free_result( R2 ) )
- {
- new Field[ 64 ], T2[ 3 ];
- db:get_field_assoc( R2, "Expiration", Field, sizeof( Field ) );
- if ( !isnull( Field ) )
- {
- sscanf( Field, "p<|>iii", Time[ 2 ], Time[ 0 ], Time[ 1 ] );
- gettime( T2[ 0 ], T2[ 1 ] );
- getdate( .day = T2[ 2 ] );
- if ( Time[ 0 ] == 0 ) Time[ 0 ] = 24;
- if ( T2[ 2 ] == Time[ 2 ] )
- {
- if ( T2[ 0 ] == Time[ 0 ] )
- {
- if ( T2[ 1 ] < Time[ 1 ] )
- {
- SendClientMessage( playerid, COLOR_RED, "{00C0FF}Eroare: {FFFFFF}Poti da 1 like/ora." );
- format( string, sizeof( string ), "{FFFFFF}Poti {00C0FF}repeta {FFFFFF}procesul dupa {00C0FF}%d:%d !", Time[ 0 ], Time[ 1 ] );
- SendClientMessage( playerid, COLOR_RED, string );
- return 1;
- }
- }
- else if ( T2[ 0 ] < Time[ 0 ] )
- {
- SendClientMessage( playerid, COLOR_RED, "{00C0FF}Eroare: {FFFFFF}Poti da 1 like/ora." );
- format( string, sizeof( string ), "{FFFFFF}Poti {00C0FF}repeta {FFFFFF}procesul dupa {00C0FF}%d:%d !", Time[ 0 ], Time[ 1 ] );
- SendClientMessage( playerid, COLOR_RED, string );
- return 1;
- }
- }
- }
- 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 ) );
- db:query( Database, Query );
- }
- else db:free_result( R2 );
- }
- P_DATA[ pViewing[ playerid ] ][ Likes ]++;
- GameTextForPlayer( playerid, "~w~Profil ~r~Like!", 5000, 5 );
- 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 ] );
- SendClientMessageToAll( COLOR_GREY, string );
- }
- if ( dialogid == DELETE )
- {
- if ( !response ) return 1;
- new Query[ 256 ];
- format( Query, sizeof( Query ), "DELETE FROM `FProfiles` WHERE `Nume` = '%s'", PlayerName2( playerid ) );
- db:query( Database, Query );
- SendClientMessage( playerid, COLOR_RED, "{FFFFFF}Ti-ai sters cu succes contul de {00C0FF}Face{FFFFFF}book." );
- P_DATA[ playerid ][ Logged ] = 0;
- }
- if ( dialogid == MOD )
- {
- if ( response )
- {
- if ( listitem == 0 )
- {
- ShowPlayerDialog( playerid, StatusSet, DIALOG_STYLE_INPUT, "{00C0FF}Modifica", "{FFFFFF}Adauga ce {00C0FF}status {FFFFFF}doresti tu sa\n{FFFFFF}apara pe profil:", "Schimba", "Inapoi" );
- }
- if ( listitem == 1 )
- {
- ShowPlayerDialog( playerid, AgeSet, DIALOG_STYLE_INPUT, "{00C0FF}Modifica", "{FFFFFF}Te rog, adauga-ti {00C0FF}varsta {FFFFFF}mai jos.", "Schimba", "Inapoi" );
- }
- if ( listitem == 2 )
- {
- ShowPlayerDialog( playerid, SexSet, DIALOG_STYLE_LIST, "{00C0FF}Alege'ti sexul", "{FFFFFF}Barbat\n{FFFFFF}Femeie", "Schimba", "Inapoi" );
- }
- if ( listitem == 3 )
- {
- ShowPlayerDialog( playerid, CountrySet, DIALOG_STYLE_LIST, "{00C0FF}Modifica", "Romana\nEnglish\nPolsky\nSlovensky\nIntalia\nSpanish\nPortugese\nGerman\nSwedish\nBulgaria\nArab", "Schimba", "Inapoi" );
- }
- if ( listitem == 4 )
- {
- 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" );
- }
- if ( listitem == 5 )
- {
- 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" );
- }
- if ( listitem == 6 )
- {
- 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" );
- }
- if ( listitem == 7 )
- {
- 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" );
- }
- if ( listitem == 8 )
- {
- return 1;
- }
- }
- else
- {
- new str[ 312 ];
- strcat( str, "{FFFFFF}Modifica: {00C0FF}Status'ul \n\
- {FFFFFF}Modifica: {00C0FF}Ani \n\
- {FFFFFF}Modifica: {00C0FF}Sex'ul \n\
- {FFFFFF}Modifica: {00C0FF}Tara \n\
- {FFFFFF}Reseteaza: {00C0FF}Like'urile \n\
- {FFFFFF}Reseteaza: {00C0FF}Vizualizarile profilului\n\
- {FFFFFF}Modifica: {00C0FF}Ocupatia \n\
- {FFFFFF}Modifica: {00C0FF}Privaturile \n\
- {00C0FF}Iesi" );
- ShowPlayerDialog( playerid, MOD, DIALOG_STYLE_LIST, "{00C0FF}Schimbarile Profilului", str, "Alege", "" );
- }
- return 1;
- }
- if ( dialogid == StatusSet )
- {
- if ( !response ) return FormatFBDialog( playerid );
- new Query[ 256 ];
- format( Query, sizeof( Query ), "UPDATE `FProfiles` SET `Status` = '%s' WHERE `Nume` = '%s'", inputtext, PlayerName2( playerid ) );
- db:query( Database, Query );
- GameTextForPlayer( playerid, "~r~Status ~w~ Setat!", 5000,5 );
- if ( GetPVarInt( playerid, "CreatingProfile" ) == 1 )
- {
- ShowPlayerDialog( playerid, AgeSet, DIALOG_STYLE_INPUT, "{00C0FF}Modifica", "{FFFFFF}Te rog introduceti {00C0FF}varsta {FFFFFF}mai jos:", "Schimba", "Inapoi" );
- }
- return 1;
- }
- if ( dialogid == AgeSet )
- {
- if ( !response ) return FormatFBDialog( playerid );
- 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" );
- 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" );
- new Query[ 256 ];
- format( Query, sizeof( Query ), "UPDATE `FProfiles` SET `Age` = '%d' WHERE `Nume` = '%s'", inputtext[ 0 ], PlayerName2( playerid ) );
- db:query( Database, Query );
- GameTextForPlayer( playerid, "~r~Age ~w~Set!", 5000,5 );
- P_DATA[ playerid ][ Age ] = inputtext[ 0 ];
- if ( GetPVarInt( playerid, "CreatingProfile" ) == 1 )
- {
- ShowPlayerDialog( playerid, SexSet, DIALOG_STYLE_LIST, "{00C0FF}Selecteazati sexul", "{FFFFFF}Barbat\n{FFFFFF}Femeie", "Schimba", "Inapoi" );
- }
- return 1;
- }
- if ( dialogid == SexSet )
- {
- if ( !response ) return FormatFBDialog( playerid );
- if ( listitem == 0 )
- {
- new Query[ 256 ];
- format( Query, sizeof( Query ), "UPDATE `FProfiles` SET `Sex` = 'Male' WHERE `Nume` = '%s'", PlayerName2( playerid ) );
- db:query( Database, Query );
- GameTextForPlayer( playerid, "~r~Sex ~w~Set!", 5000, 5 );
- if ( GetPVarInt( playerid, "CreatingProfile" ) == 1 )
- {
- ShowPlayerDialog( playerid, CountrySet, DIALOG_STYLE_LIST, "{00C0FF}Modifica", "Romana\nEnglish\nPolsky\nSlovensky\nIntalia\nSpanish\nPortugese\nGerman\nSwedish\nBulgaria\nArab", "Schimba", "Inapoi" );
- }
- }
- if ( listitem == 1 )
- {
- new Query[ 256 ];
- format( Query, sizeof( Query ), "UPDATE `FProfiles` SET `Sex` = 'Female' WHERE `Nume` = '%s'", PlayerName2( playerid ) );
- db:query( Database, Query );
- GameTextForPlayer( playerid, "~r~Sex ~w~Set!", 5000, 5 );
- if ( GetPVarInt( playerid, "CreatingProfile" ) == 1 )
- {
- ShowPlayerDialog( playerid, CountrySet, DIALOG_STYLE_LIST, "{FF9900}Modify", "Romana\nEnglish\nPolsky\nSlovensky\nIntalia\nSpanish\nPortugese\nGerman\nSwedish\nBulgaria\nArab", "Schimba", "Inapoi" );
- }
- }
- return 1;
- }
- if ( dialogid == CountrySet )
- {
- if ( !response ) return FormatFBDialog( playerid );
- new Query[ 256 ];
- format( Query, sizeof( Query ), "UPDATE `FProfiles` SET `Country` = '%s' WHERE `Nume` = '%s'", Languages[ listitem ], PlayerName2( playerid ) );
- db:query( Database, Query );
- GameTextForPlayer( playerid, "~r~Your country have been ~w~Set!", 5000, 5 );
- if ( GetPVarInt( playerid, "CreatingProfile" ) == 1 )
- {
- ShowPlayerDialog( playerid, OcupationSet, DIALOG_STYLE_INPUT, "{00C0FF}Modifica", "{FFFFFF}Scrie mai jos {00C0FF}ocupatia {FFFFFF}ta\n{FFFFFF}Exemplu: {00C0FF}Dansez", "Schimba", "Inapoi" );
- }
- return 1;
- }
- if ( dialogid == Warning1 )
- {
- if ( !response ) return FormatFBDialog( playerid );
- new Query[ 256 ];
- format( Query, sizeof( Query ), "UPDATE `FProfiles` SET `Likes` = '0' WHERE `Nume` = '%s' ", PlayerName2( playerid ) );
- db:query( Database, Query );
- ShowPlayerDialog( playerid, DIALOG_STYLE_MSGBOX, LikesReset, "{00C0FF}Reseteaza", "{FFFFFF}Ti-ai {00C0FF}resetat {FFFFFF}likeurile", "Inapoi", "" );
- P_DATA[ playerid ][ Likes ] = 0;
- return 1;
- }
- if ( dialogid == Warning2 )
- {
- if ( !response ) return FormatFBDialog( playerid );
- new Query[ 256 ];
- format( Query, sizeof( Query ), "UPDATE `FProfiles` SET `Views` = '0' WHERE `Nume` = '%s' ", PlayerName2( playerid ) );
- db:query( Database, Query );
- ShowPlayerDialog( playerid, ViewsReset, DIALOG_STYLE_MSGBOX, "{00C0FF}Reseteaza", "{FFFFFF}Ti-ai {00C0FF}resetat {FFFFFF}vizualizarile profilului", "Inapoi", "" );
- P_DATA[ playerid ][ Views ] = 0;
- return 1;
- }
- if ( dialogid == OcupationSet )
- {
- if ( !response ) return FormatFBDialog( playerid );
- new Query[ 256 ];
- format( Query, sizeof( Query ), "UPDATE `FProfiles` SET `Ocupation` = '%s' WHERE `Nume` = '%s'", inputtext, PlayerName2( playerid ) );
- db:query( Database, Query );
- GameTextForPlayer( playerid, "~r~Ocupatia a fost ~w~Setata!", 5000, 5 );
- if ( GetPVarInt( playerid, "CreatingProfile" ) == 1 )
- {
- 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" );
- }
- return 1;
- }
- if ( dialogid == PrivacySet )
- {
- if ( !response ) return FormatFBDialog( playerid );
- 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" );
- 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" );
- new Query[ 256 ];
- format( Query, sizeof( Query ), "UPDATE `FProfiles` SET `Privacy` = '%d' WHERE `Nume` = '%s'", inputtext[ 0 ], PlayerName2( playerid ) );
- db:query( Database, Query );
- GameTextForPlayer( playerid, "~r~Privatul profilului tau a fost ~w~Setata!", 5000, 5 );
- P_DATA[ playerid ][ Privacy ] = inputtext[ 0 ];
- return 1;
- }
- if ( dialogid == OnCreateFaceBook )
- {
- if ( !response ) return 1;
- new FPassword[ 128 ];
- 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" );
- 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" );
- new Query[ 256 ], str[ 256 ];
- 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 );
- db:query( Database, Query );
- P_DATA[ playerid ][ Logged ] = 1;
- 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" );
- 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 );
- ShowPlayerDialog( playerid, OnCreateFaceBook+1, DIALOG_STYLE_MSGBOX, "{00C0FF}Face{FFFFFF}Book", str, "Settings", "Cancel" );
- }
- return 1;
- }
- public OnPlayerConnect( playerid )
- {
- new Query[ 256 ], DBResult:R;
- format( Query, sizeof( Query ), "SELECT * FROM `FProfiles` WHERE `Nume` = '%s'", PlayerName2( playerid ) );
- R = db:query( Database, Query );
- if ( R )
- {
- if ( db:num_rows( R ) )
- {
- SendClientMessage( playerid, COLOR_RED, "{00C0FF}INFO: {FFFFFF}Tu ai cont de FaceBook, logheazate cu /flogin [parola]" );
- }
- else
- {
- SendClientMessage( playerid, COLOR_RED, "{00C0FF}INFO: {FFFFFF}Tu nu ai cont de FaceBook, daca vrei creaza unul cu /cfacebook" );
- }
- db:free_result( R );
- }
- P_DATA[ playerid ][ Age ] = 0;
- P_DATA[ playerid ][ Likes ] = 0;
- P_DATA[ playerid ][ Views ] = 0;
- P_DATA[ playerid ][ Privacy ] = 0;
- P_DATA[ playerid ][ Logged ] = 0;
- #if defined Use_Speed_Text
- #endif
- return 1;
- }
- public OnPlayerDisconnect( playerid, reason )
- {
- new Query[ 256 ] ;
- format( Query, sizeof( Query ), "UPDATE `FProfiles` SET `Likes` = '%d', `Views` = '%d' WHERE `Nume` = '%s'", P_DATA[ playerid ][ Likes ], P_DATA[ playerid ][ Views ], PlayerName2( playerid ) );
- db:query( Database, Query );
- P_DATA[ playerid ][ Logged ] = 0;
- return 1;
- }
- //============================= [ Commands ] =================================//
- CMD:cfacebook( playerid, params[ ] )
- {
- new Query[ 256 ], DBResult:R;
- 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." );
- format( Query, sizeof( Query ), "SELECT * FROM `FProfiles` WHERE `Nume` = '%s'", PlayerName2( playerid ) );
- R = db:query( Database, Query );
- if ( R )
- {
- if ( db:num_rows( R ) )
- {
- SendClientMessage( playerid, COLOR_RED, "{00C0FF}Eroare: {FFFFFF}Deja ai cont, logheazate cu /flogin [parola]" );
- }
- else
- {
- new str[ 256 ];
- format( str, sizeof( str ), "{FFFFFF}Salut {00C0FF}%s{FFFFFF}, acesta este un dialog care te va ajuta la creerea\n\
- {FFFFFF}propiului tau cont de FaceBook\n\n\
- {FFFFFF}Te rog scrie {00C0FF}parola {FFFFFF}care o dorest la profil::", PlayerName2( playerid ) );
- ShowPlayerDialog( playerid, OnCreateFaceBook, 1, "{FF9900}New profile", str, "Gata", "Cancel" );
- }
- }
- return 1;
- }
- CMD:facebook( playerid, params[ ] )
- {
- new Player, str[ 256 ], str2[ 512 ];
- if ( sscanf( params, "u", Player ) )
- {
- 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]" );
- FormatFBDialog( playerid );
- 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]" );
- }
- else
- {
- if ( Player == playerid )
- {
- FormatFBDialog( playerid );
- 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]" );
- }
- else
- {
- new Query[ 256 ], DBResult:R, DBResult:R2, pField[ 4 ][ 128 ];
- if ( !IsPlayerConnected( Player ) ) return SendClientMessage( playerid, COLOR_RED, "{00C0FF}Eroare: {FFFFFF}Player-ul nu este conectat." );
- if ( P_DATA[ Player ][ Privacy ] == 1 ) return SendClientMessage( playerid, COLOR_RED, "{FFFFFF}Acest player are contul {00C0FF}privat{FFFFFF}." );
- format( Query, sizeof( Query ), "SELECT * FROM `FProfiles` WHERE `Nume` = '%s'", PlayerName2( Player ) );
- R2 = db:query( Database, Query );
- if ( R2 )
- {
- if ( db:num_rows( R2 ) )
- {
- format( Query, sizeof( Query ), "SELECT `Status`, `Sex`, `Country`, `Ocupation` FROM `FProfiles` WHERE `Nume` = '%s'", PlayerName2( playerid ) );
- R = db:query( Database, Query );
- if ( R )
- {
- if ( db:num_rows( R ) )
- {
- db:get_field_assoc( R, "Status", pField[ 0 ], 128 );
- db:get_field_assoc( R, "Sex", pField[ 1 ], 128 );
- db:get_field_assoc( R, "Country", pField[ 2 ], 128 );
- db:get_field_assoc( R, "Ocupation", pField[ 3 ], 128 );
- format( str, sizeof( str ), "{00C0FF}Face{FFFFFF}Book-ul lui %s\n\n\
- {00C0FF}Status: {FFFFFF}%s\n\
- {00C0FF}Ani: {FFFFFF}%d\n\
- {00C0FF}Sex: {FFFFFF}%s\n\
- {00C0FF}Tara: {FFFFFF}%s\n", PlayerName2( Player ), pField[ 0 ], P_DATA[ Player ][ Age ], pField[ 1 ], pField[ 2 ] );
- format( str2, sizeof( str2 ), "{00C0FF}Likeurile lui %s: {FFFFFF}%d\n\
- {00C0FF}Vizualizarile Profilului: {FFFFFF}%d\n\
- {00C0FF}Ocupatie: {FFFFFF}%s\n\
- {00C0FF}Privacitatea Contului: {FFFFFF}%d\n", str, P_DATA[ Player ][ Likes ], P_DATA[ Player ][ Views ], pField[ 3 ], P_DATA[ Player ][ Privacy ] );
- ShowPlayerDialog( playerid, FB, DIALOG_STYLE_MSGBOX, "{00C0FF}Face{FFFFFF}Book", str2, "Like", "Cancel" );
- pViewing[ playerid ] = Player;
- P_DATA[ Player ][ Views ]++;
- }
- else db:free_result( R );
- }
- }
- else return SendClientMessage( playerid, COLOR_RED, "{00C0FF}Eroare: {FFFFFF}Acest user nu are cont de {00C0FF}Face{FFFFFF}Book." );
- }
- }
- }
- return 1;
- }
- CMD:flogin( playerid, params[ ] )
- {
- if ( P_DATA[ playerid ][ Logged ] == 1 ) return SendClientMessage( playerid, COLOR_RED, "{FFFFFF}Deja esti logat pe contul tau de {00C0FF}Face{FFFFFF}Book." );
- 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" );
- return 1;
- }
- CMD:dfacebook( playerid, params[ ] )
- {
- new Query[ 256 ], DBResult:R;
- format( Query, sizeof( Query ), "SELECT * FROM `FProfiles` WHERE `Nume` = '%s'", PlayerName2( playerid ) );
- R = db:query( Database, Query );
- if ( db:num_rows( R ) )
- {
- if ( P_DATA[ playerid ][ Logged ] == 1 )
- {
- 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" );
- }
- else
- {
- SendClientMessage( playerid, COLOR_RED, "{00C0FF}Eroare: {FFFFFF}Trebuie sa fii logat pe profil pentru al putea sterge" );
- SendClientMessage( playerid, COLOR_RED, "{00C0FF}Foloseste: {FFFFFF}/flogin [parola]" );
- }
- }
- else return SendClientMessage( playerid, COLOR_RED, "{FFFFFF}Tu nu ai cont de {00C0FF}Face{FFFFFF}Book, pentru ati creea unul scrie /cfacebook!" );
- return 1;
- }
- //=============================== [ Stock's ] ================================//
- stock FormatFBDialog( playerid )
- {
- new Query[ 256 ], str[ 256 ], str2[ 512 ], DBResult:R, pField[ 4 ][ 128 ];
- format( Query, sizeof( Query ), "SELECT `Status`, `Sex`, `Country`, `Ocupation` FROM `FProfiles` WHERE `Nume` = '%s'", PlayerName2( playerid ) );
- R = db:query( Database, Query );
- if ( R )
- {
- if ( db:num_rows( R ) )
- {
- db:get_field_assoc( R, "Status", pField[ 0 ], 128 );
- db:get_field_assoc( R, "Sex", pField[ 1 ], 128 );
- db:get_field_assoc( R, "Country", pField[ 2 ], 128 );
- db:get_field_assoc( R, "Ocupation", pField[ 3 ], 128 );
- format( str, sizeof( str ), "{00C0FF}Profilul Tau\n\n\
- {00C0FF}Status: {FFFFFF}%s\n\
- {00C0FF}Ani: {FFFFFF}%d\n\
- {00C0FF}Sex: {FFFFFF}%s\n\
- {00C0FF}Tara: {FFFFFF}%s\n", pField[ 0 ], P_DATA[ playerid ][ Age ], pField[ 1 ], pField[ 2 ] );
- format( str2, sizeof( str2 ), "{00C0FF}Likeurile lui %s: {FFFFFF}%d\n\
- {00C0FF}Vizualizari Profil: {FFFFFF}%d\n\
- {00C0FF}Ocupatie: {FFFFFF}%s\n\
- {00C0FF}Privacitatea: {FFFFFF}%d\n", str, P_DATA[ playerid ][ Likes ], P_DATA[ playerid ][ Views ], pField[ 3 ], P_DATA[ playerid ][ Privacy ] );
- ShowPlayerDialog( playerid, MYFB, DIALOG_STYLE_MSGBOX, "{00C0FF}Face{FFFFFF}Book", str2, "Cancel", "Settings" );
- }
- else db:free_result( R );
- }
- return 1;
- }
- stock PlayerName2( i ) { new n[ 24 ]; GetPlayerName( i, n, 24 ); return n; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement