|
|
#1 |
|
Big Clucker
![]() ![]() Join Date: Feb 2011
Posts: 146
Reputation: 7
|
Introduction
Hi guys. This is my other tutorial. This will show you how to use and create a dialog login/register and admin system. Dialog systems are much better and harder than a simple /login & /register commands. For these dialogs, I have used the slow DINI. Now, I have heard that this job can be done even with Y_INI, but this is a DINI TuT, so you have to have these includes : pawn Code:
dutils is needed just for one simple step, so be sure to download it. Now, let's begin. Full defines and includes Now, we will need some other defines before we begin. First get some color defines. You can get them here. Now, define the new PlayerInfo. We need the player's money, admin level, ig level AND his password. pawn Code:
The new PlayerInfo will add a needed variable. Now, if you got everything (includes, defines, etc...) we should proceed to the next step. OnPlayerConnect Now, the second step. Here, we will need all the information of the client that logs in. If the server has created a 'database file' of him, then the server will check if the file exists (login) or it should be created (register). For this we need the file, the client's name, and the location of the file. pawn Code:
Now, here is the file checking part with two simple commands. pawn Code:
Here, you can see we have the ShowPlayerDialog lines. Well, this is our dialog. Code:
playerid The ID of the player to show the dialog to. dialogid An ID to assign this dialog to, so responses can be processed. Max dialogid is 32767. Using negative values will close any open dialog. style The style of the dialog. caption[] The title at the top of the dialog. The length of the caption can not exceed more than 64 characters before it starts to cut off. info[] The text to display in the dialog. Use \n to start a new line and \t to tabulate. button1[] The text on the left button. button2[] The text on the right button. Leave it blank to hide it. OnPlayerDisconnect Under OnPlayerDisconnect you should add the dini commands that will save his password, money, level, etc... pawn Code:
You can see the PlayerInfo helped us here. Now, let's proceed to dialogs. OnDialogRespone Here, we have to do all the job. First, let's begin with the dialog's id. The register dialog id is 1, so let's begin with this. pawn Code:
Same thing. We should check the User folder, player's name etc... Now, you can see that if(dialogid == 1) checks the dialogid (in this case 1). If the player responds with typing his password, then we give him a response too. If he types his password we have to create the new file and dini_IntSet all the parameters (level, pw, admin level...). pawn Code:
Now, everything we have done is checking this client's parameters and kicking him if he kicks the "Cancel" button. Let's proceed now with the login dialog, which's id was 2. We have to check if his password is wrong or right. We'll need the dutils include for this. Now, the same thing as we done before: pawn Code:
Now, a line will check if his password is wrong or not pawn Code:
This is very much needed because without it players can log even with another's password. There's only the left part of the command now and it should be easy to script it with dini. pawn Code:
Conclusion Last, I wanted to say that it's better to use this system, as it's more professional and it's mostly used these days. For lazy guys who want a CTRL + C and CTRL + V I am adding ALL what I have done here: pawn Code:
P.s.: Just for more professionalism, add this line to avoid warnings: pawn Code:
Cya' to my next TuT ! Please rate & comment The End Last edited by Rivera; 02/05/2011 at 08:04 PM. |
|
|
|
|
|
#2 |
|
Little Clucker
![]() Join Date: Jul 2010
Posts: 10
Reputation: 0
|
Worked out good!
PS: you forgot #include <dini> :P You're welcome. When i hit register the server crashes. |
|
|
|
|
|
#3 |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Jan 2010
Location: Australia
Posts: 4,007
Reputation: 833
|
Nice although DINI is so old, you're better of having a new system then that. Well Old and Slow = rubbish. Not saying you're TUT is rubbish but i suggest you're Next TUT thats about registering, maybe y_ini?
Anyway once again nice. |
|
|
|
|
|
#4 |
|
Guest
Posts: n/a
|
Its a good tutorial, but you could use more updated .ini file saving system such as Y_ini to make this with.
|
|
|
|
#5 | |
|
Big Clucker
![]() ![]() Join Date: Feb 2011
Posts: 146
Reputation: 7
|
Yeah I know I can use INI_Load or w/e but I like the classic way
Quote:
|
|
|
|
|
|
|
#6 |
|
Huge Clucker
![]() ![]() ![]() Join Date: Nov 2009
Posts: 214
Reputation: 0
|
First, you must have the folder Users.
Then, it's a mistake pawn Code:
pawn Code:
|
|
|
|
|
|
#7 |
|
Big Clucker
![]() ![]() Join Date: Oct 2010
Posts: 190
Reputation: 59
|
|
|
|
|
|
|
#8 |
|
Big Clucker
![]() ![]() Join Date: Feb 2011
Posts: 146
Reputation: 7
|
That's right. This is not a mistake it will be working in anytime. Just more professional
|
|
|
|
|
|
#9 |
|
Big Clucker
![]() ![]() Join Date: Jun 2010
Location: Canada
Posts: 51
Reputation: 0
|
Where do I create folder "Users"? I tried registering but no couldn't find a Users folder or a file with my name on it.
|
|
|
|
|
|
#10 |
|
Little Clucker
Join Date: May 2010
Posts: 13
Reputation: 0
|
You forgot to add this
Code:
#pragma unused ret_memcpy |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Tutorial] Dialog Register/Login System using DJson | sekol | Tutorials | 12 | 20/09/2012 08:21 PM |
| Login/Register System with dialog | Rivera | Help Archive | 3 | 27/04/2011 12:56 PM |
| [Help] Register/Login System with DIALOG | BMGP | Help Archive | 5 | 14/12/2010 05:34 PM |
| How to make login/register system with DIALOG? | juseong111 | Help Archive | 3 | 20/10/2009 01:20 PM |