Login Filtescript is clashing with Gamemode Filterscript
#1

I'm having an issue where my Login FS works improperly when an incorrect password is entered. Instead of jumping back and showing the dialog again, It jumps to OnPlayerRequestClass in my GM script. How can I fix this problem?

Login (Admin) Filterscript:
Код:
	if(dialogid == 201) //login dialog
	{
		if(response)
		{
			new pName[MAX_PLAYER_NAME];GetPlayerName(playerid, pName, sizeof(pName));
			new file[96];format(file,sizeof file,"/User_Database/%s.ini",pName);
   			INI_ParseFile(file, "GetData", .bExtra = true, .extra =playerid);
   			SendClientMessage(playerid, COLOR_GREEN,"You have succesfully logged in !");
			if (strcmp(inputtext, PlayerInfo[playerid][password]))
			{
			    new string[128];
			    if (attempt[playerid] <3)
				{
			       	attempt[playerid]++;
			       	PlayerPlaySound(playerid,1057,0,0,0);
			    	ShowPlayerDialog(playerid, 201, DIALOG_STYLE_INPUT, "Account", "Your accountname is registered! \nPlease fill in your password here:", "Login", "Quit");
	  				printf("%s has failed to login", pName);
		  			format(string,sizeof string,"Invalid password! [%i/3]",attempt[playerid]);
		  			SendClientMessage(playerid, 0xFF3200FF, string);
					attempt[playerid] = attempt[playerid]++;
				} else {
					GetPlayerName(playerid,pName,8);
				    format(string,sizeof string,"%s(%i) Has been kicked by the server(Failed to login).",pName,playerid);
				    SendClientMessageToAll(COLOR_GRAY,string);
					Kick(playerid);
				}
			}
		} else Kick(playerid);
	}
GM FS (included OnPlayerConnect to see if that is the issue):
Код:
public OnPlayerRequestClass(playerid, classid)
{
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Gender Selection", "Choose a gender:", "Male", "Female");
	SetPlayerPos(playerid, 1555.5999800,-2312.6001000,-23.4000000);
	SetPlayerFacingAngle(playerid, 160);
	SetPlayerCameraPos(playerid, 1554.5999800,-2315.6001000,-22.0000000);
	SetPlayerCameraLookAt(playerid, 1555.5999800,-2312.6001000,-23.0000000);
	return 1;
}

public OnPlayerConnect(playerid)
{
    if(!NameValidator(playerid))
	{
	      SendClientMessage(playerid,COLOR_RED,"Your name is a non-roleplay name, You have been kicked!");
	      SendClientMessage(playerid,COLOR_RED,"HINT: Your name must be in Firstname_Lastname format, (E.G: Chris_Hansen)");
	      halt(2);
	      Kick(playerid);
	}
    return 1;
}
Thank you for taking the time to read this.
Reply
#2

If there's anyone that can help me out, even if you have no idea how to fix it, at least try lol.
Reply
#3

Bump
Reply
#4

try this

if(!strcmp(inputtext, PlayerInfo[playerid][password]))
{
//What should do if the password is right
}

And you have this :
Код:
SendClientMessage(playerid, COLOR_GREEN,"You have succesfully logged in !");
before checking password.

Don't put the dialog call on OnPlayerRequestClass(), it will shown every time player change the classe right and left, put after password check !
Reply
#5

Quote:
Originally Posted by FilesMAker
Посмотреть сообщение
try this

if(!strcmp(inputtext, PlayerInfo[playerid][password]))
{
//What should do if the password is right
}
Hey that worked, I thought about this but wasn't sure if the class select dialog would work properly without moving the define and it turns out I don't need to +rep for you sir
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)