DialogBox Login
#1

I've seen on a lot of servers the dialogbox for register/login.How can i add it in my gm?
Reply
#2

https://sampwiki.blast.hk/wiki/ShowPlayerDialog
Reply
#3

Quote:
Originally Posted by Don Correlli
I mean this:
/imageshack/img508/544/samp031j.png
Is what you showed me?
Reply
#4

Yes, i already gave you the link:
Quote:
Originally Posted by Don Correlli
Reply
#5

Is that so simply?I tought is very complicated
Reply
#6

Yes, it's nothing special.

Also, check this - https://sampwiki.blast.hk/wiki/OnDialogResponse
Reply
#7

If i understood well i just need to add this line
Код:
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login","Enter your password below:","Login","Cancel");
If i'm wrong please correct me
Reply
#8

Correct, use OnDialogResponse-callback to check if entered password is correct and also make sure that you won't mess up the dialog-IDs.

Also, check this topic - http://forum.sa-mp.com/index.php?topic=138113.0
Reply
#9

So
Код:
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login","Enter your password below:","Login","Cancel");
And
Код:
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),"WRONG PASSWORD\nPlease enter the correct password:",loginname);
				ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");
				gPlayerLogTries[playerid] += 1;
				if(gPlayerLogTries[playerid] == 5) { 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, "That Username is already taken, please choose a different one.");
					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),"Welcome, %s\nYou dont have an account.\nPlease register:",regname);
				ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Register",regstring,"Register","Exit");
			}
		}
	}
	else
	{
		Kick(playerid);
	}
	return 1;
}
Reply
#10

I have some errors
The Errors
Код:
D:\Fane\Sampwork\GaMeGatE [0.3a]\gamemodes\FunBase.pwn(9958) : error 029: invalid expression, assumed zero
D:\Fane\Sampwork\GaMeGatE [0.3a]\gamemodes\FunBase.pwn(9958) : error 004: function "OnDialogResponse" is not implemented
D:\Fane\Sampwork\GaMeGatE [0.3a]\gamemodes\FunBase.pwn(9962) : error 017: undefined symbol "response"
D:\Fane\Sampwork\GaMeGatE [0.3a]\gamemodes\FunBase.pwn(9964) : error 017: undefined symbol "dialogid"
D:\Fane\Sampwork\GaMeGatE [0.3a]\gamemodes\FunBase.pwn(9966) : error 017: undefined symbol "inputtext"
D:\Fane\Sampwork\GaMeGatE [0.3a]\gamemodes\FunBase.pwn(9969) : error 017: undefined symbol "inputtext"
D:\Fane\Sampwork\GaMeGatE [0.3a]\gamemodes\FunBase.pwn(9984) : error 017: undefined symbol "dialogid"
D:\Fane\Sampwork\GaMeGatE [0.3a]\gamemodes\FunBase.pwn(9986) : error 017: undefined symbol "inputtext"
D:\Fane\Sampwork\GaMeGatE [0.3a]\gamemodes\FunBase.pwn(9998) : error 017: undefined symbol "inputtext"
It seems the errors appeard at the line OnDialogResponse .Take a look
Код:
//---------------------------<[ OnDialogResponse ]>--------------------------------------------------------

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),"WRONG PASSWORD\nPlease enter the correct password:",loginname);
				ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");
				gPlayerLogTries[playerid] += 1;
				if(gPlayerLogTries[playerid] == 5) { 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, "That Username is already taken, please choose a different one.");
					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),"Welcome, %s\nYou dont have an account.\nPlease register:",regname);
				ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Register",regstring,"Register","Exit");
			}
		}
	}
	else
	{
		Kick(playerid);
	}
	return 1;
}
Reply
#11

Update your include files to 0.3 ones.
Reply
#12

#include <a_samp>
#include <core>
#include <float>
#include <time>
#include <file>
#include <utils>
#include <morphinc>
#include <MidoStream>
All my include files!Where i can find 0.3a version?I searched and i didn't find .Thank you for supporting me
Reply
#13

http://www.sa-mp.com/download.php
Reply
#14

No Effect .Can you give me a OnDialogResponse .Maybe is from mine
Reply
#15

Stop asking people to script your server for you. I JUST learned how to use DialoxBox, and I made a login/register system in about 20 minutes.
Reply
#16

Quote:
Originally Posted by Antonio (dominationrp.netii.net)
Stop asking people to script your server for you. I JUST learned how to use DialoxBox, and I made a login/register system in about 20 minutes.
Great, you should also learn to check the date of the last post in the topic before you post next time.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)