Dialog login please help
#1

Hey guys. I was trying to make a dialog login. But it isn't that simple as I tought. I tryed this:
Код:
dcmd_login(playerid,params[])
{

  ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login","Enter your password below:","Login","Cancel");
  if (PlayerInfo[playerid][LoggedIn] == 1) return SendClientMessage(playerid,red,"ACCOUNT: You are already logged in.");
  if (!udb_Exists(PlayerName2(playerid))) return SendClientMessage(playerid,red,"ACCOUNT: Account doesn't exist, please use '/register [password]'.");

  if (strlen(params)==0) return SendClientMessage(playerid,red,"ACCOUNT: Correct usage: '/login [password]'");
  
  if (udb_CheckLogin(PlayerName2(playerid),params))
	{
   	
		new file[256], tmp3[100], string[128];
	  	format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(PlayerName2(playerid)) );
  		GetPlayerIp(playerid,tmp3,100);
	  	dini_Set(file,"ip",tmp3);
		LoginPlayer(playerid);
		PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
		if(PlayerInfo[playerid][Level] > 0) {
			format(string,sizeof(string),"ACCOUNT: Successfully Logged In. (Level %d)", PlayerInfo[playerid][Level] );
			return SendClientMessage(playerid,green,string);
    	} else return SendClientMessage(playerid,green,"ACCOUNT: Successfully Logged In");
	}
	else {
		PlayerInfo[playerid][FailLogin]++;
		printf("LOGIN: %s has failed to login, Wrong password (%s) Attempt (%d)", PlayerName2(playerid), params, PlayerInfo[playerid][FailLogin] );
		if(PlayerInfo[playerid][FailLogin] == MAX_FAIL_LOGINS)
		{
			new string[128]; format(string, sizeof(string), "%s has been kicked (Failed Logins)", PlayerName2(playerid) );
			SendClientMessageToAll(grey, string);
			print(string);
			Kick(playerid);
		}
		return SendClientMessage(playerid,red,"ACCOUNT: Login failed! Incorrect Password");
	}
 }
I added the dialog on the first line. Doesnt work though. can anyone help me please?
Reply
#2

Check some dialog tutorials to learn how to use dialogs.
Reply
#3

Quote:
Originally Posted by Don Correlli
Check some dialog tutorials to learn how to use dialogs.
LOl. directly when I saw that you posted something I knew you were going to say something like that xD
But. I just asked if someone can help me to fix this. Not to tell me where to learn
Reply
#4

Quote:
Originally Posted by bartje01
LOl. directly when I saw that you posted something I knew you were going to say something like that xD
But. I just asked if someone can help me to fix this. Not to tell me where to learn
And i did, i've helped you. At least and try to help yourself before posting (like it says in the rules). I'm sure you didn't even checked the dialog tutorial.
Reply
#5

I did checked the dialog tutorial. 4 times. I'm trying to fix this for a phew hours now. So yes, I tryed. many times. But I just can't come out
Reply
#6

Show us your OnDialogResponse code.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)