Advertisement
Guest User

Hilfe

a guest
Apr 6th, 2013
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 10.85 KB | None | 0 0
  1. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  2. {
  3.     switch( dialogid )
  4.     {
  5.         case DIALOG_REG:
  6.         {
  7.             if ( response )
  8.             {
  9.                 if ( sscanf( inputtext, "s", inputtext[ 0 ] || strlen( inputtext[ 0 ] ) == 0 ) )
  10.                     return ShowPlayerDialog( playerid, DIALOG_REG, DIALOG_STYLE_INPUT, "{FFFFFF}Password", ""COL_RED"Error!\n\
  11.                                                                                             {FFFFFF}Please write your desired password.\n",
  12.                                                                                             ">>>", "Exit");
  13.                 if ( strlen( inputtext[ 0 ] ) < 3 || strlen( inputtext[ 0 ] ) > 20 )
  14.                     return ShowPlayerDialog( playerid, DIALOG_REG, DIALOG_STYLE_INPUT, "{FFFFFF}Password", ""COL_RED"Error!\n\
  15.                                                                                             {FFFFFF}Please write your desired password.\n\
  16.                                                                                             "COL_RED"#{FFFFFF}Min. 3 Char. Max. 20 Char.",
  17.                                                                                             ">>>", "Exit");
  18.                 new
  19.                     PlayerFile[ 13 + MAX_PLAYER_NAME ],
  20.                     pDate[ 8 + 15 ], //HH:MM:SS + DD.MM.YYYY = 18
  21.                     pYear,
  22.                     pMonth,
  23.                     pDay,
  24.                     pHour,
  25.                     pMinute,
  26.                     pSecond,
  27.                     pIP[ 20 ],
  28.                     InfBox[ 512 ]
  29.                 ;
  30.                 getdate(pYear, pMonth, pDay ),gettime(pHour, pMinute, pSecond );
  31.                 GetPlayerIp( playerid, pIP, 20 );
  32.  
  33.  
  34.                 format( PlayerFile , sizeof PlayerFile, "Accounts/%s.ini", Encode( pName( playerid ) ) );
  35.                 format( pDate, sizeof pDate, "%d:%d:%d  %d/%d/%d",pHour, pMinute, pSecond , pDay, pMonth, pYear );
  36.                 format( InfBox, sizeof InfBox, "{FFFFFF}You registered your account with success!\n\n\
  37.                                                         "COL_LIGHTBLUE"Account: {FFFFFF}%s\n\
  38.                                                         "COL_LIGHTBLUE"Password: {FFFFFF}%s\n\n\
  39.                                                         You received "COL_GREEN"$5000{FFFFFF} for registering.\n\
  40.                                                         Would you like to login?", pName( playerid ),
  41.                                                                                  inputtext       );
  42.                 ShowPlayerDialog( playerid, DIALOG_LOG, DIALOG_STYLE_MSGBOX, "Login", InfBox, "Yes", "No" );
  43.  
  44.                 new INI:file = INI_Open(Path(playerid));
  45.                 new
  46.                     INI:PlayerAcc = INI_Open( PlayerFile );
  47.  
  48.                 INI_WriteString( PlayerAcc, "NAME",               pName( playerid )    );
  49.                 INI_WriteString( PlayerAcc, "PASSWORD",           inputtext            );
  50.                 INI_WriteString( PlayerAcc, "REG_DATE",           pDate                );
  51.                 INI_WriteString( PlayerAcc, "LAST_ON",            "First connection"   );
  52.                 INI_WriteInt( PlayerAcc,    "MONEYS",             5000                 );
  53.                 INI_WriteInt( PlayerAcc,    "SCORE",              15                   );
  54.                 INI_WriteInt( PlayerAcc,    "KILLS",              0                    );
  55.                 INI_WriteInt( PlayerAcc,    "DEATHS",             0                    );
  56.                 INI_WriteInt( PlayerAcc,    "VIP_LEVEL",          0                    );
  57.                 INI_WriteInt( PlayerAcc,    "LEVEL",              0                    );
  58.                 INI_WriteInt( PlayerAcc,    "MY_SKIN",            0                    );
  59.                 INI_WriteInt( PlayerAcc,    "MY_TIME",            12                   );
  60.                 INI_WriteInt( PlayerAcc,    "MY_WEATHER",         1                    );
  61.                 INI_WriteInt(file,          "MONEYS",             0                    );
  62.                 INI_WriteInt(file,          "SCORE",             0                    );
  63.  
  64.                 INI_Close( PlayerAcc );
  65.  
  66.                 SetPVarString( playerid, "Date", pDate );
  67.                 SetPVarInt( playerid, "Logged", 0 );
  68.                 GivePlayerMoney( playerid, 5000 );
  69.                 SetPlayerScore( playerid, GetPlayerScore( playerid ) + 15 );
  70.  
  71.  
  72.             }
  73.         }
  74.         case DIALOG_REG_REQ:
  75.         {
  76.             if ( response ) cmd_register( playerid, "");
  77.             if ( !response ) return 0;
  78.  
  79.         }
  80.  
  81.         case DIALOG_LOGIN: ShowPlayerDialog( playerid, DIALOG_LOGIN2, DIALOG_STYLE_INPUT, "{FFFFFF}Password",
  82.                                                                                           "{FFFFFF}Please write your current password.",
  83.                                                                                           "Login", "Verlassen");
  84.  
  85.         case DIALOG_LOG:
  86.         {
  87.             if ( response )
  88.                 ShowPlayerDialog( playerid, DIALOG_LOGIN2, DIALOG_STYLE_INPUT, "{FFFFFF}Password",  "{FFFFFF}Please write your current password.","Login","Verlassen");
  89.         }
  90.         case DIALOG_LOGIN2:
  91.         {
  92.             if ( !response ) return Kick( playerid );
  93.             if ( response )
  94.             {
  95.                 if ( strlen( inputtext ) == 0 )
  96.                     return ShowPlayerDialog( playerid, DIALOG_LOGIN2, DIALOG_STYLE_INPUT, "{FFFFFF}Password",   ""COL_RED"Error!\n\
  97.                                                                                                                 {FFFFFF}Please write your current password.",
  98.                                                                                                                 "Login", "Verlassen");
  99.  
  100.                 new
  101.                     PlayerFile[ 13 + MAX_PLAYER_NAME ],
  102.                     Password[ 20 + 1 ]
  103.                 ;
  104.                 format( PlayerFile , sizeof PlayerFile, "Accounts/%s.ini", Encode( pName( playerid ) ) );
  105.                 INI_ParseFile( PlayerFile, "ParsePlayerPass", false, true, playerid );
  106.                 GetPVarString( playerid, "pPass", Password, sizeof Password );
  107.  
  108.                 if ( !strcmp ( inputtext, Password, false ) )
  109.                 {
  110.                     new
  111.                         sTitle[ 21 + MAX_PLAYER_NAME + 25 ],
  112.                         sBoxInfo[ 512 ],
  113.                         Pdata[ 8 + 15 ]
  114.                     ;
  115.  
  116.                     SetPVarInt( playerid, "Logged", 1 );
  117.                     format( PlayerFile , sizeof PlayerFile, "Accounts/%s.ini", Encode( pName( playerid ) ) );
  118.                     INI_ParseFile( PlayerFile, "LoadUser", false, true, playerid, true, false );
  119.                     INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
  120.                     SetPlayerScore(playerid,pInfo[playerid][Scores]);
  121.                     GivePlayerMoney(playerid,pInfo[playerid][Money]);
  122.                     GetPVarString( playerid, "Date", Pdata, 8 + 10 );
  123.  
  124.  
  125.                     if ( GetPVarInt( playerid, "CGod" ) == 1 )
  126.                     {
  127.                         SetPVarInt( playerid, "CGod", 1);
  128.                         CGod[ playerid ] = SetTimerEx( "CarGodTimer", 200, true, "i", playerid );
  129.                     }
  130.                     if ( GetPVarInt( playerid, "God" ) == 1 )
  131.                     {
  132.                         SetPVarInt( playerid, "God", 1);
  133.                         God[ playerid ] = SetTimerEx( "GodTimer", 200, true, "i", playerid );
  134.                     }
  135.                     format( sTitle, sizeof sTitle, "{FFFFFF}Welcome back, "COL_LIGHTBLUE"%s{FFFFFF}!", pName( playerid ) );
  136.                     if ( GetPVarInt( playerid, "Level" ) == 0 )
  137.                     {
  138.                     format( sBoxInfo, sizeof sBoxInfo, "{FFFFFF}These are your stats:\n\n\
  139.                                                         {FFFFFF}Rank: "COL_LIGHTBLUE"%s\n\
  140.                                                         {FFFFFF}VIP Level: "COL_LIGHTBLUE"%d\n\
  141.                                                         {FFFFFF}Score: "COL_LIGHTBLUE"%d\n\
  142.                                                         {FFFFFF}Registered on: "COL_LIGHTBLUE"%s\n\n\
  143.                                                         {FFFFFF}To view more stats please type to "COL_LIGHTBLUE"/stats\n\
  144.                                                         {FFFFFF}Type "COL_LIGHTBLUE"/mycmds{FFFFFF} to view your current commands.",
  145.                                                                                                    GetPlayerLevelName( playerid ),
  146.                                                                                                    GetPlayerVLevel( playerid ),
  147.                                                                                                    GetPVarInt( playerid, "Score" ),
  148.                                                                                                    GetPlayerScore( playerid ),
  149.                                                                                                    Pdata );
  150.                     }
  151.                     if ( GetPVarInt( playerid, "Level" ) > 1 )
  152.                     {
  153.                     format( sBoxInfo, sizeof sBoxInfo, "{FFFFFF}These are your stats:\n\n\
  154.                                                         {FFFFFF}Level: "COL_LIGHTBLUE"%s\n\
  155.                                                         {FFFFFF}VIP Level: "COL_LIGHTBLUE"%d\n\
  156.                                                         {FFFFFF}Score: "COL_LIGHTBLUE"%d\n\
  157.                                                         {FFFFFF}Registered on: "COL_LIGHTBLUE"%s\n\n",
  158.                                                                                                    GetPlayerLevelName( playerid ),
  159.                                                                                                    GetPlayerVLevel( playerid ),
  160.                                                                                                    GetPVarInt( playerid, "Score" ),
  161.                                                                                                    GetPlayerScore( playerid ),
  162.                                                                                                    Pdata );
  163.  
  164.                     format( sBoxInfo, sizeof sBoxInfo,  "%s{FFFFFF}To view more stats please type to "COL_LIGHTBLUE"/stats\n\
  165.                                                         {FFFFFF}Type "COL_LIGHTBLUE"/mycmds{FFFFFF} to view your current commands.\n\
  166.                                                         "COL_RED"Admin note:{FFFFFF}Use "COL_LIGHTBLUE"/acmds {FFFFFF}and "COL_LIGHTBLUE"/arules {FFFFFF}for commands and Admin rules.",sBoxInfo);
  167.                     }
  168.                     ShowPlayerDialog(playerid, DIALOG_LOG_DONE, DIALOG_STYLE_MSGBOX, sTitle, sBoxInfo, "Ok", "");
  169.  
  170.                 }
  171.                 else ShowPlayerDialog(playerid, DIALOG_LOGIN2, DIALOG_STYLE_INPUT, ""COL_RED"Wrong password...", ""COL_RED"Wrong password!\n{FFFFFF}Please try again.", "Login", "Kick");
  172.  
  173.  
  174.             }
  175.  
  176.  
  177. forward LoadUser( playerid, name[ ], value[ ] );
  178. public LoadUser( playerid, name[ ], value[ ] )
  179. {
  180.     if ( !strcmp(name, "LEVEL"      ) )     SetPVarInt( playerid, "Level",      strval( value ) );
  181.     if ( !strcmp(name, "MONEY"      ) )     SetPVarInt( playerid, "Money",      strval( value ) );
  182.     if ( !strcmp(name, "SCORE"      ) )     SetPVarInt( playerid, "Score",      strval( value ) );
  183.     if ( !strcmp(name, "REG_DATE"   ) )     SetPVarString( playerid, "Date",    value           );
  184.     if ( !strcmp(name, "VIP_LEVEL"  ) )     SetPVarInt( playerid, "VIP Level",  strval( value ) );
  185.     if ( !strcmp(name, "MY_WEATHER" ) )     SetPVarInt( playerid, "Weather",    strval( value ) );
  186.     if ( !strcmp(name, "MY_TIME"    ) )     SetPVarInt( playerid, "Time",       strval( value ) );
  187.     if ( !strcmp(name, "LAST_ON"    ) )     SetPVarString( playerid, "On",      value           );
  188.     if ( !strcmp(name, "KILLS"      ) )     SetPVarInt( playerid, "Kills",      strval( value ) );
  189.     if ( !strcmp(name, "DEATHS"     ) )     SetPVarInt( playerid, "Deaths",     strval( value ) );
  190.     if ( !strcmp(name, "MUTED"      ) )     SetPVarInt( playerid, "Muted",      strval( value ) );
  191.     if ( !strcmp(name, "GOD"        ) )     SetPVarInt( playerid, "God",        strval( value ) );
  192.     if ( !strcmp(name, "CAR_GOD"    ) )     SetPVarInt( playerid, "CGod",       strval( value ) );
  193. }
  194.  
  195. forward SaveUser( playerid, name[ ], value[ ] );
  196. public SaveUser( playerid, name[ ], value[ ] )
  197. {
  198.     if ( !strcmp(name, "LEVEL"      ) )     SetPVarInt( playerid, "Level",      strval( value ) );
  199.     if ( !strcmp(name, "MONEY"      ) )     SetPVarInt( playerid, "Money",      strval( value ) );
  200.     if ( !strcmp(name, "SCORE"      ) )     SetPVarInt( playerid, "Score",      strval( value ) );
  201.     if ( !strcmp(name, "REG_DATE"   ) )     SetPVarString( playerid, "Date",    value           );
  202.     if ( !strcmp(name, "VIP_LEVEL"  ) )     SetPVarInt( playerid, "VIP Level",  strval( value ) );
  203.     if ( !strcmp(name, "MY_WEATHER" ) )     SetPVarInt( playerid, "Weather",    strval( value ) );
  204.     if ( !strcmp(name, "MY_TIME"    ) )     SetPVarInt( playerid, "Time",       strval( value ) );
  205.     if ( !strcmp(name, "LAST_ON"    ) )     SetPVarString( playerid, "On",      value           );
  206.     if ( !strcmp(name, "KILLS"      ) )     SetPVarInt( playerid, "Kills",      strval( value ) );
  207.     if ( !strcmp(name, "DEATHS"     ) )     SetPVarInt( playerid, "Deaths",     strval( value ) );
  208.     if ( !strcmp(name, "MUTED"      ) )     SetPVarInt( playerid, "Muted",      strval( value ) );
  209.     if ( !strcmp(name, "GOD"        ) )     SetPVarInt( playerid, "God",        strval( value ) );
  210.     if ( !strcmp(name, "CAR_GOD"    ) )     SetPVarInt( playerid, "CGod",       strval( value ) );
  211. }
  212.  
  213.  
  214.  
  215.         }
  216.     }
  217.  
  218.     return 0;
  219. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement