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 Dialog_FHelp 19000
- #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, "{00FF00}You have logged succesfully!\n\
- {00FF00}If you want to change somethink to your facebook\n\
- {00FF00}please click on second dialog button!\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, "Login your FaceBook account", "{FF0000}An error has encoured!\n{FFFFFF}Invalid password! Please type it again:", "Login", "Cancel" );
- db:free_result( R2 );
- }
- else return ShowPlayerDialog( playerid, Dialog_LoginFAccount2, DIALOG_STYLE_MSGBOX, "Login your FaceBook account", "{FF0000}An error has encoured!\n{FFFFFF}This user don't have an account.\nYou can create a new one by click on button '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, "{FF9900}Modify", "{FF0000}Insert the new status what do you want to\n{FF0000}appear on your profile:", "Change", "Back" );
- return 1;
- }
- if ( dialogid == ONLOG )
- {
- if( !response ) return 1;
- FormatFBDialog( playerid );
- }
- if( dialogid == MYFB )
- {
- if( !response )
- {
- new str[ 312 ];
- strcat( str, "{FFFF00}MODIFY: {FFFFFF}Status\n\
- {FFFF00}MODIFY: {FFFFFF}Age\n\
- {FFFF00}MODIFY: {FFFFFF}Sex\n\
- {FFFF00}MODIFY: {FFFFFF}Country\n\
- {FF0000}RESET: {FFFFFF}Likes\n\
- {FF0000}RESET: {FFFFFF}Profile Views\n\
- {FFFF00}MODIFY: {FFFFFF}Ocupation\n\
- {FFFF00}MODIFY: {FFFFFF}Profile Privacy\n\
- {FF9900}Exit" );
- ShowPlayerDialog( playerid, MOD, DIALOG_STYLE_LIST, "Profile changes", str, "Select", "" );
- }
- }
- 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, "ERROR: Player must be logged in his facebook account to can receive likes!" );
- 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, "ERROR: You are allowed to gave 1 Like/per hour!" );
- format( string, sizeof( string ), "You can repeat the process after %d:%d !", Time[ 0 ], Time[ 1 ] );
- SendClientMessage( playerid, COLOR_RED, string );
- return 1;
- }
- }
- else if ( T2[ 0 ] < Time[ 0 ] )
- {
- SendClientMessage( playerid, COLOR_RED, "ERROR: You are allowed to gave 1 Like/per hour!" );
- format( string, sizeof( string ), "You can repeat the process after %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~Profile ~r~Liked!", 5000, 5 );
- format( string, sizeof ( string ), "*** FaceBook: {FF9900}%s (ID:%d) {AFAFAF}liked {FF9900}%s (ID:%d){AFAFAF}'s FaceBook profile!", 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, "Your facebook account have been succesfully deleted!" );
- P_DATA[ playerid ][ Logged ] = 0;
- }
- if ( dialogid == MOD )
- {
- if ( response )
- {
- if ( listitem == 0 )
- {
- ShowPlayerDialog( playerid, StatusSet, DIALOG_STYLE_INPUT, "{FF9900}Modify", "{FF0000}Insert the new status what do you want to\n{FF0000}appear on your profile:", "Change", "Back" );
- }
- if ( listitem == 1 )
- {
- ShowPlayerDialog( playerid, AgeSet, DIALOG_STYLE_INPUT, "{FF9900}Modify", "{FF0000}Please insert your age bellow:", "Change", "Back" );
- }
- if ( listitem == 2 )
- {
- ShowPlayerDialog( playerid, SexSet, DIALOG_STYLE_LIST, "{FF9900}Select your sex", "{FF0000}Male\n{FFFFFF}Female", "Change", "Back" );
- }
- if ( listitem == 3 )
- {
- ShowPlayerDialog( playerid, CountrySet, DIALOG_STYLE_LIST, "{FF9900}Modify", "Romana\nEnglish\nPolsky\nSlovensky\nIntalia\nSpanish\nPortugese\nGerman\nSwedish\nBulgaria\nArab", "Change", "Back" );
- }
- if ( listitem == 4 )
- {
- ShowPlayerDialog( playerid, Warning1, DIALOG_STYLE_INPUT, "{FF0000}Reset", "{FF0000}WARNING!: {FFFFFF}Are, you sure to want to reset your FaceBook Likes?", "Yes", "No/Back" );
- }
- if ( listitem == 5 )
- {
- ShowPlayerDialog( playerid, Warning2, DIALOG_STYLE_INPUT, "{FF0000}Reset", "{FF0000}WARNING!: {FFFFFF}Are, you sure to want to reset your FaceBook profile Views?", "Yes", "No/Back" );
- }
- if ( listitem == 6 )
- {
- ShowPlayerDialog( playerid, OcupationSet, DIALOG_STYLE_INPUT, "{FF9900}Modify", "{FF0000}Type below what are your ocupation.\nExemple: Dancing", "Change", "Back" );
- }
- if ( listitem == 7 )
- {
- ShowPlayerDialog( playerid, PrivacySet, DIALOG_STYLE_INPUT, "{FF9900}Modify", "{FF0000}Please type 0 to player can watch your profile\nor type 1 to can't watch your profile!", "Change", "Back" );
- }
- if ( listitem == 8 )
- {
- return 1;
- }
- }
- else
- {
- new str[ 312 ];
- strcat( str, "{FFFF00}MODIFY: {FFFFFF}Status\n\
- {FFFF00}MODIFY: {FFFFFF}Age\n\
- {FFFF00}MODIFY: {FFFFFF}Sex\n\
- {FFFF00}MODIFY: {FFFFFF}Country\n\
- {FF0000}RESET: {FFFFFF}Likes\n\
- {FF0000}RESET: {FFFFFF}Profile Views\n\
- {FFFF00}MODIFY: {FFFFFF}Ocupation\n\
- {FFFF00}MODIFY: {FFFFFF}Profile Privacy\n\
- {FF9900}Exit" );
- ShowPlayerDialog( playerid, MOD, DIALOG_STYLE_LIST, "Profile changes", str, "Select", "" );
- }
- 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~ Set!", 5000,5 );
- if ( GetPVarInt( playerid, "CreatingProfile" ) == 1 )
- {
- ShowPlayerDialog( playerid, AgeSet, DIALOG_STYLE_INPUT, "{FF9900}Modify", "{FF0000}Please insert your age bellow:", "Change", "Back" );
- }
- return 1;
- }
- if ( dialogid == AgeSet )
- {
- if ( !response ) return FormatFBDialog( playerid );
- if ( sscanf( inputtext, "i", inputtext[ 0 ] ) ) return ShowPlayerDialog( playerid, AgeSet, DIALOG_STYLE_INPUT, "{FF9900}Modify", "{FF0000}Please insert a correct value!", "Next", "Cancel" );
- if ( inputtext[ 0 ] < 0 || inputtext[ 0 ] > 99 ) return ShowPlayerDialog( playerid, DIALOG_STYLE_INPUT, AgeSet, "{FF9900}Modify", "{FF0000}ERROR: {FFFFFF}I don't think you have more that 0 and 99 years!", "Next", "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, "{FF9900}Select your sex", "{FF0000}Male\n{FFFFFF}Female", "Change", "Back" );
- }
- 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, "{FF9900}Modify", "Romana\nEnglish\nPolsky\nSlovensky\nIntalia\nSpanish\nPortugese\nGerman\nSwedish\nBulgaria\nArab", "Change", "Back" );
- }
- }
- 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", "Change", "Back" );
- }
- }
- 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, "{FF9900}Modify", "{FF0000}Type below what are your ocupation.\nExemple: Dancing", "Change", "Back" );
- }
- 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, "{FF0000}Reset", "{00FF00}You have reseted your likes", "Back", "" );
- 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, "{FF0000}Reset", "{00FF00}You have reseted your profile views!", "Back", "" );
- 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~Ocupation has been ~w~Set!", 5000, 5 );
- if ( GetPVarInt( playerid, "CreatingProfile" ) == 1 )
- {
- ShowPlayerDialog( playerid, PrivacySet, DIALOG_STYLE_INPUT, "{FF9900}Modify", "{FF0000}Do you want to your profile will be private? Type in dialog 1.", "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~Your privacy profile has been ~w~Set!", 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, "You have registred succesfully. Please follow the next step to set your profile: age, status, sex..." );
- format( str, sizeof( str ), "{00FF00}Your FaceBook profile was succesfully created with:\nUsername - {FF9900}%s\n{00FF00}Password - {FF9900}%s{00FF00}.\n\nTo change your profile status, ocupation, sex, etc click on 'Settings' button.", PlayerName2( playerid ), FPassword );
- ShowPlayerDialog( playerid, OnCreateFaceBook+1, DIALOG_STYLE_MSGBOX, "FaceBook", 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, "{FFFF00}INFO: {FFFFFF}This user have a FaceBook profile. Use /flogin to login your account!" );
- }
- else
- {
- SendClientMessage( playerid, COLOR_RED, "{FFFF00}INFO: {FFFFFF}This user won't have a profile on FaceBook. You can create one with /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
- SendClientMessage( playerid, COLOR_ORANGE, "{375FFF}(f)FACEBOOK: {ACACAC}This server use /facebook system by xxSPEEDYxx!" );
- #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, "You facebook account are already created, and your are logged in!" );
- 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, "ERROR: Your account already exists. Please use {FFFFFF}/flogin to login your facebook account." );
- }
- else
- {
- new str[ 256 ];
- format( str, sizeof( str ), "{00FF00}Hi {ACACAC}%s{00FF00}, this is a dialog what help you to create\n\
- your FaceBook profile...\n\n\
- Please type your FaceBook, account password:", PlayerName2( playerid ) );
- ShowPlayerDialog( playerid, OnCreateFaceBook, 1, "{FF9900}New profile", str, "Proced", "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, "ERROR: You need to be logged in your FB account! Type /flogin [Pass] to login!" );
- FormatFBDialog( playerid );
- SendClientMessage( playerid, COLOR_GREY, "You watch on your profile. You can also use {FF9900}/facebook [PlayerID]" );
- }
- else
- {
- if ( Player == playerid )
- {
- FormatFBDialog( playerid );
- SendClientMessage( playerid, COLOR_GREY, "You watch on your profile. You can also use {FF9900}/facebook [PlayerID]" );
- }
- else
- {
- new Query[ 256 ], DBResult:R, DBResult:R2, pField[ 4 ][ 128 ];
- if ( !IsPlayerConnected( Player ) ) return SendClientMessage( playerid, COLOR_RED, "ERROR: Player not connected!" );
- if ( P_DATA[ Player ][ Privacy ] == 1 ) return SendClientMessage( playerid, COLOR_RED, "Because of a privacy setting on this account, you cannot view this profile." );
- 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 ), "{FF0000}%s's FaceBook profile:\n\n\
- {FF9900}Status: {00FF00}%s\n\
- {FF9900}Age: {00FF00}%d\n\
- {FF9900}Sex: {00FF00}%s\n\
- {FF9900}Country: {00FF00}%s\n", PlayerName2( Player ), pField[ 0 ], P_DATA[ Player ][ Age ], pField[ 1 ], pField[ 2 ] );
- format( str2, sizeof( str2 ), "%s{FF9900}Likes: {00FF00}%d\n\
- {FF9900}Profile Views: {00FF00}%d\n\
- {FF9900}Ocupation: {00FF00}%s\n\
- {FF9900}Privacy Profile: {00FF00}%d\n", str, P_DATA[ Player ][ Likes ], P_DATA[ Player ][ Views ], pField[ 3 ], P_DATA[ Player ][ Privacy ] );
- ShowPlayerDialog( playerid, FB, DIALOG_STYLE_MSGBOX, "FaceBook", str2, "Like", "Cancel" );
- pViewing[ playerid ] = Player;
- P_DATA[ Player ][ Views ]++;
- }
- else db:free_result( R );
- }
- }
- else return SendClientMessage( playerid, COLOR_RED, "ERROR: This user don't have a facebook account!" );
- }
- }
- }
- return 1;
- }
- CMD:flogin( playerid, params[ ] )
- {
- if ( P_DATA[ playerid ][ Logged ] == 1 ) return SendClientMessage( playerid, COLOR_RED, "You are already logged on you FaceBook account!" );
- ShowPlayerDialog( playerid, Dialog_LoginFAccount, DIALOG_STYLE_INPUT, "Login your FaceBook account", "{00FF00}Hi,\nPlease type your facebook password, for login into your account:", "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, "{FF0000}Delete facebook profile!", "{00FF00}Ar you sure to delete yout FaceBook account?\n\n{FF0000}WARNING!:{00FF00} All profile informations, likes, views will be deleted!\n{00FF00}Contiue operation?", "Yes", "No" );
- }
- else
- {
- SendClientMessage( playerid, COLOR_RED, "ERROR: {FFFFFF}You need to be logged in your facebook account to delete it!" );
- SendClientMessage( playerid, COLOR_RED, "USAGE: {FFFFFF}/flogin [Password]" );
- }
- }
- else return SendClientMessage( playerid, COLOR_RED, "You don't have a facebook account! To create it type /cfacebook!" );
- return 1;
- }
- CMD:fhelp( playerid, params[ ] )
- {
- new str[ 400 ];
- strcat( str, "{ABFE11}Commands:\n", 256 );
- strcat( str, "{FFFFFF}/FACEBOOK - {FF8900}Watch your profile or someone else.\n" );
- strcat( str, "{FFFFFF}/CFACEBOOK - {FF8900}Create your facebook profile.\n" );
- strcat( str, "{FFFFFF}/DFACEBOOK - {FF8900}Delete your facebook profile.\n" );
- strcat( str, "{FFFFFF}/FLOGIN - {FF8900}Login into your facebook profile.\n\n" );
- strcat( str, "{ABFE11}Credits:\n" );
- strcat( str, "{FFFFFF}xxSPEEDYxx - {FF8900}For making this filterscript.\n" );
- strcat( str, "{FFFFFF}[.E.m.O.]K1DDU - {FF8900}For help me on testings this filterscript.\n" );
- strcat( str, "{FFFFFF}0Admin( Zh3r0 ) - {FF8900}For make that likes can give once at 1 hour per player");
- ShowPlayerDialog( playerid, Dialog_FHelp, DIALOG_STYLE_MSGBOX, "Facebook by xxSPEEDYxx", str, "Quit", "" );
- 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 ), "{FF0000}Your Profile\n\n\
- {FF9900}Status: {00FF00}%s\n\
- {FF9900}Age: {00FF00}%d\n\
- {FF9900}Sex: {00FF00}%s\n\
- {FF9900}Country: {00FF00}%s\n", pField[ 0 ], P_DATA[ playerid ][ Age ], pField[ 1 ], pField[ 2 ] );
- format( str2, sizeof( str2 ), "%s{FF9900}Likes: {00FF00}%d\n\
- {FF9900}Profile Views: {00FF00}%d\n\
- {FF9900}Ocupation: {00FF00}%s\n\
- {FF9900}Privacy Profile: {00FF00}%d\n", str, P_DATA[ playerid ][ Likes ], P_DATA[ playerid ][ Views ], pField[ 3 ], P_DATA[ playerid ][ Privacy ] );
- ShowPlayerDialog( playerid, MYFB, DIALOG_STYLE_MSGBOX, "FaceBook", 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