Szerző Téma: Facebook szkript probléma  (Megtekintve 480 alkalommal)

Facebook szkript probléma
« Dátum: 2014. augusztus 12. - 02:24:10 »
0 Show voters
Sziasztok! Találtam hiv forumon egy fb rendszert, nekiálltam magyarítani, meg kivenni 1-2 hülyeséget. Aztán sikerült úgy elcsesznem, hogy ha pl státusznak beírom, hogy \"asztal, de nem szék\", akkor mindenkinek azt rakja ki a státusz sávba. Mi lehet a gáz? Köszi
 

#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, \"Belépés a Facebook fiókba\", \"Írd be a jelszót!\", \"Belépés\", \"Mégse\" );
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}Sikeres belépés!\\n\");
         ShowPlayerDialog( playerid, ONLOG, DIALOG_STYLE_MSGBOX, \"Facebook\", Str, \"Profilom\", \"Mégse\" );
         P_DATA[ playerid ][ Logged ] = 1;
      }
      else return ShowPlayerDialog( playerid, Dialog_LoginFAccount, DIALOG_STYLE_INPUT, \"Belépés a Facebook fiókba\", \"{FFFFFF}Érvénytelen jelszó! Írd be újra:\", \"Login\", \"Cancel\" );
            db:free_result( R2 );
    }
   else return ShowPlayerDialog( playerid, Dialog_LoginFAccount2, DIALOG_STYLE_MSGBOX, \"Belépés a Facebook fiókba\", \"{FFFFFF}Ennek a játékosnak nincs Facebook fiókja!\\n A \'Készít\' gombbal csinálhatsz egyet!\", \"Mégse\", \"Készít\" );
   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}Módosítás\", \"{FF0000}Írd be a státuszod amit meg akarsz jeleníteni\\n{FF0000} a profilodon:\", \"Választ\", \"Vissza\" );
