[Include] Elegant Login / Register TextDraws
#1

Yo, it's me again & welcome to my second release.

Today I share my Login / Register TextDraws, which have been created & scripted by me, so they're ready to use !

Previous Release

[Include] Anti-Vehiclerepair Hack


Information


As I said, I'm releasing here my Login / Register TextDraws. There are currently 12 different Functions available. I've integrated also a Realtime - TextDraw which displays the current time of the server.

Apart from the Realtime, there are 4 clickable Buttons. If you click on them, a Dialog appear with the matching information (e.g. if you click on Credits, a Dialog with all contributors to the server will appear)


Here are a few Screenshots (different colors):



Functions

HTML Code:
CreateGlobalLoginTextDraws()             - Create all Global-TextDraws
CreatePlayerLoginTextDraws(playerid)     - Create all Player-TextDraws
ShowLoginTextDraws(playerid)             - Show all TextDraws
HideLoginTextDraws(playerid)             - Hide all TextDraws
DestroyGlobalLoginTextDraws(playerid)    - Destroys all Global-TextDraws
DestroyPlayerLoginTextDraws(playerid)    - Destroys all Player-TextDraws
PlayerIsRegistered(playerid)             - Adapt the Textdraw messages to already registered players
PlayerIsNotRegistered(playerid)          - Adapt the Textdraw messages to players who are not registered
#define LoginTextDrawColor               - Change the TextDraw Color (PAWN HEX CODE)
#define TextDrawHoverColor               - Change the TextDraw Hover Color (PAWN HEX CODE)
#define LT_ServerName                    - Adapt's the Servername (Welcome to YOUR_SERVERNAME..)
#define RandomLoginColors                - Uncommented = Random TextDraw colors for each player
Example of showing TextDraws


In my case MySQL:

HTML Code:
public OnPlayerConnect(playerid)
{
    if(mysql_num_rows() != 0)
    {
      //Player is registered
      PlayerIsRegistered(playerid);
      } 
        else 
      {
      //Player is not registered
      PlayerIsNotRegistered(playerid);
    }
    return 1;
}
Credits
  • Zamaroht - TextDraw Editor
  • n0minal - This textdraws are inspired a bit by his textdraws from the old project "Zombotec"
  • Jelly23 - Great Support
Updates

v.1.0.1:
  • TextDraws are created now as Global-TextDraws, except the TextDraws which can be different from player to player
  • Renamed UpdateRealTime to LR_UpdateRealTime
  • Added Dialogs
  • Added OnPlayerClickPlayerTextDraw into the Include (need to be moved into Gamemode if the Callback is already in use)
  • Hooked OnPlayerClickTextDraw
  • Renamed / Added new Functions (see above)
v.1.0.2:
  • Added new Function: #define RandomLoginColors
  • OnPlayerClickPlayerTextDraw is now hooked (thanks to @Lordzy)
  • General Improvements..
Download

Version 1.0.2 - CLICK ME

End


There we are again, the end.. I hope you guys like it, please leave a comment.

See ya till my next release !
Reply
#2

I'm here because you used a big word in the title, elegant... Not really a big word, but much better than most other titles.

And nice job! It should be a bit more customizable though, like disabling certain buttons and adding custom buttons.
Reply
#3

Well, suggest me another title, @Crayder.

I don't want to use "Unique" because I think it's not but also not simple because they're not simple textdraws in my opinion :P


Thanks for your opinion/suggestion
Reply
#4

Hello,

Isn't you using old MySQL version syntax in example? At least used new MySQL version in 2k17 Thread.

O.T: I didn't see any thing called "elegant" in this thread. But still it's not bad. Keep it up.
Reply
#5

Quote:
Originally Posted by JustMe.77
View Post
Well, suggest me another title, @Crayder.

I don't want to use "Unique" because I think it's not but also not simple because they're not simple textdraws in my opinion :P
Not sure you understood me, I was complimenting the title.
Reply
#6

There's no need of MAX_PLAYERS * 33 player-textdraws. Most of them which doesn't require any change can be a single global textdraw. You might also want to rename your "UpdateRealTime" to something like "IncludePrefix_UpdateRealTime" to prevent collisions since such a name can be commonly used.


