SA-MP Forums Archive
Login system needing help! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Login system needing help! (/showthread.php?tid=393983)



Login system needing help! - James Bob - 20.11.2012

Okay, so I have my login system scripted but ATM you can type any password and you are logged in.. I can't find the problem/error.. When I compile no error's at all

Code:
ShowMainMenuDialog(playerid, frame)
{
	new titlestring[64];
	new string[256];

	switch(frame)
	{
		case 1:
		{
			new ip[32];
			GetPlayerIp(playerid, ip, 32);
			format(titlestring, sizeof(titlestring), "Login - %s", GetPlayerNameEx(playerid));
			format(string, sizeof(string), "Welcome to High Street's Roleplay, %s.\n\nIP Address: 66.146.239.20:7777\n\nThe name that you are using is registered, please enter a password to login:", GetPlayerNameEx(playerid),  ip);
			ShowPlayerDialog(playerid,MAINMENU,DIALOG_STYLE_PASSWORD,titlestring,string,"Login","Exit");
		}
		case 2:
		{
			new ip[32];
			GetPlayerIp(playerid, ip, 32);
			format(titlestring, sizeof(titlestring), "Register - %s", GetPlayerNameEx(playerid));
			format(string, sizeof(string), "High Street's Roleplay, %s.\n\nIP Address: 66.146.239.20:7777 %s\n\nYou may register an account by entering a desired password here:", GetPlayerNameEx(playerid),  ip);
			ShowPlayerDialog(playerid,MAINMENU2,DIALOG_STYLE_PASSWORD,titlestring,string,"Register","Exit");
		}
		case 3:
		{
			new ip[32];
			GetPlayerIp(playerid, ip, 32);
			format(titlestring, sizeof(titlestring), "Login - %s", GetPlayerNameEx(playerid));
			format(string, sizeof(string), "Invalid Password!\n\nWelcome to High Street's Roleplay, %s.\n\nIP Address: 66.146.239.20:7777 %s\n\nThe name that you are using is registered, please enter a password to login:", GetPlayerNameEx(playerid),  ip);
			ShowPlayerDialog(playerid,MAINMENU,DIALOG_STYLE_PASSWORD,titlestring,string,"Login","Exit");
		}
	}
}
If you can help, I'll +Rep


Re: Login system needing help! - Mustafa6155 - 20.11.2012

What do u mean?


Re: Login system needing help! - [Dejo] - 20.11.2012

Dude, if you want that for some server, there are a lot of filterscripts login register system! just use them


Re: Login system needing help! - tyler12 - 20.11.2012

OnDialogResponse sir.


Re: Login system needing help! - park4bmx - 20.11.2012

you need to show the response of dialogid: MAINMENU


Re: Login system needing help! - James Bob - 20.11.2012

Code:
	if(dialogid == MAINMENU || dialogid == MAINMENU2)
	{
		if(dialogid == MAINMENU)
		{
			if( response == 0 )
			{
				SendClientMessageEx(playerid, COLOR_RED, "SERVER: You have been kicked out automatically.");
				Kick(playerid);
			}
			else
			{
				if(strlen(inputtext))
				{
					new tmppass[64];
					strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
					Encrypt(tmppass);
					if(PlayerInfo[playerid][pAdmin] > 0) {
					    ShowPlayerDialog(playerid, ADMINPIN, DIALOG_STYLE_INPUT, "Admin Pin Confirmation", "Please enter the pin that was assigned to your administrator account to continue.", "Login", "Cancel");
						PinLoginPass[playerid] = tmppass;
						SetTimerEx("AdminPinLogin",50*1000,0,"i",playerid);
					} else {
						OnPlayerLogin(playerid,tmppass);
					}
				}
				else
				{
					new loginname[64];
					GetPlayerName(playerid,loginname,sizeof(loginname));
					ShowPlayerDialog(playerid,MAINMENU,DIALOG_STYLE_INPUT,"Login","Incorrect password. \n \nThat name is registered, you may now enter your password.","Login","Exit");
					gPlayerLogTries[playerid] += 1;
					if(gPlayerLogTries[playerid] == 2) { SendClientMessageEx(playerid, COLOR_RED, "SERVER: Wrong password, you have been kicked out automatically."); Kick(playerid); }
				}
			}
		}
		if(dialogid == MAINMENU2)
		{
			if(strlen(inputtext))
			{
				GetPlayerName(playerid, sendername, sizeof(sendername));
				if(doesAccountExist(sendername))
				{
					SendClientMessageEx(playerid, COLOR_YELLOW, "That username is already taken, please choose a different one.");
					return 1;
				}
				new tmppass[64];
				strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
				Encrypt(tmppass);
				OnPlayerRegister(playerid,tmppass);
			}
		}
	}



Re: Login system needing help! - park4bmx - 20.11.2012

change
pawn Code:
if(strlen(inputtext))
To:
pawn Code:
if(!strcmp(inputtext,password,false))
//the "password" would be the variable to check their account's password
:NOTE: strlen si used to measure string length !


Re: Login system needing help! - James Bob - 20.11.2012

C:\Users\***** *****\Desktop\Test\gamemodes\HSRP.pwn(7615 : error 017: undefined symbol "password"
C:\Users\***** *****\Desktop\Test\gamemodes\HSRP.pwn(76183) : error 017: undefined symbol "password"


Re: Login system needing help! - park4bmx - 20.11.2012

and now let me just quote my self.
Quote:
Originally Posted by park4bmx
View Post
//the "password" would be the variable to check their account's password
you will need to get the players save password and replace it with what ever variable you load it as


Re: Login system needing help! - James Bob - 21.11.2012

Quote:
Originally Posted by park4bmx
View Post
and now let me just quote my self.

you will need to get the players save password and replace it with what ever variable you load it as
Park, would you have skype/TeamViewer? You have cofused me.. Haha.

If you have skype can you add me? im_smithhyyy