return 1;
}
if ( dialogid == ONLOG )
{
    if( !response ) return 1;
        FormatFBDialog( playerid );
}
if( dialogid == MYFB )
{
         if( !response )
         {
   new str[ 500 ];
   strcat( str, \"{FFFF00}Módosít: {FFFFFF}Státusz\\n\\
              {FFFF00}Módosít: {FFFFFF}Kor\\n\\
              {FFFF00}Módosít: {FFFFFF}Nem\\n\\
              {FFFF00}Módosít: {FFFFFF}Ország\\n\\
              {FF0000}Visszaállít: {FFFFFF}Lájkok\\n\\
              {FF0000}Visszaállít: {FFFFFF}Profil nézettség\\n\\
              {FFFF00}Módosít: {FFFFFF}Foglalkozás\\n\\
              {FFFF00}Módosít: {FFFFFF}Publikus profil [0-nem ~ 1-igen]\\n\\
              {FF9900}Kilép\" );
   ShowPlayerDialog( playerid, MOD, DIALOG_STYLE_LIST, \"Profile változtatások\", str, \"Választ\", \"\" );
}
}
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, \"Hiba: A játékosnak be kell lépnie a Facebook fiókjába, hogy megkaphassa a lájkot!\" );
   
    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, \"Hiba: Óránként 1 like megengedett!\" );
                       format( string, sizeof( string ), \"Ekkor lájkolhatsz újra: %d:%d !\", Time[ 0 ], Time[ 1 ] );
                       SendClientMessage( playerid, COLOR_RED, string );
                       return 1;
               }
            }
            else if ( T2[ 0 ] < Time[ 0 ] )
                 {
                   SendClientMessage( playerid, COLOR_RED, \"Hiba: Óránként 1 like megengedett!\" );
                   format( string, sizeof( string ), \"Ekkor lájkolhatsz újra: %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}lájkolta {FF9900}%s (ID:%d){AFAFAF} Facebook profilját!\", 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, \"Sikeresen törölted a Facebook fiókod!\" );
P_DATA[ playerid ][ Logged ] = 0;
}
if ( dialogid == MOD )
{
    if ( response )
    {
        if ( listitem == 0 )
        {
      ShowPlayerDialog( playerid, StatusSet, DIALOG_STYLE_INPUT, \"{FF9900}Módosítás\", \"{FF0000}Írd be a státuszod amit meg akarsz jeleníteni\\n{FF0000} a profilodon:\", \"Választ\", \"Vissza\" );
   }
   if ( listitem == 1 )
   {
       ShowPlayerDialog( playerid, AgeSet, DIALOG_STYLE_INPUT, \"{FF9900}Módosítás\", \"{FF0000}Írd be az életkorod:\", \"Választ\", \"Vissza\" );
   }
   if ( listitem == 2 )
   {
       ShowPlayerDialog( playerid, SexSet, DIALOG_STYLE_LIST, \"{FF9900}Módosítás\", \"{FF0000}Férfi\\n{FFFFFF}Nõ\", \"Választ\", \"Vissza\" );
   }
   if ( listitem == 3 )
   {
       ShowPlayerDialog( playerid, CountrySet, DIALOG_STYLE_LIST, \"{FF9900}Módosítás\", \"Románia\\nAnglia\\nLengyelország\\nSzlovákia\\nOlaszország\\nSpanyolország\\nPortugália\\nNémetország\\nSvédország\\nBulgária\\nArab\", \"Választ\", \"Vissza\" );
   }
   if ( listitem == 4 )
   {
       ShowPlayerDialog( playerid, Warning1, DIALOG_STYLE_INPUT, \"{FF0000}Visszaállít\", \"{FF0000}Figyelem! {FFFFFF}Biztos visszaállítod a lájkokat?\", \"Igen\", \"Nem/Vissza\" );
   }
   if ( listitem == 5 )
   {
       ShowPlayerDialog( playerid, Warning2, DIALOG_STYLE_INPUT, \"{FF0000}Visszaállít\", \"{FF0000}Figyelem! {FFFFFF}Biztos visszaállítod a profil-nézettséget?\", \"Igen\", \"Nem/Vissza\" );
   }
   if ( listitem == 6 )
   {
       ShowPlayerDialog( playerid, OcupationSet, DIALOG_STYLE_INPUT, \"{FF9900}Módosítás\", \"{FF0000}Írd be a foglalkozásod\\n Pl.: Autószerelõ\", \"Választ\", \"Vissza\" );
   }
   if ( listitem == 7 )
   {
       ShowPlayerDialog( playerid, PrivacySet, DIALOG_STYLE_INPUT, \"{FF9900}Módosítás\", \"{FF0000}Írj 0-t ha más megnézheti a profilod \\n Írj 1-t ha nem nézheti meg más a profilod\", \"Választ\", \"Vissza\" );
   }
   if ( listitem == 8 )
   {
       return 1;
   }
}
else
{
    new str[ 500 ];
   strcat( str, \"{FFFF00}Módosít: {FFFFFF}Státusz\\n\\
              {FFFF00}Módosít: {FFFFFF}Kor\\n\\
              {FFFF00}Módosít: {FFFFFF}Nem\\n\\
              {FFFF00}Módosít: {FFFFFF}Ország\\n\\
              {FF0000}Visszaállít: {FFFFFF}Lájkok\\n\\
              {FF0000}Visszaállít: {FFFFFF}Profil nézettség\\n\\
              {FFFF00}Módosít: {FFFFFF}Foglalkozás\\n\\
              {FFFF00}Módosít: {FFFFFF}Publikus profil [0-nem ~ 1-igen]\\n\\
              {FF9900}Kilép\" );
   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, \"~g~Sikeres beallitas!\", 5000,5 );
        if ( GetPVarInt( playerid, \"CreatingProfile\" ) == 1 )
        {
            ShowPlayerDialog( playerid, AgeSet, DIALOG_STYLE_INPUT, \"{FF9900}Módosítás\", \"{FF0000}Add meg az életkorod:\", \"Választ\", \"Vissza\" );
}
return 1;
}
if ( dialogid == AgeSet )
{
    if ( !response ) return FormatFBDialog( playerid );
    if ( sscanf( inputtext, \"i\", inputtext[ 0 ] ) ) return ShowPlayerDialog( playerid, AgeSet, DIALOG_STYLE_INPUT, \"{FF9900}Módosítás\", \"{FF0000}Normál értéket írj be!\", \"Tovább\", \"Mégse\" );
        if ( inputtext[ 0 ] < 0 || inputtext[ 0 ] > 99 ) return ShowPlayerDialog( playerid, DIALOG_STYLE_INPUT, AgeSet, \"{FF9900}Módosítás\", \"{FF0000}Hiba: {FFFFFF}Az igazi életkorod írd be!\", \"Tovább\", \"Mégse\" );
       
        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, \"~g~Sikeres beallitas!\", 5000,5 );
P_DATA[ playerid ][ Age ] = inputtext[ 0 ];
if ( GetPVarInt( playerid, \"CreatingProfile\" ) == 1 )
{
    ShowPlayerDialog( playerid, SexSet, DIALOG_STYLE_LIST, \"{FF9900}Válassz nemet!\", \"{FF0000}Férfi\\n{FFFFFF}Nõ\", \"Választ\", \"Vissza\" );
}
return 1;
}
if ( dialogid == SexSet )
{
    if ( !response ) return FormatFBDialog( playerid );
        if ( listitem == 0 )
        {
            new Query[ 256 ];
        format( Query, sizeof( Query ), \"UPDATE `FProfiles` SET `Sex` = \'Férfi\' WHERE `Nume` = \'%s\'\", PlayerName2( playerid ) );
        db:query( Database, Query );
        GameTextForPlayer( playerid, \"~g~Sikeres beallitas!\", 5000, 5 );
        if ( GetPVarInt( playerid, \"CreatingProfile\" ) == 1 )
   {
                ShowPlayerDialog( playerid, CountrySet, DIALOG_STYLE_LIST, \"{FF9900}Módosítás\", \"Románia\\nAnglia\\nLengyelország\\nSzlovákia\\nOlaszország\\nSpanyolország\\nPortugália\\nNémetország\\nSvédország\\nBulgária\\nArab\", \"Választ\", \"Vissza\" );
   }
}
if ( listitem == 1 )
{
            new Query[ 256 ];
        format( Query, sizeof( Query ), \"UPDATE `FProfiles` SET `Sex` = \'Nõ\' WHERE `Nume` = \'%s\'\", PlayerName2( playerid ) );
        db:query( Database, Query );
        GameTextForPlayer( playerid, \"~g~Sikeres beallitas!\", 5000, 5 );
        if ( GetPVarInt( playerid, \"CreatingProfile\" ) == 1 )
   {
                ShowPlayerDialog( playerid, CountrySet, DIALOG_STYLE_LIST, \"{FF9900}Módosítás\", \"Románia\\nAnglia\\nLengyelország\\nSzlovákia\\nOlaszország\\nSpanyolország\\nPortugália\\nNémetország\\nSvédország\\nBulgária\\nArab\", \"Választ\", \"Vissza\" );
   }
}
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, \"~g~Sikeres beallitas!\", 5000, 5 );
        if ( GetPVarInt( playerid, \"CreatingProfile\" ) == 1 )
{
            ShowPlayerDialog( playerid, OcupationSet, DIALOG_STYLE_INPUT, \"{FF9900}Módosítás\", \"{FF0000}Írj be foglalkozást!\\nPl.: Autószerelõ\", \"Választ\", \"Vissza\" );
}
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}Visszaállítás\", \"{00FF00}visszaállítottad a profil-like-okat\", \"Vissza\", \"\" );
        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}Visszaállítás\", \"{00FF00}Visszaállítottad a profil-nézettségedet!\", \"Vissza\", \"\" );
        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, \"~g~Sikeres beallitas!\", 5000, 5 );
        if ( GetPVarInt( playerid, \"CreatingProfile\" ) == 1 )
{
            ShowPlayerDialog( playerid, PrivacySet, DIALOG_STYLE_INPUT, \"{FF9900}Módosítás\", \"{FF0000}Akarod, hogy privát legyen a profilod? Ha igen, írj 1-t\", \"Választ\", \"Vissza\" );
}
return 1;
}
if ( dialogid == PrivacySet )
{
    if ( !response ) return FormatFBDialog( playerid );
        if ( sscanf( inputtext, \"i\", inputtext[ 0 ] ) ) return ShowPlayerDialog( playerid, PrivacySet, DIALOG_STYLE_INPUT, \"{FF9900}Módosítás\", \"{FF0000}Csak számokat írj be!\", \"Választ\", \"Vissza\" );
        if ( inputtext[ 0 ] < 0 || inputtext[ 0 ] > 1 ) return ShowPlayerDialog( playerid, PrivacySet, DIALOG_STYLE_INPUT, \"{FF9900}Módosítás\", \"{FF0000}Hiba! Az értékek lehetnek 1 és 0\\n{FFFFFF}{FF0000}Írj 0-t ha más megnézheti a profilod \\n Írj 1-t ha nem nézheti meg más a profilod\", \"Változtat\", \"Vissza\" );
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}Új profil\", \"Be kell írnod egy jelszót a fiókodhoz!\", \"Folytatás\", \"Mégse\" );
        if ( strlen( FPassword ) < 3 || strlen( FPassword ) > 24 ) return ShowPlayerDialog( playerid, OnCreateFaceBook, 1, \"{FF9900}Új profil\", \"A jelszónak 3 és 24 karakter között kell lennie!\", \"Folytatás\", \"Mégse\" );
        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, \"Sikeres regisztráció! Kövesd a lépéseket profilod beállításához: kor, státusz, nem...\" );
format( str, sizeof( str ), \"{00FF00}Sikeresen létrehoztad a profilod:\\nFelhasználónév - {FF9900}%s\\n{00FF00}Jelszó - {FF9900}%s{00FF00}.\\n\\nBeállításokhoz kattints a \'Beállítás\' gombra!\", PlayerName2( playerid ), FPassword );
ShowPlayerDialog( playerid, OnCreateFaceBook+1, DIALOG_STYLE_MSGBOX, \"Facebook\", str, \"Beállítás\", \"Mégse\" );
}
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}Ennek a felhasználónak van Facebook profilja. /flogin\" );
}
else
{
        SendClientMessage( playerid, COLOR_RED, \"{FFFF00}INFO: {FFFFFF}Ennek a felhasználónak nincs Facebook fiókja! Készítéshez: /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, \"Már van profilod és be is jelentkeztél!\" );
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, \"Hiba: Már van profilod. Használd: {FFFFFF}/flogin\" );
}
else
{
    new str[ 256 ];
    format( str, sizeof( str ), \"{00FF00}Üdv {ACACAC}%s{00FF00}, segítség a profilod létrehozásához\\n\\
                         \\n\\
                         Írd be a jelszavad:\", PlayerName2( playerid ) );
   ShowPlayerDialog( playerid, OnCreateFaceBook, 1, \"{FF9900}Új profil\", str, \"Folytatás\", \"Mégse\" );
}
}
return 1;
}
CMD:facebook( playerid, params[ ] )
{
new Player, str[ 400 ], str2[ 512 ];
if ( sscanf( params, \"u\", Player ) )
{
    if ( P_DATA[ playerid ][ Logged ] == 0 ) return SendClientMessage( playerid, COLOR_RED, \"Hiba! Belépés szükséges! /flogin\" );
    FormatFBDialog( playerid );
SendClientMessage( playerid, COLOR_GREY, \"A profilod nézed! Más profiljának megtekintéséhez használd: {FF9900}/facebook [iD]\" );
}
else
{
    if ( Player == playerid )
    {
        FormatFBDialog( playerid );
   SendClientMessage( playerid, COLOR_GREY, \"A profilod nézed! Más profiljának megtekintéséhez használd: {FF9900}/facebook [iD]\" );
}
else
{
   new Query[ 400 ], DBResult:R, DBResult:R2, pField[ 4 ][ 200 ];
   if ( !IsPlayerConnected( Player ) ) return SendClientMessage( playerid, COLOR_RED, \"Hiba! Nincs ilyen játékos!\" );
   if ( P_DATA[ Player ][ Privacy ] == 1 ) return SendClientMessage( playerid, COLOR_RED, \"Ha a Publikus profil ki van kapcsolva, nem lehet megtekinteni ezt a profilt!\" );
   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 profilja:\\n\\n\\
                                     {FF9900}Státusz: {00FF00}%s\\n\\
                                     {FF9900}Kor: {00FF00}%d\\n\\
                                     {FF9900}Nem: {00FF00}%s\\n\\
                                     {FF9900}Ország: {00FF00}%s\\n\", PlayerName2( Player ), pField[ 0 ], P_DATA[ Player ][ Age ], pField[ 1 ], pField[ 2 ] );
               format( str2, sizeof( str2 ), \"%s{FF9900}Lájkok: {00FF00}%d\\n\\
                                     {FF9900}Profil nézettség: {00FF00}%d\\n\\
                                     {FF9900}Foglalkozás: {00FF00}%s\\n\\
                                     {FF9900}Publikus profil [0-nem ~ 1-igen]: {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\", \"Mégse\" );
                   pViewing[ playerid ] = Player;
               P_DATA[ Player ][ Views ]++;
            }
            else db:free_result( R );
         }
      }
      else return SendClientMessage( playerid, COLOR_RED, \"Hiba! Ennek a játékosnak nincs Facebook-ja!\" );
   }
}
}
return 1;
}
CMD:flogin( playerid, params[ ] )
{
    if ( P_DATA[ playerid ][ Logged ] == 1 ) return SendClientMessage( playerid, COLOR_RED, \"Már beléptél!\" );
ShowPlayerDialog( playerid, Dialog_LoginFAccount, DIALOG_STYLE_INPUT, \"Belépés a Facebook-ba\", \"{00FF00}Írd be a jelszót a belépéshez:\", \"Belépés\", \"Mégse\" );
return 1;
}
CMD:dfacebook( playerid, params[ ] )
{
new Query[ 400 ], 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}Fiók törlése\", \"{00FF00}Biztos törölni akarod a fiókod??\\n\\n{FF0000}Figyelem!{00FF00} Minden Facebook adatod törölve lesz!\\n{00FF00}Folytatod?\", \"Igen\", \"Nem\" );
}
else
{
    SendClientMessage( playerid, COLOR_RED, \"Hiba: {FFFFFF}Be kell lépned, hogy törölhesd!\" );
    SendClientMessage( playerid, COLOR_RED, \"Használat: {FFFFFF}/flogin\" );
}
}
else return SendClientMessage( playerid, COLOR_RED, \"Nincs Facebook fiókod! Készítéshez: /cfacebook\" );
return 1;
}
CMD:fhelp( playerid, params[ ] )
{
new str[ 300 ];
strcat( str, \"{FFFFFF}/FACEBOOK - {FF8900}Profil megtekintése\\n\" );
strcat( str, \"{FFFFFF}/CFACEBOOK - {FF8900}Facebook fiók készítése\\n\" );
strcat( str, \"{FFFFFF}/DFACEBOOK - {FF8900}Facebookfiók törlése\\n\" );
strcat( str, \"{FFFFFF}/FLOGIN - {FF8900}Belépés a Facebook fiókba\\n\\n\" );
ShowPlayerDialog( playerid, Dialog_FHelp, DIALOG_STYLE_MSGBOX, \"Segítség\", str, \"Quit\", \"\" );
return 1;
}
//=============================== [ Stock\'s ] ================================//
stock FormatFBDialog( playerid )
{
    new Query[ 400 ], str[ 400 ], str2[ 600 ], DBResult:R, pField[ 4 ][ 200 ];
    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}Profilod\\n\\n\\
                         {FF9900}Státusz: {00FF00}%s\\n\\
                         {FF9900}Kor: {00FF00}%d\\n\\
                         {FF9900}Nem: {00FF00}%s\\n\\
                         {FF9900}Ország: {00FF00}%s\\n\", pField[ 0 ], P_DATA[ playerid ][ Age ], pField[ 1 ], pField[ 2 ] );
   format( str2, sizeof( str2 ), \"%s{FF9900}Lájkok: {00FF00}%d\\n\\
                         {FF9900}Profil nézettség: {00FF00}%d\\n\\
                         {FF9900}Foglalkozás: {00FF00}%s\\n\\
                         {FF9900}Publikus profil [0-nem ~ 1-igen]: {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, \"Mégse\", \"Beállítás\" );
}
else db:free_result( R );
}
return 1;
}
stock PlayerName2( i ) { new n[ 24 ]; GetPlayerName( i, n, 24 ); return n; }

 
Itt az eredeti példány:
 

#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; }

 
Tudom, hogy átírtam pár dolgot aminek nem úgy kéne lenni, ahogy, ilyen például hogy a foglalkozás részt átírtam az országra, de ez nem lényeg.
« Utoljára szerkesztve: 2014. október 19. - 15:56:06 írta Flash »

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal