[DUV] Login Box
#4

Bom comeзando..
Ja que seu GM й do thug vai ser mais facil.
Adcione os seguintes codigos:
Code:
public OnPlayerRequestClass(playerid, classid)
{
 	new string[128];
	PlayerPlaySound(playerid, 1185, 0.0, 0.0, 0.0);
	PlayerInfo[playerid][pModel] = Peds[classid][0];

 	if (RegistrationStep[playerid] == 0 && gPlayerLogged[playerid] != 1)
	{
		ClearChatbox(playerid, 10);
		format(string, sizeof(string), "Bem vindo ao %s", SCRIPT_VERSION);
		SendClientMessage(playerid, COLOR_YELLOW, string);
		SendClientMessage(playerid, COLOR_YELLOW2, " ");
		if (gPlayerConta[playerid] != 0)
		{
		  new loginstring[128];
			new loginname[64];
			GetPlayerName(playerid,loginname,sizeof(loginname));
			format(loginstring,sizeof(loginstring),"Bem vindo, %s\nEste nick esta registrado.\nVoce pode logar agora:",loginname);
			ShowPlayerDialog(playerid,12346,DIALOG_STYLE_INPUT,"Logar",loginstring,"Logar","Sair");
		}
		else
		{
		  new regstring[128];
			new regname[64];
			GetPlayerName(playerid,regname,sizeof(regname));
			SendClientMessage(playerid, 0xD900D3C8, "Voce ainda nao esta registrado use Nome_Sobrenome Ex:Joao_Santos");
			format(regstring,sizeof(regstring),"Bem vindo, %s\nvoce nao tem uma conta.\nPor favor registre-se:",regname);
			ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Registrar",regstring,"Registrar","Sair");
		}
		SetPlayerInterior(playerid, 0);
		SetPlayerPos(playerid, 1558.7385,-1675.7007,16.1953);
		SetPlayerFacingAngle(playerid, 160.0);
		SetPlayerCameraPos(playerid, 1506.7966,-1645.9325,22.3203);
		SetPlayerCameraLookAt(playerid, 1537.1453,-1670.2620,12.6740);
		PlayerInfo[playerid][pModel] = Peds[classid][0];
		SetPlayerTeamFromClass(playerid,classid);
	}
Code:
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 Erada\nPor favor informe a senha correta:",loginname);
				ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Logar",loginstring,"Logar","Sair");
				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 nome de usuario ja esta sendo usando , por favor escolha otro");
					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),"Bem vindo, %s\nVoce nao tem uma conta.\nPor favor registre-se:",regname);
				ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Registrar",regstring,"Registrar","Sair");
 		}
		}
	}
	else
 {
		Kick(playerid);
	}
	return 1;
}
Depois no Onplayerlogin:
Code:
		{
      new loginstring[128];
			new loginname[64];
			GetPlayerName(playerid,loginname,sizeof(loginname));
			format(loginstring,sizeof(loginstring),"Senha Errada\nInforme a senha correta:",loginname);
			ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Logar",loginstring,"Logar","Sair");
	    fclose(UserFile);
	    gPlayerLogTries[playerid] += 1;
	    if(gPlayerLogTries[playerid] == 4) { Ban(playerid); }
	    return 1;
		}
Altere esses scripts no seu GM.
E me Diga seu deu Certo.
Reply


Messages In This Thread
[DUV] Login Box - by victorxd12 - 24.01.2010, 03:01
Re: [DUV] Login Box - by victorxd12 - 24.01.2010, 04:04
Re: [DUV] Login Box - by rannyere - 24.01.2010, 04:45
Re: [DUV] Login Box - by Suporte_bnv - 24.01.2010, 05:27
Re: [DUV] Login Box - by victorxd12 - 24.01.2010, 07:42
Re: [DUV] Login Box - by Suporte_bnv - 24.01.2010, 08:31
Re: [DUV] Login Box - by victorxd12 - 24.01.2010, 17:48
Re: [DUV] Login Box - by jcs14 - 24.01.2010, 18:39
Re: [DUV] Login Box - by Suporte_bnv - 25.01.2010, 07:24
Re: [DUV] Login Box - by jcs14 - 25.01.2010, 09:44

Forum Jump:


Users browsing this thread: 1 Guest(s)