[HELP] Problem with a DIALOG!
#2

Try this
Код:
OnPlayerConnect(playerid)
{
if(IsPlayerNPC(playerid)) return 1;
	GetPlayerName(playerid, plname, sizeof(plname));
	format(string, sizeof(string), "%s.ini", plname);
	if(fexist(string))
	{
		gPlayerAccount[playerid] = 1;
		new loginstring[128];
		new loginname[64];
		GetPlayerName(playerid,loginname,sizeof(loginname));
		format(loginstring,sizeof(loginstring),"Bemvindo, %s\nEste estб registrado.\nVocк pode logar agora:",loginname);
		ShowPlayerDialog(playerid,12346,DIALOG_STYLE_INPUT,"Logar",loginstring,"Logar","Cancelar");
		PlayerPlaySound(playerid, 1185, 0.0, 0.0, 0.0);
		return 1;
	}
	else
	{
		gPlayerAccount[playerid] = 0;
 		new regstring[128];
		new regname[64];
		GetPlayerName(playerid,regname,sizeof(regname));
		format(regstring,sizeof(regstring),"Bemvindo, %s\nVocк nгo tem uma conta.\nRegistre-se digitando uma senha abaixo:",regname);
		ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Registrar",regstring,"Registrar","Cancelar");
		PlayerPlaySound(playerid, 1185, 0.0, 0.0, 0.0);
		return 1;
	}
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	new sendername[MAX_PLAYER_NAME];
	new string[128];
	if(response)
	{
		if(dialogid == 12346 || dialogid == 12347)
		{
		  if(strlen(inputtext))
		  {
				new tmppass[64];
				strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
				//Encrypt(tmppass);
				OnPlayerLogin(playerid,tmppass);
			}
			else
			{
				new loginstring[128];
				new loginname[64];
				GetPlayerName(playerid,loginname,sizeof(loginname));
				format(loginstring,sizeof(loginstring),"SENHA ERRADA!\nEntre com a senha correta:",loginname);
				ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Logar",loginstring,"Logar","Cancelar");
				gPlayerLogTries[playerid] += 1;
				if(gPlayerLogTries[playerid] == 4) { Ban(playerid); }
			}
		}
		if(dialogid == 12345)
		{
		  if(strlen(inputtext))
		  {
				GetPlayerName(playerid, sendername, sizeof(sendername));
				format(string, sizeof(string), "%s.ini", sendername);
				new File: hFile = fopen(string, io_read);
				if (hFile)
				{
					SendClientMessage(playerid, COLOR_YELLOW, "Este NICK jб estб sendo usado por alguйm, escolha um diferente.");
					fclose(hFile);
					return 1;
				}
				new tmppass[64];
				strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
				//Encrypt(tmppass);
				OnPlayerRegister(playerid,tmppass);
			}
			else
			{
 				new regstring[128];
				new regname[64];
				GetPlayerName(playerid,regname,sizeof(regname));
				format(regstring,sizeof(regstring),"Bemvindo, %s\nVocк nгo tem uma conta.\nRegistre-se colocando sua senha abaixo:",regname);
				ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Registrar",regstring,"Registrar","Cancelar");
			}
		}
	}
	else
	{
		Kick(playerid);
	}
	return 1;
}
Reply


Messages In This Thread
[HELP] Problem with a DIALOG! - by linthebigs - 23.12.2009, 00:14
Re: [HELP] Problem with a DIALOG! - by Drake00 - 30.12.2009, 14:37

Forum Jump:


Users browsing this thread: 1 Guest(s)