Register System +Rep to those who help
#1

When I register, it goes through the tutorial fine but when I reconnect, I have to login then go through the tutorial steps again?

Код:
public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open( user_account_path ( playerid ) );
    INI_SetTag(File, "statistics" );
    INI_WriteInt(File, "Level", GetPlayerScore( playerid ) );
    INI_WriteInt(File, "Admin", PlayerInfo[ playerid ][ pAdmin ]);
    INI_WriteInt(File, "RespectPoints", PlayerInfo[ playerid ][ pConnectTime ]);
	INI_WriteInt(File, "Registered", PlayerInfo[ playerid ][ pReg ]);
	INI_WriteInt(File, "Gender", PlayerInfo[ playerid ][ pSex ]);
	INI_WriteInt(File, "Age", PlayerInfo[ playerid ][ pAge ]);
	INI_WriteInt(File, "Cash", PlayerInfo[ playerid ][ pCash ]);
	INI_WriteInt(File, "Tutorial", PlayerInfo[ playerid ][ pTut ]);
	INI_WriteInt(File, "Job", PlayerInfo[ playerid ][ pJob ]);
    INI_Close(File);
   }
   return 1;
}
Код:
public OnPlayerConnect(playerid)
{
    if( fexist ( user_account_path ( playerid ) ) )
    {
		INI_ParseFile(user_account_path ( playerid ), "load_user_%s", .bExtra = true, .extra = playerid);
  		ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Welcome.Please log-in",""COL_WHITE"Type your "COL_GREEN"password "COL_WHITE"here to log-in", #Log-in, #Quit);
  		SpawnPlayer(playerid);
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Registration!",""COL_WHITE"Type your "COL_GREEN"password "COL_WHITE"here to register", #Register, #Quit);
   		PlayerInfo[ playerid ][ pLevel ] = 0;
		PlayerInfo[ playerid ][ pAdmin ] = 0;
		PlayerInfo[ playerid ][ pConnectTime ] = 0;
		PlayerInfo[ playerid ][ pReg ] = 0;
		PlayerInfo[ playerid ][ pSex ] = 0;
		PlayerInfo[ playerid ][ pAge ] = 0;
		PlayerInfo[ playerid ][ pCash ] = 0;
		PlayerInfo[ playerid ][ pTut ] = 0;
		PlayerInfo[ playerid ][ pJob ] = 0;
    }
    return 1;
}
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick( playerid );
            if ( response )
            {
                if( !strlen ( inputtext ) ) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Welcome.Please log-in","You have entered an "COL_RED"invalid"COL_WHITE" password\n"COL_WHITE"Type your "COL_GREEN"password "COL_WHITE"here to log-in", #Register, #Quit);
				new
					hashed_password[ 129 ];
				WP_Hash( hashed_password, sizeof ( hashed_password ), inputtext );

				new INI:File = INI_Open( user_account_path( playerid ) );
                INI_SetTag(File, "statistics" );
                INI_WriteString(File, "Password", hashed_password );
                INI_WriteInt(File, "Level", 0 );
                INI_WriteInt(File, "Admin", 0 );
                INI_WriteInt(File, "RespectPoints", 0 );
				INI_WriteInt(File, "Registered", 0 );
				INI_WriteInt(File, "Gender", 0 );
				INI_WriteInt(File, "Age", 0 );
				INI_WriteInt(File, "Cash", 0 );
				INI_WriteInt(File, "Tutorial", 0 );
				INI_WriteInt(File, "Job", 0 );
                INI_Close(File);
                SetSpawnInfo( playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
                SpawnPlayer( playerid );
			}
        }
        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
				new
					hashed_password[ 129 ];
				WP_Hash( hashed_password, sizeof ( hashed_password ), inputtext );

                if( !strcmp ( hashed_password, PlayerInfo[ playerid ][ pKey ] ) )
                {
                    INI_ParseFile(user_account_path ( playerid ), "load_user_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney( playerid, PlayerInfo[ playerid ][ pCash ] );
					SetPlayerScore( playerid, PlayerInfo[ playerid ][ pLevel ] );
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
    }
TUTORIAL UNDER HERE
Reply
#2

Show your tutorial codes.
and do you want to skip tutorial upon login?
Reply
#3

I do not wan't a player to go through the tutorial again after registering.

Код:
				case 1:
				{
				    new str[1024];
				    ClearChatbox(playerid);
				    HideTutGUIFrame(playerid, 2);
					ShowTutGUIFrame(playerid, 3);
					TutStep[playerid] = 3;

					// Los Santos ATM (Camera)
					SetPlayerVirtualWorld(playerid, 0);
					SetPlayerInterior(playerid, 0);
					Streamer_UpdateEx(playerid, 2140.5173,-1163.9576,23.9922);
					SetPlayerPos(playerid, 2140.5173,-1163.9576,-10.0);
					SetPlayerCameraPos(playerid, 2145.8252,-1159.2659,27.7218);
					SetPlayerCameraLookAt(playerid, 2140.5173,-1163.9576,23.9922);
					strcat(str, "{FFFFFF}There are dozens of ATMs around the city of LS.\n");
					strcat(str, "This are placed to make managing your money more convenient.\n");
					strcat(str, "You can use /atmwithdraw and /atmdeposit.\n");
					strcat(str, "There is a small service charge for using a ATM.\n");
					strcat(str, "{FF8000}Pres next to continue.");
					ShowPlayerDialog(playerid, DIALOG_SHOW_TUTORIAL, DIALOG_STYLE_MSGBOX, "{00FF22}Tutorial |  Managing Your Money", str, "Next", "Cancel");
				}
				case 2:
				{
				    new str[1024];
				    ClearChatbox(playerid);
				    HideTutGUIFrame(playerid, 3);
					ShowTutGUIFrame(playerid, 4);
					TutStep[playerid] = 4;

					// Fishing Pier (Camera)
					SetPlayerVirtualWorld(playerid, 0);
					SetPlayerInterior(playerid, 0);
					Streamer_UpdateEx(playerid, 370.0804,-2087.8767,7.8359);
					SetPlayerPos(playerid, 370.0804,-2087.8767,-10.0);
					SetPlayerCameraPos(playerid, 423.3802,-2067.7915,29.8605);
					SetPlayerCameraLookAt(playerid, 370.0804,-2087.8767,7.8359);
					strcat(str, "{FFFFFF}The community is currently based within Los Angeles.\n");
					strcat(str, "There are restrictions you cannot pass; you cannot go to SF/LV.\n");
					strcat(str, "To earn a spot in moderation or administration, play for a long time and wait to be chosen.\n");
					strcat(str, "{FF8000}Press next to continue.");
					ShowPlayerDialog(playerid, DIALOG_SHOW_TUTORIAL, DIALOG_STYLE_MSGBOX, "{00FF22}Tutorial |  Administrators/Moderators", str, "Next", "Cancel");
				}
				case 3:
				{
				    new str[1024];
					HideTutGUIBox(playerid);
					HideTutGUIFrame(playerid, 20);
					TutStep[playerid] = 0;
					ClearChatbox(playerid);

					PlayerInfo[playerid][pTut] = 1;
					PlayerInfo[playerid][pLevel] = 1;
					PlayerInfo[playerid][pConnectTime] = 2;
					SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
					gOoc[playerid] = 0; gNews[playerid] = 0; gFam[playerid] = 0;
					TogglePlayerControllable(playerid, 1);
					PlayerInfo[playerid][pReg] = 1;
					SetCamBack(playerid);
					DeletePVar(playerid, "MedicBill");
					SetPlayerColor(playerid,TEAM_HIT_COLOR);
					SetPlayerInterior(playerid,0);
					SetPlayerPos(playerid, 1722.7611,-1915.6167,13.5647);
					SetPlayerFacingAngle(playerid, 359.4621);
					SetCameraBehindPlayer(playerid);
					SetPlayerVirtualWorld(playerid, 0);
					strcat(str, "{FFFFFF}This tutorial was designed to help you get started in the server.\n");
					strcat(str, "If you have any question you can either talk in '/newb' or '/requesthelp'\n");
					strcat(str, "Make sure to sign-up on the forums \n");
					strcat(str, "Teamspeak Server: ------------- \n");
					strcat(str, "Thank you, and we hope you have a nice experence in Los Angeles Roleplay!\n");
     				ShowPlayerDialog(playerid, DIALOG_SHOW_TUTORIAL, DIALOG_STYLE_MSGBOX, "{00FF22}Tutorial |  Wrapping things up", str, "Ok", "Cancel");
     				SendClientMessageEx(playerid, COLOR_GREEN, "------------------------------------------------------------------------");
					SendClientMessageEx(playerid, COLOR_WHITE, "You have been given 10,000$ for registering to the server!");
					SendClientMessageEx(playerid, COLOR_WHITE, "You have been given two respect points for registering to the server!");
					SendClientMessageEx(playerid, COLOR_LIGHTRED, "You may possess/use weapons");
					SendClientMessageEx(playerid, COLOR_YELLOW, "If you need any administration assistance, feel free to use /ma");
					SendClientMessageEx(playerid, COLOR_GREEN, "------------------------------------------------------------------------");
					GivePlayerMoney(playerid, 10000);
				}
			}
		}
	}
    return 1;
}
Reply
#4

- Removed -
Requesting to remove this post.
Reply
#5

Thanks, it works but tells me to press spawn and when I do it sends me to BB after reconnecting, how do I get it so it saves the position of the player??

Also all the stats don't save except the level, why?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)