Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- switch( dialogid )
- {
- case DIALOG_REG:
- {
- if ( response )
- {
- if ( sscanf( inputtext, "s", inputtext[ 0 ] || strlen( inputtext[ 0 ] ) == 0 ) )
- return ShowPlayerDialog( playerid, DIALOG_REG, DIALOG_STYLE_INPUT, "{FFFFFF}Password", ""COL_RED"Error!\n\
- {FFFFFF}Please write your desired password.\n",
- ">>>", "Exit");
- if ( strlen( inputtext[ 0 ] ) < 3 || strlen( inputtext[ 0 ] ) > 20 )
- return ShowPlayerDialog( playerid, DIALOG_REG, DIALOG_STYLE_INPUT, "{FFFFFF}Password", ""COL_RED"Error!\n\
- {FFFFFF}Please write your desired password.\n\
- "COL_RED"#{FFFFFF}Min. 3 Char. Max. 20 Char.",
- ">>>", "Exit");
- new
- PlayerFile[ 13 + MAX_PLAYER_NAME ],
- pDate[ 8 + 15 ], //HH:MM:SS + DD.MM.YYYY = 18
- pYear,
- pMonth,
- pDay,
- pHour,
- pMinute,
- pSecond,
- pIP[ 20 ],
- InfBox[ 512 ]
- ;
- getdate(pYear, pMonth, pDay ),gettime(pHour, pMinute, pSecond );
- GetPlayerIp( playerid, pIP, 20 );
- format( PlayerFile , sizeof PlayerFile, "Accounts/%s.ini", Encode( pName( playerid ) ) );
- format( pDate, sizeof pDate, "%d:%d:%d %d/%d/%d",pHour, pMinute, pSecond , pDay, pMonth, pYear );
- format( InfBox, sizeof InfBox, "{FFFFFF}You registered your account with success!\n\n\
- "COL_LIGHTBLUE"Account: {FFFFFF}%s\n\
- "COL_LIGHTBLUE"Password: {FFFFFF}%s\n\n\
- You received "COL_GREEN"$5000{FFFFFF} for registering.\n\
- Would you like to login?", pName( playerid ),
- inputtext );
- ShowPlayerDialog( playerid, DIALOG_LOG, DIALOG_STYLE_MSGBOX, "Login", InfBox, "Yes", "No" );
- new INI:file = INI_Open(Path(playerid));
- new
- INI:PlayerAcc = INI_Open( PlayerFile );
- INI_WriteString( PlayerAcc, "NAME", pName( playerid ) );
- INI_WriteString( PlayerAcc, "PASSWORD", inputtext );
- INI_WriteString( PlayerAcc, "REG_DATE", pDate );
- INI_WriteString( PlayerAcc, "LAST_ON", "First connection" );
- INI_WriteInt( PlayerAcc, "MONEYS", 5000 );
- INI_WriteInt( PlayerAcc, "SCORE", 15 );
- INI_WriteInt( PlayerAcc, "KILLS", 0 );
- INI_WriteInt( PlayerAcc, "DEATHS", 0 );
- INI_WriteInt( PlayerAcc, "VIP_LEVEL", 0 );
- INI_WriteInt( PlayerAcc, "LEVEL", 0 );
- INI_WriteInt( PlayerAcc, "MY_SKIN", 0 );
- INI_WriteInt( PlayerAcc, "MY_TIME", 12 );
- INI_WriteInt( PlayerAcc, "MY_WEATHER", 1 );
- INI_WriteInt(file, "MONEYS", 0 );
- INI_WriteInt(file, "SCORE", 0 );
- INI_Close( PlayerAcc );
- SetPVarString( playerid, "Date", pDate );
- SetPVarInt( playerid, "Logged", 0 );
- GivePlayerMoney( playerid, 5000 );
- SetPlayerScore( playerid, GetPlayerScore( playerid ) + 15 );
- }
- }
- case DIALOG_REG_REQ:
- {
- if ( response ) cmd_register( playerid, "");
- if ( !response ) return 0;
- }
- case DIALOG_LOGIN: ShowPlayerDialog( playerid, DIALOG_LOGIN2, DIALOG_STYLE_INPUT, "{FFFFFF}Password",
- "{FFFFFF}Please write your current password.",
- "Login", "Verlassen");
- case DIALOG_LOG:
- {
- if ( response )
- ShowPlayerDialog( playerid, DIALOG_LOGIN2, DIALOG_STYLE_INPUT, "{FFFFFF}Password", "{FFFFFF}Please write your current password.","Login","Verlassen");
- }
- case DIALOG_LOGIN2:
- {
- if ( !response ) return Kick( playerid );
- if ( response )
- {
- if ( strlen( inputtext ) == 0 )
- return ShowPlayerDialog( playerid, DIALOG_LOGIN2, DIALOG_STYLE_INPUT, "{FFFFFF}Password", ""COL_RED"Error!\n\
- {FFFFFF}Please write your current password.",
- "Login", "Verlassen");
- new
- PlayerFile[ 13 + MAX_PLAYER_NAME ],
- Password[ 20 + 1 ]
- ;
- format( PlayerFile , sizeof PlayerFile, "Accounts/%s.ini", Encode( pName( playerid ) ) );
- INI_ParseFile( PlayerFile, "ParsePlayerPass", false, true, playerid );
- GetPVarString( playerid, "pPass", Password, sizeof Password );
- if ( !strcmp ( inputtext, Password, false ) )
- {
- new
- sTitle[ 21 + MAX_PLAYER_NAME + 25 ],
- sBoxInfo[ 512 ],
- Pdata[ 8 + 15 ]
- ;
- SetPVarInt( playerid, "Logged", 1 );
- format( PlayerFile , sizeof PlayerFile, "Accounts/%s.ini", Encode( pName( playerid ) ) );
- INI_ParseFile( PlayerFile, "LoadUser", false, true, playerid, true, false );
- INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
- SetPlayerScore(playerid,pInfo[playerid][Scores]);
- GivePlayerMoney(playerid,pInfo[playerid][Money]);
- GetPVarString( playerid, "Date", Pdata, 8 + 10 );
- if ( GetPVarInt( playerid, "CGod" ) == 1 )
- {
- SetPVarInt( playerid, "CGod", 1);
- CGod[ playerid ] = SetTimerEx( "CarGodTimer", 200, true, "i", playerid );
- }
- if ( GetPVarInt( playerid, "God" ) == 1 )
- {
- SetPVarInt( playerid, "God", 1);
- God[ playerid ] = SetTimerEx( "GodTimer", 200, true, "i", playerid );
- }
- format( sTitle, sizeof sTitle, "{FFFFFF}Welcome back, "COL_LIGHTBLUE"%s{FFFFFF}!", pName( playerid ) );
- if ( GetPVarInt( playerid, "Level" ) == 0 )
- {
- format( sBoxInfo, sizeof sBoxInfo, "{FFFFFF}These are your stats:\n\n\
- {FFFFFF}Rank: "COL_LIGHTBLUE"%s\n\
- {FFFFFF}VIP Level: "COL_LIGHTBLUE"%d\n\
- {FFFFFF}Score: "COL_LIGHTBLUE"%d\n\
- {FFFFFF}Registered on: "COL_LIGHTBLUE"%s\n\n\
- {FFFFFF}To view more stats please type to "COL_LIGHTBLUE"/stats\n\
- {FFFFFF}Type "COL_LIGHTBLUE"/mycmds{FFFFFF} to view your current commands.",
- GetPlayerLevelName( playerid ),
- GetPlayerVLevel( playerid ),
- GetPVarInt( playerid, "Score" ),
- GetPlayerScore( playerid ),
- Pdata );
- }
- if ( GetPVarInt( playerid, "Level" ) > 1 )
- {
- format( sBoxInfo, sizeof sBoxInfo, "{FFFFFF}These are your stats:\n\n\
- {FFFFFF}Level: "COL_LIGHTBLUE"%s\n\
- {FFFFFF}VIP Level: "COL_LIGHTBLUE"%d\n\
- {FFFFFF}Score: "COL_LIGHTBLUE"%d\n\
- {FFFFFF}Registered on: "COL_LIGHTBLUE"%s\n\n",
- GetPlayerLevelName( playerid ),
- GetPlayerVLevel( playerid ),
- GetPVarInt( playerid, "Score" ),
- GetPlayerScore( playerid ),
- Pdata );
- format( sBoxInfo, sizeof sBoxInfo, "%s{FFFFFF}To view more stats please type to "COL_LIGHTBLUE"/stats\n\
- {FFFFFF}Type "COL_LIGHTBLUE"/mycmds{FFFFFF} to view your current commands.\n\
- "COL_RED"Admin note:{FFFFFF}Use "COL_LIGHTBLUE"/acmds {FFFFFF}and "COL_LIGHTBLUE"/arules {FFFFFF}for commands and Admin rules.",sBoxInfo);
- }
- ShowPlayerDialog(playerid, DIALOG_LOG_DONE, DIALOG_STYLE_MSGBOX, sTitle, sBoxInfo, "Ok", "");
- }
- else ShowPlayerDialog(playerid, DIALOG_LOGIN2, DIALOG_STYLE_INPUT, ""COL_RED"Wrong password...", ""COL_RED"Wrong password!\n{FFFFFF}Please try again.", "Login", "Kick");
- }
- forward LoadUser( playerid, name[ ], value[ ] );
- public LoadUser( playerid, name[ ], value[ ] )
- {
- if ( !strcmp(name, "LEVEL" ) ) SetPVarInt( playerid, "Level", strval( value ) );
- if ( !strcmp(name, "MONEY" ) ) SetPVarInt( playerid, "Money", strval( value ) );
- if ( !strcmp(name, "SCORE" ) ) SetPVarInt( playerid, "Score", strval( value ) );
- if ( !strcmp(name, "REG_DATE" ) ) SetPVarString( playerid, "Date", value );
- if ( !strcmp(name, "VIP_LEVEL" ) ) SetPVarInt( playerid, "VIP Level", strval( value ) );
- if ( !strcmp(name, "MY_WEATHER" ) ) SetPVarInt( playerid, "Weather", strval( value ) );
- if ( !strcmp(name, "MY_TIME" ) ) SetPVarInt( playerid, "Time", strval( value ) );
- if ( !strcmp(name, "LAST_ON" ) ) SetPVarString( playerid, "On", value );
- if ( !strcmp(name, "KILLS" ) ) SetPVarInt( playerid, "Kills", strval( value ) );
- if ( !strcmp(name, "DEATHS" ) ) SetPVarInt( playerid, "Deaths", strval( value ) );
- if ( !strcmp(name, "MUTED" ) ) SetPVarInt( playerid, "Muted", strval( value ) );
- if ( !strcmp(name, "GOD" ) ) SetPVarInt( playerid, "God", strval( value ) );
- if ( !strcmp(name, "CAR_GOD" ) ) SetPVarInt( playerid, "CGod", strval( value ) );
- }
- forward SaveUser( playerid, name[ ], value[ ] );
- public SaveUser( playerid, name[ ], value[ ] )
- {
- if ( !strcmp(name, "LEVEL" ) ) SetPVarInt( playerid, "Level", strval( value ) );
- if ( !strcmp(name, "MONEY" ) ) SetPVarInt( playerid, "Money", strval( value ) );
- if ( !strcmp(name, "SCORE" ) ) SetPVarInt( playerid, "Score", strval( value ) );
- if ( !strcmp(name, "REG_DATE" ) ) SetPVarString( playerid, "Date", value );
- if ( !strcmp(name, "VIP_LEVEL" ) ) SetPVarInt( playerid, "VIP Level", strval( value ) );
- if ( !strcmp(name, "MY_WEATHER" ) ) SetPVarInt( playerid, "Weather", strval( value ) );
- if ( !strcmp(name, "MY_TIME" ) ) SetPVarInt( playerid, "Time", strval( value ) );
- if ( !strcmp(name, "LAST_ON" ) ) SetPVarString( playerid, "On", value );
- if ( !strcmp(name, "KILLS" ) ) SetPVarInt( playerid, "Kills", strval( value ) );
- if ( !strcmp(name, "DEATHS" ) ) SetPVarInt( playerid, "Deaths", strval( value ) );
- if ( !strcmp(name, "MUTED" ) ) SetPVarInt( playerid, "Muted", strval( value ) );
- if ( !strcmp(name, "GOD" ) ) SetPVarInt( playerid, "God", strval( value ) );
- if ( !strcmp(name, "CAR_GOD" ) ) SetPVarInt( playerid, "CGod", strval( value ) );
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement