SkipRequestClass(playerid) Problem
#1

Hey guys, I'm having a problem with a custom function (SkipRequestClass(playerid)) I created to spawn a player, the function itself works 100% but its with the Dialogs that I'm having the actual problem.

I have a Register, Gender and Login Dialog. With the register dialog when a player enters a new password it then calls the Gender dialog where you choose your Gender. After choosing your gender SkipRequestClass(playerid) is called and you are then spawned automatically. But with the Login Dialog it does not work and I don't know why.

NOTE: This is a GameMode not a FilterScript.

Here is the public OnDialogResponse Code...

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	switch(dialogid)
	{
		case(DIALOG_REGISTER):
		{
			if(!response)
			{
				Kick(playerid);
			}
			else if(response)
			{
				if(!strlen(inputtext))
				{
	                			ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Registrer","{FF0000}Invalid password length!\n{FFFFFF}Please enter a valid password to register a new Account.","Register","Quit");
				}
				else
				{
					new hashpass[129], Name[MAX_PLAYER_NAME];
					GetPlayerName(playerid, Name, sizeof(Name));
					WP_Hash(hashpass, sizeof(hashpass), inputtext);
					new	INI:File = INI_Open(PlayerFilePath(playerid));
					INI_SetTag(File,"Player_Data");
					INI_WriteString(File,"UserName", Name);
					INI_WriteString(File,"Password", hashpass);
					INI_Close(File);
					ShowPlayerDialog(playerid, DIALOG_GENDER, DIALOG_STYLE_MSGBOX,"Gender","{FFFFFF}Are you a {0000FF}Male{FFFFFF}?\nOr are you a {FF60A0}Female{FFFFFF}?","Male","Female");
					return 1;
				}
				return 1;
			}
			return 1;
		}
		case(DIALOG_LOGIN):
		{
			if(!response)
			{
				Kick(playerid);
			}
			else if(response)
			{
				new hashpass[129];
				WP_Hash(hashpass, sizeof(hashpass), inputtext);
	   			if(!strcmp(hashpass, PlayerInfo[playerid][Password]))
     				{
					SendClientMessage(playerid, 0x00FF00FF,"You have succesfully logged in.\nWelcome back to a Bum's Life!");
					SkipRequestClass(playerid);
					return 1;
				}
				else
				{
					ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","{FF0000}You have entered an Incorrect password!\n{FFFFFF}Please enter your Correct password to login.","Login","Quit");
					return 1;
				}
			}
			return 1;
		}
		case(DIALOG_GENDER):
		{
			if(!response)
			{
				PlayerInfo[playerid][Skin] = 77;
				OnPlayerRegister(playerid);
				SkipRequestClass(playerid);
			}
			else if(response)
			{
				PlayerInfo[playerid][Skin] = 200;
				OnPlayerRegister(playerid);
				SkipRequestClass(playerid);
				return 1;
			}
			return 1;
		}
	}
	return 0;
}
What am I doing wrong?

Thanx in advance.
Reply
#2

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case(DIALOG_REGISTER):
        {
            if(!response)
            {
                Kick(playerid);
            }
            else if(response)
            {
                if(!strlen(inputtext))
                {
                                ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Registrer","{FF0000}Invalid password length!\n{FFFFFF}Please enter a valid password to register a new Account.","Register","Quit");
                }
                else
                {
                    new hashpass[129], Name[MAX_PLAYER_NAME];
                    GetPlayerName(playerid, Name, sizeof(Name));
                    WP_Hash(hashpass, sizeof(hashpass), inputtext);
                    new INI:File = INI_Open(PlayerFilePath(playerid));
                    INI_SetTag(File,"Player_Data");
                    INI_WriteString(File,"UserName", Name);
                    INI_WriteString(File,"Password", hashpass);
                    INI_Close(File);
                    ShowPlayerDialog(playerid, DIALOG_GENDER, DIALOG_STYLE_MSGBOX,"Gender","{FFFFFF}Are you a {0000FF}Male{FFFFFF}?\nOr are you a {FF60A0}Female{FFFFFF}?","Male","Female");
                    return 1;
                }
            }
            return 1;
        }
        case(DIALOG_LOGIN):
        {
            if(!response)
            {
                Kick(playerid);
            }
            else if(response)
            {
                new hashpass[129];
                WP_Hash(hashpass, sizeof(hashpass), inputtext);
                if(!strcmp(hashpass, PlayerInfo[playerid][Password]))
                    {
                    SendClientMessage(playerid, 0x00FF00FF,"You have succesfully logged in.\nWelcome back to a Bum's Life!");
                    SkipRequestClass(playerid);
                    return 1;
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","{FF0000}You have entered an Incorrect password!\n{FFFFFF}Please enter your Correct password to login.","Login","Quit");
                    return 1;
                }
            }
            return 1;
        }
        case(DIALOG_GENDER):
        {
            if(!response)
            {
                PlayerInfo[playerid][Skin] = 77;
                OnPlayerRegister(playerid);
                SkipRequestClass(playerid);
            }
            else if(response)
            {
                PlayerInfo[playerid][Skin] = 200;
                OnPlayerRegister(playerid);
                SkipRequestClass(playerid);
                return 1;
            }
            return 1;
        }
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","{FF0000}You have entered an Incorrect password!\n{FFFFFF}Please enter your Correct password to login.","Login","Quit");
    }
    return 0;
}
Reply
#3

Thanx for the reply although that does not solve the problem, see the problem is this...
Код:
case(DIALOG_LOGIN):
{
	if(!response)
	{
		Kick(playerid);
	}
	else if(response)
	{
		new hashpass[129];
		WP_Hash(hashpass, sizeof(hashpass), inputtext);
		if(!strcmp(hashpass, PlayerInfo[playerid][Password]))
		{
			SendClientMessage(playerid, 0x00FF00FF,"You have succesfully logged in.\nWelcome back to a Bum's Life!");
			SkipRequestClass(playerid); // This Line Does Not Execute So The Player Does Not Spawn After Logging In.
		}
		else
		{
			ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","{FF0000}You have entered an Incorrect password!\n{FFFFFF}Please enter your Correct password to login.","Login","Quit");
			return 1;
		}
		return 1;
	}
	return 1;
}
And here is the SkipRequestClass(playerid) Code...
Код:
forward SkipRequestClass(playerid);
public SkipRequestClass(playerid)
{
	new PlayerName[MAX_PLAYER_NAME];
	GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
	Load_Info(playerid);
	SpawnPlayer(playerid);
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)