Author Topic: PlayerTitle [v1.2] - A name and title display module  (Read 49402 times)

0 Members and 1 Guest are viewing this topic.

Offline Lt.Smith

  • Newbie
  • *
  • Posts: 32
  • Karma: 4
PlayerTitle [v1.2] - A name and title display module
« on: June 28, 2008, 06:06:24 AM »
Hey guys, I always used to like the fact that player names and titles popped up in ServerSecure (way back when), so I thought I'd recreate it for my favorite admin mod.

This addon displays names and an optional user titles above player's heads. For titles you need Ulib/ULX, but otherwise the names should display anyway. You can now choose between using SQLite, which is built into gmod, and mySQL if you want to store titles externally or span across multiple servers like me. There's also plenty of configuration you can do, but it'll work right off the bat too.



Installation:
  • Extract the PlayerTitle folder to your addons folder.
  • Read the readme for instructions!
  • Done!

Known bugs and limitations:
  • Sometimes when a map has ledges (such as gm_construct) the trace messes up and a player's name can disappear.
  • If your database is far away, it can take a while to set the player's title as the query is executed. The game freezes during this time.
  • When you hover over a player it still shows the default name and health info. Not really a bug but I have no clue how to remove it.
  • Titles can be no longer than 40 characters. If you try to set a longer title the script stops you.

Thanks to:
  • Screen location script copied from MrPresident's anti-AFK script. Later modified somewhat to include alpha calculations and title display etc.
  • Spbogie for the suggestion of a query handler function to allow both mySQL and SQLite.
  • Thanks to Pfc. Johnson for helping me test and debug.
  • Also thanks to the people in the GmodSauce Sandbox server for their patience with my frequent resets, especially Paulendy, Hamit and Thizm.


CHANGELOG:

v1.2
   - [ADDED] Added check to see if player was ragdolled/jailed/turned into a melon. Names are hidden during this time to prevent them from showing up at wierd locations.

v1.1

   - [ADDED] Added support for SQLite.
   - [ADDED] Added SQL subroutine to handle queries.
   - [CHANGED] Name changed for Team Ulysses. Sorry guys, my mistake!
   - [CHANGED] Added mySQL configuration options instead of hardcoding connection details.

v1.0
   - Initial release.


Download
« Last Edit: July 02, 2008, 05:59:43 AM by Lt.Smith »

Paulendy

  • Guest
Re: PlayerTitle [v1.2] - A name and title display module
« Reply #1 on: June 28, 2008, 06:37:50 AM »
I am still not a Pie :D

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Lt.Smith

  • Newbie
  • *
  • Posts: 32
  • Karma: 4
Re: PlayerTitle [v1.2] - A name and title display module
« Reply #3 on: June 28, 2008, 06:47:29 AM »
Please Rename ASAP.
http://forums.ulyssesmod.net/index.php/topic,3167.0.html

Whoops, my bad.

Update: fixed. Sorry, didn't see that.
« Last Edit: June 28, 2008, 06:52:03 AM by Lt.Smith »

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: PlayerTitle [v1.2] - A name and title display module
« Reply #4 on: June 28, 2008, 06:52:01 AM »
It's ok. Please make sure you work on the actual info.txt, file name and any other places the original name is mentioned. Uname was released to the wild a few months ago.
Thanks.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Lt.Smith

  • Newbie
  • *
  • Posts: 32
  • Karma: 4
Re: PlayerTitle [v1.2] - A name and title display module
« Reply #5 on: June 28, 2008, 06:52:44 AM »
It's ok. Please make sure you work on the actual info.txt, file name and any other places the original name is mentioned. Uname was released to the wild a few months ago.
Thanks.

Done done and done.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: PlayerTitle [v1.2] - A name and title display module
« Reply #6 on: June 28, 2008, 08:13:43 AM »
EXCELLENT work!
Reminds me of the old ulx 1 module someone wrote called flags.
Think it might have been golden-death that wrote it. Not sure. I'll look in the old releases later.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline LUADuck

  • Newbie
  • *
  • Posts: 17
  • Karma: 0
Re: PlayerTitle [v1.2] - A name and title display module
« Reply #7 on: June 28, 2008, 09:00:56 AM »

Offline spbogie

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 456
  • Karma: 41