You can also make this include to be more user-friendly by adding a simple callback to handle login/register button click responses.
pawn Code:
//something like:
public OnLoginRegisterTDClick(playerid, click_id) {

    if(click_id == BUTTON_1) //or perhaps BUTTON_LOGIN or BUTTON_REGISTER?
    {
        //codes.
    }
    return 1;
}


The design looks quite good, I'd consider the one with light blue.
Reply
#7

Quote:
Originally Posted by Humza
View Post
Hello,


Isn't you using old MySQL version syntax in example? At least used new MySQL version in 2k17 Thread.


O.T: I didn't see any thing called "elegant" in this thread. But still it's not bad. Keep it up.
What does it matter which version I use in an EXAMPLE ? It's a snippet from my gamemode, which is using that MySQL version. Which version you use, or if you want to even use MySQL, is not my decision, it is completely yours.


If you've any suggestions regarding the Titel, let me know

Quote:
Originally Posted by Crayder
View Post
Not sure you understood me, I was complimenting the title.
Yeah, I understood you wrong. I thought you mean something like this: "Your release is good but it's not worth to be called elegant" Thanks Crayder.

Quote:
Originally Posted by Lordzy
View Post
There's no need of MAX_PLAYERS * 33 player-textdraws. Most of them which doesn't require any change can be a single global textdraw. You might also want to rename your "UpdateRealTime" to something like "IncludePrefix_UpdateRealTime" to prevent collisions since such a name can be commonly used.


You can also make this include to be more user-friendly by adding a simple callback to handle login/register button click responses.
pawn Code:
//something like:
public OnLoginRegisterTDClick(playerid, click_id) {

    if(click_id == BUTTON_1) //or perhaps BUTTON_LOGIN or BUTTON_REGISTER?
    {
        //codes.
    }
    return 1;
}


The design looks quite good, I'd consider the one with light blue.
I'll maybe change the Textdraws which don't have to be PlayerTextDraws into normal Textdraws when I've time to, thanks for reminding me.


In my opinion the name "UpdateRealTime" is alright, but I'll change it in a few minutes, you might be right.


About the Callback, I've done that a while ago but I couldn't hook the Public, because the name was to long (I've received an error). I know, I could use y_hooks to fix that, but I don't want to. Are there any other ways, except y_hooks and changing something in a_samp ? Till that, I'll just add the public without the hooking.


Thanks for your comment, my favourite one is also blue
Reply
#8

Good work! Get a cookie.
Reply
#9

Thank you, iLearner

I've made an update and implented most of the suggestions, check out the main post for more information.
Reply
#10

Quote:
Originally Posted by patrickgtr
View Post
This is not even an include in my opinion, its more like a filterscript. It needs more work in-order to function as an include.


I've also noticed that you created a timer that will be only used when a player connects and its killed when player disconnects, this timer should be killed as soon as this login textdraw is hidden as the timer has no use after it. nonetheless the design looks nice.
It wouldn't fit as Filterscript, why? Let's say you've your whole Login/Register System inside your gamemode.

Now, you want to load these things as Filterscript. How would you do the stuff I've made on "Example of showing TextDraws" (check mainpost) without messing around with CallRemoteFunction and similar stuff?

That's only 1 example of many.


If you feel like there are functions/features missing, feel free to mention them, I'm opened for any suggestion.

Another new small function will be available in the next few minutes / hours though.


About the timer:


The timer is killed automaticly in OnPlayerSpawn. Why not direct in the HideLoginTextDraws function?

I know, that's usually not the case, but imagine you've a charachter system with which you can switch ingame (without reconnecting) through accounts. You'd have to use HideLoginTextDraws & ShowLoginTextDraws multiple times and once you delete the timer in HideLoginTextDraw, it wouldn't update the Time anymore.


PS: Thanks for your comment.
Reply
#11

Nice Job
Reply
#12

I was busy and just took one single look on your reply, I thought you were hooking OnPlayerClickTextDraw.
Yea like that it'll work for sure, I'll add it into the next update, thanks

Edit: v-1.0.2 is now released, check main post for more information !
Reply
#13

I'd appreciate more feedback / suggestions
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)