Re: PlayerTitle [v1.2] - A name and title display module
« Reply #8 on: June 28, 2008, 09:29:34 AM »
I hate to ask you to change the name yet again, but we do try to reserve the U for releases made by Ulysses Team Members. It's not as big of a deal as big of a deal as with the duplicate name, but would be appreciated if you could.

Other than that, looks very interesting.

Assuming you don't use anything from the list here http://sqlite.org/omitted.html, it should be fairly simple to allow support for either type of database. I haven't looked at the code to see how modular you have made it, but if you wanted to add support for both database types, the easiest way would probably be to create a wrapper query function that you could just pass the string to, and only have to write the code to deal with the different databases once.

Edit: Lt. Smith, I have sent you a PM. Please check your inbox (in the userinfo box at top of page)
« Last Edit: June 28, 2008, 10:01:34 AM by spbogie »
I have not failed. I've just found 10,000 ways that won't work. - Thomas A. Edison
I reject your reality and substitute my own. - Adam Savage

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6213
  • Karma: 394
  • Project Lead
Re: PlayerTitle [v1.2] - A name and title display module
« Reply #9 on: June 28, 2008, 12:41:44 PM »
Nicely done, though I agree with spbogie, if you couild change the name that would be wonderful. :)

Thanks!
Experiencing God's grace one day at a time.

Offline Lt.Smith

  • Newbie
  • *
  • Posts: 32
  • Karma: 4
Re: PlayerTitle [v1.2] - A name and title display module
« Reply #10 on: June 29, 2008, 08:57:29 AM »
Sorry fellas, I failed to realise that the u is for ulysses stuff. My mistake, I'll change it tonight when I get home. Thanks for the encouraging words, I've been writing code for about 6 months now but this is the first actual release I've made.

As far as the code is concerned, It's poorly commented and it's about as modular as... as... well, something that isn't modular. Good idea about the SQL wrapper function, thanks. I'll try implementing that tonight, since the queries are very simple, just SELECT, INSERT and UPDATE queries. I'll even try and set it up so that if the mySQL module isn't loaded it defaults to SQLite so it doesn't go flat on its face if it messes up.

Update: Name changed, working on v1.1 right now. Thanks spbogie.

UPDATE:

I updated to version 1.1, which includes choosing your storage method and contains a few other tweaks. Overall I'm pretty excited about it :D

CHANGELOG:

v1.1
   - [CHANGED] Name changed for Team Ulysses. Sorry guys, my mistake!
   - [CHANGED] Added mySQL configuration options instead of hardcoding connection details.
   - [ADDED] Added support for SQLite.
   - [ADDED] Added SQL subroutine to handle queries.

v1.0
   - Initial release.
« Last Edit: June 29, 2008, 03:20:21 PM by Lt.Smith »

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6213
  • Karma: 394
  • Project Lead
Re: PlayerTitle [v1.2] - A name and title display module
« Reply #11 on: June 29, 2008, 03:21:53 PM »
- [ADDED] Added support for SQLite.

Kickin' rad. :)
Experiencing God's grace one day at a time.

Offline Guardian9978

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
Re: PlayerTitle [v1.2] - A name and title display module
« Reply #12 on: June 29, 2008, 04:19:39 PM »
URL for download is wrong:
Code: [Select]
http://"http//www.gmodsauce.com/staticfiles/releases/playertitle11.zip"Should be:
Code: [Select]
http//www.gmodsauce.com/staticfiles/releases/playertitle11.zip
after correction URL redirects to:
Code: [Select]
http://www.w3.org/Protocols/
Can you please give supply a link that works. I'd love to use this in my server.

Offline spbogie

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 456
  • Karma: 41
Re: PlayerTitle [v1.2] - A name and title display module
« Reply #13 on: June 29, 2008, 04:40:22 PM »
Lt.Smith, SMF doesn't like when you put quotes around a url, and thus adds the extra http:// infront of it. Simple fix, just put the url w/o quotes.
« Last Edit: June 30, 2008, 09:46:31 AM by spbogie »
I have not failed. I've just found 10,000 ways that won't work. - Thomas A. Edison
I reject your reality and substitute my own. - Adam Savage

Offline Lt.Smith

  • Newbie
  • *
  • Posts: 32
  • Karma: 4
Re: PlayerTitle [v1.2] - A name and title display module
« Reply #14 on: June 29, 2008, 05:22:38 PM »
Fixed. I use SMF for my forums too, but I used IPB for about a year, so it's hard breaking old habits.

Hope you guys enjoy it :)