Ulysses

Ulysses Stuff => Releases => Ulysses Release Archives => Topic started by: lavacano201014 on July 01, 2010, 10:49:47 PM

Title: Player Title II - Name and Title Display
Post by: lavacano201014 on July 01, 2010, 10:49:47 PM
Regarding Developer Support
I don't come onto the Ulysses forums as much as I used to. However, if you add me on Steam (http://www.steamcommunity.com/id/lavacano201014/) (and leave a comment with your problem) I'll gladly try to help you out (though be warned I honestly haven't looked at the code in quite some time). This does not mean Player Title II development is halted. Merely paused.

Regarding GMod 13
I've received a report that it works if you rename info.txt to addon.txt.

Our good friend Lt.Smith made PlayerTitle (http://forums.ulyssesmod.net/index.php/topic,3487.0.html), and maintained it up to version 1.2. It's a great addon, truly, but here's the problem: It hasn't been updated since July 2008, and Lt.Smith himself hasn't come onto these forums since August 2009.

I decided to take over the project (until such time as Lt.Smith demands it back, if he ever does).

Features:
 - MySQL and SQLite support*
 - Easily accessible to Lua (only two simple functions to know!)
 - Fades away with distance*
 - Comes prepackaged with an E2 extension

How to Use:
 - ULX commands: !title, !settitle, !mytitle.* If it's not obvious what they do, check the readme (or run ulx help <command> in console)
 - E2 Functions: E:hasTitle(), E:setTitle(), E:title(). If these aren't obvious, check the readme. Note that you must be admin to use E:setTitle() on players other than yourself.
 - Lua funcs: playerGetTitle(), playerSetTitle(). If these...you get the idea.

Known Issues:
 - Titles can't be longer than 40 characters.* I can't tell if this is a developer imposed limit to maintain a (comparatively) small DB footprint or if it causes issues somewhere, so I left it alone.
 - Differing Z coords (differing altitudes), such as Construct's ledges or Flatgrass' spawn platform, can cause the name/title display to disappear.* This is due to the trace screwing up, and can't be fixed in a way I can think of.
 - If using MySQL offsite, and there is a lot of latency between the game server and the MySQL DB, the server (and/or maybe the client? I don't use MySQL, I dunno) will freeze while the query is running.*

All items marked with * are features/limits that are in PlayerTitle 1.2.

Screenshots! (http://www.netswim.net/pltitlescreenshots/) (And yes, the name of the guy who executed the command is colored by his team color)

You can download the attached ZIP or use this SVN link (RECOMMENDED): http://lavacano-gmod.googlecode.com/svn/trunk/playertitleii/

I'm sorry I don't have a Release version for you guys - I kinda never backed up Release version when I first made it SVN.
Title: Re: [SVN] Player Title II - Name and Title Display
Post by: Megiddo on July 02, 2010, 05:01:35 AM
Titles are probably limited to 40 characters to keep the rows in the DB a constant size, which makes database access much faster (well, for MySQL anyways, I think SQLite ignores it).

Good work! :)
Title: Re: [SVN] Player Title II - Name and Title Display
Post by: lavacano201014 on July 02, 2010, 03:39:40 PM
Titles are probably limited to 40 characters to keep the rows in the DB a constant size, which makes database access much faster (well, for MySQL anyways, I think SQLite ignores it).

That makes sense.

Quote
Good work! :)

Well, thank ya.

Also, I realized I accidentally didn't paste in the end / at my SVN link - it's fixed now, but the SVN is (currently!) no different from the ZIP.
Title: Re: [SVN] Player Title II - Name and Title Display
Post by: Tommo1590 on July 04, 2010, 07:56:51 AM
Anyway to hide the gmod default name which shows when u look at players and only have this one show?

Thanks
Tom  :o
Title: Re: [SVN] Player Title II - Name and Title Display
Post by: JamminR on July 04, 2010, 10:23:23 AM
It can be done.
Gamemode.HUDDrawTargetID (http://wiki.garrysmod.com/favicon.ico) (http://wiki.garrysmod.com/?title=Gamemode.HUDDrawTargetID)
Lavacano would just need to add the feature/function.
Title: Re: [SVN] Player Title II - Name and Title Display
Post by: lavacano201014 on July 04, 2010, 02:02:59 PM
It can be done.
Gamemode.HUDDrawTargetID (http://wiki.garrysmod.com/favicon.ico) (http://wiki.garrysmod.com/?title=Gamemode.HUDDrawTargetID)
Lavacano would just need to add the feature/function.

...but I like the default! D-:

Wait. What I can do is turn them off until a certain distance (like when the names are fairly fuzzed out, even when visible), then turn them on. Maybe work the titles in there as well...heck, maybe I'll even make a clientside convar for the whole thing!
Title: Re: [SVN] Player Title II - Name and Title Display
Post by: JamminR on July 04, 2010, 08:37:24 PM
I say method to turn on or off.
That way, you and those who like them on can leave them on.
Those who don't can turn them off. :)
Title: Re: [SVN] Player Title II - Name and Title Display
Post by: lavacano201014 on July 04, 2010, 08:47:54 PM
Here's what I was thinking with the convars (all clientside):

(Player Title: Target ID) plti_tgtid <0|1|2> (default 1):
 - 0 = Turn off target IDs completely.
 - 1 = Disable target IDs until a certain distance (defined in plti_iddist, explained later)
 - 2 = Leave target IDs on, no matter the distance.

(Player Title: ID Distance) plti_iddist (default undetermined):
 - If the target you're looking at is closer to you than the value entered in this convar, disable the target ID. Else, let it come up.
 - The default is currently undetermined, numberwise, but I will figure out what number to use with an E2 and an unsuspecting player (probably my server's SourceTV bot)
Title: Re: [SVN] Player Title II - Name and Title Display
Post by: Buggzie on July 09, 2010, 08:05:14 AM
Pictures please.
Title: Re: [SVN] Player Title II - Name and Title Display
Post by: lavacano201014 on July 09, 2010, 09:11:00 AM
Pictures please.

Working on it. Done! (http://www.netswim.net/pltitlescreenshots/) (And yes, the name of the guy who executed the command is colored by his team color)
Title: Re: [SVN] Player Title II - Name and Title Display
Post by: Megiddo on July 09, 2010, 02:53:04 PM
You can use img tags to inline those, lavacano
Title: Re: [SVN] Player Title II - Name and Title Display
Post by: Buggzie on July 10, 2010, 01:50:43 AM
Why has it got [BONG] in its name, lol
Title: Re: [SVN] Player Title II - Name and Title Display
Post by: lavacano201014 on July 10, 2010, 12:09:16 PM
You can use img tags to inline those, lavacano

I know, but I couldn't think of a way to organize them on the OP without the vertical one screwing with the whole thing. BBCode has no [div] tag D-:

Why has it got [BONG] in its name, lol

Whatever tag I'm wearing is based on a "What tag did I have to put on last?" basis. That's for TF2.
Title: Re: [SVN] Player Title II - Name and Title Display
Post by: lavacano201014 on July 31, 2010, 02:24:33 AM
So, I have bad news, worse news, and semi-good news.

The bad news is I reformatted, and I lost my working copy of the SVN. While I can easily obtain a new one, all the changes I made to Player Title II are gone.

The worse news is the changes didn't seem to do anything on my server anyway.

The semi-good news is that might just have been because I was stupid and didn't actually upload it (opened FileZilla, got distracted by a shiny thing, thought I did it, closed FileZilla). Don't know if I did or not though, so I'll crack open the file later and make sure.
Title: Re: [SVN] Player Title II - Name and Title Display
Post by: MrPresident on July 31, 2010, 05:44:45 AM
This has happened to me on a few occasions. I usually just take it as a sign from the programming gods and when I re-write what I've lost it ends up being better than what I lost in the first place... usually.
Title: Re: [SVN] Player Title II - Name and Title Display
Post by: Xenoyia on October 11, 2010, 09:36:20 AM
I've put the SVN into my server's addons folder, put the "ulx title" commands into my groups.txt and restarted the server, but it's saying the title commands are unrecognized, am I doing something wrong?

The name shows above someones when you go close to another player, though. But the title space is empty.
Title: Re: [SVN] Player Title II - Name and Title Display
Post by: Xenoyia on October 14, 2010, 06:27:37 AM
Hello? I asked for help 3 days ago. Surely SOMEONE has got this working??
Title: Re: [SVN] Player Title II - Name and Title Display
Post by: JamminR on October 14, 2010, 01:40:54 PM
Quote from: Author's profile
Last Active:
    October 09, 2010, 12:36:17 AM

Be patient.
This isn't facepunch with millions of users who visit every day.
I'm sorry you're having trouble, but haven't used this mod so can't say why it's not working for you.

In the meantime, If you aren't sure how to install the addons, there are plenty of other instructional sites out there.
Make sure you're using both ULib and ULX SVN from this site.
Check for server errors at start up.

None of us here particularly enjoy hearing "it doesn't work" without exact errors or what/where you installed something.
Details are key.
Title: Re: [SVN] Player Title II - Name and Title Display
Post by: lavacano201014 on October 16, 2010, 02:54:51 PM
Hello? I asked for help 3 days ago. Surely SOMEONE has got this working??

Please paste your console output when you start up the server. Use [code] tags or pastebin please.
Title: Re: [SVN] Player Title II - Name and Title Display
Post by: lavacano201014 on July 16, 2011, 12:21:08 AM
Good News Farnsworth!

I updated Player Title II. I added a gettitle command to the ULX side of things and purified some Lua comments. Also "protected" (surrounded in an if block) the MySQL require line if you have it set to use MySQL.

Now the bad news.

The old SVN link no longer works, because I had to delete the account in charge of it (it was compromised). New SVN link is http://lavacano-gmod.googlecode.com/svn/trunk/playertitleii/ .
Title: Re: Player Title II - Name and Title Display
Post by: Megiddo on July 16, 2011, 09:12:15 AM
Good work! :)
Title: Re: Player Title II - Name and Title Display
Post by: krooks on July 21, 2011, 05:36:56 PM
I really like this addon, it's the little things like this that can really make a server stand out from the crowd.
I find that the names get too big at a distance for my liking, a crowded area can get very jumbled looking, and it becomes hard to see what people are working on at distances because of it.

Settings in XGUI to control the fade/scale would be an ideal update in the future, if you are planning to continue with the project
Title: Re: Player Title II - Name and Title Display
Post by: lavacano201014 on September 04, 2011, 03:24:38 PM
Settings in XGUI to control the fade/scale would be an ideal update in the future, if you are planning to continue with the project

I like this idea.

Fade I can definitely do. Scale, not so confident about.

As for a settings UI...I'm more likely to stick that in the Settings or Options tab on the right side of the Q menu, for a couple of reasons:

Normally I'd get to work on that right away, but I don't currently have a server to horribly destroy with badly made Lua test on (I'm waiting for my relative to get back to me on the Linode she said she was going to get for me). Soon as I do though, I'll get crackin'.
Title: Re: Player Title II - Name and Title Display
Post by: Stickly Man! on September 04, 2011, 07:25:50 PM
  • XGUI is more for general ULX things so far as I can tell (and admittedly I don't use GUIs all that often anyway, personally preferring console commands, so I could be horribly horribly wrong)
  • The text part is done completely clientside so it would make more sense to put clientside settings with other clientside settings :-P

There IS a place within XGUI designed specifically for client-side settings (see http://img200.imageshack.us/img200/8822/1newclientmenu.jpg). It currently only holds settings for XGUI, and I was planning to use the space for future projects.

But yeah, XGUI is designed to be modular to whatever content you'd like-- the general rule of thumb is that if ULX is required to be installed for your addon to function, then you can put it in XGUI (if you want :P)

Let me know if you want to inquire more about it.
Title: Re: Player Title II - Name and Title Display
Post by: JackYack13 on October 16, 2011, 02:14:40 PM
I've never dealt with database stuff before and I don't have any mysql or sqlite database... I'm hosting a Gmod server from my computer and I'm using this addon. Suprisingly, when I shut down the server and run it again, the titles are still there. So my question is where are they saved if I don't have any database?
Title: Re: Player Title II - Name and Title Display
Post by: Aaron113 on October 16, 2011, 02:37:52 PM
I believe it just saves everything to the sv.db file.  I could be wrong though.
Title: Re: Player Title II - Name and Title Display
Post by: JamminR on October 16, 2011, 04:05:18 PM
As original post mentions, both SQLite and SQL are supported.
Gmod by default uses a flat 'sqlite' file..aptly named as aaron mentions, sv.db.
I believe this addon uses it by default.
Title: Re: Player Title II - Name and Title Display
Post by: lavacano201014 on November 13, 2011, 03:06:13 PM
yeah I don't remember exactly but I think if you want MySQL stuff you have to flip a switch in config.lua or something like that.
Title: Re: Player Title II - Name and Title Display
Post by: thegtz on April 09, 2012, 01:44:43 PM
Anyone got any pictures of this plugin in action?
Title: Re: Player Title II - Name and Title Display
Post by: Tomvdr on May 12, 2012, 02:30:35 AM
Sorry for bumping this old? thread but, for some reason I don't get any tag.
I can use the commands (!title, mytitle, settitle...) but the tag/title doesn't appear.
(http://dl.dropbox.com/u/16670735/Title%20help.png)

Thanks in advance,
Tom
Title: Re: Player Title II - Name and Title Display
Post by: LuaTenshi on May 26, 2012, 10:46:52 PM
Sorry for bumping this old? thread but, for some reason I don't get any tag.
I can use the commands (!title, mytitle, settitle...) but the tag/title doesn't appear.

Thanks in advance,
Tom

What do you mean? Right there in the picture it says that you set your title to Help, and then when you checked your title it returned Help.
Title: Re: Player Title II - Name and Title Display
Post by: thegtz on June 20, 2012, 10:03:00 PM
How do I remove the default name display? Currently i have two names that show above someones head. I would like only one to show up.
Title: Re: Player Title II - Name and Title Display
Post by: lavacano201014 on September 08, 2012, 01:47:49 AM
First of all, I have added this text to the OP:

Regarding Developer Support
I don't come onto the Ulysses forums as much as I used to. However, if you add me on Steam (http://www.steamcommunity.com/id/lavacano201014/) (and leave a comment with your problem) I'll gladly try to help you out (though be warned I honestly haven't looked at the code in quite some time). This does not mean Player Title II development is halted. Merely paused.

Regarding GMod 13
The proper response to the question "Does it work in GMod 13" is "I have no idea." I've been meaning to bug the Ulysses team for access to their GM13 codebase but a combination of Megiddo never being on Steam and me having bad memory means I still haven't done it.

Now to answer questions.

Sorry for bumping this old? thread but, for some reason I don't get any tag.
I can use the commands (!title, mytitle, settitle...) but the tag/title doesn't appear.
(http://dl.dropbox.com/u/16670735/Title%20help.png)

Thanks in advance,
Tom

I'm not sure what you're after here, are you wanting the title to appear in the chatbox? Because that's not the intent of this addon. It's supposed to hover over your head when another player looks at you.

How do I remove the default name display? Currently i have two names that show above someones head. I would like only one to show up.

Open lua/autorun/client/cl_playertitle.lua and change the variable enablenames to false.
Title: Re: Player Title II - Name and Title Display
Post by: JamminR on September 08, 2012, 06:50:36 PM
Lavacano, no need to bug Megiddo for the codebase, see mention here - http://forums.ulyssesmod.net/index.php/topic,5484.msg26481.html#msg26481
Title: Re: Player Title II - Name and Title Display
Post by: lavacano201014 on September 20, 2012, 02:57:00 PM
Lavacano, no need to bug Megiddo for the codebase, see mention here - http://forums.ulyssesmod.net/index.php/topic,5484.msg26481.html#msg26481

huh. maybe it was another addon I was thinking of that did that.
Title: Re: Player Title II - Name and Title Display
Post by: LuaTenshi on September 20, 2012, 11:17:58 PM
I'm not sure what you're after here, are you wanting the title to appear in the chatbox? Because that's not the intent of this addon. It's supposed to hover over your head when another player looks at you.

I think you should add that as an option and allow it to be custom, set by an admin, or just the persons rank. In addition this should also have some settings like changing if people can see the name through a wall or the ability to change at what distance the names fade away. You know server side vars and may be more client side vars?
Title: Re: Player Title II - Name and Title Display
Post by: nexbr on November 26, 2012, 03:21:58 AM
Can you create two cvars?

1. Server Side like sv_playertitle_enable 1/0
2. Client Side like cl_playertitle_enable 1/0

Then we can disable the player title to all players or just for me.

Because sometime you want spy some players but the flying title are not stealthy !  ;)
Title: Re: Player Title II - Name and Title Display
Post by: datgregofag on February 12, 2013, 03:49:28 PM
Hi, how can i change it so that when a person dies it doesn't show the title, i have a ttt server and when someone dies their title still floats around.
Title: Re: Player Title II - Name and Title Display
Post by: krooks on February 17, 2013, 09:42:54 AM
Hi, how can i change it so that when a person dies it doesn't show the title, i have a ttt server and when someone dies their title still floats around.

I think when I get some time, I will be adding this to my server. So I'll fix it and give the code when I do (unless someone beats me to it). I would give instructions on how to do it, but I'm not good enough at lua for that, so it will take tinkering :P
Title: Re: Player Title II - Name and Title Display
Post by: MrPresident on February 18, 2013, 01:45:02 AM
cl_playertitle.lua

Replace the code in this file with this

Code: [Select]
//Config

// Names enabled?
local enablenames = true

// Titles enabled?
local enabletitles = true

// How to align the text?
// 0 = left
// 1 = center
// 2 = right
local textalign = 1

// Distance multiplier. The higher this number, the further away you'll see names and titles.
local distancemulti = 2

////////////////////////////////////////////////////////////////////
// Don't edit below this point unless you know what you're doing. //
////////////////////////////////////////////////////////////////////

function DrawNameTitle()

local vStart = LocalPlayer():GetPos()
local vEnd

for k, v in pairs(player.GetAll()) do

if not v:Alive() then continue end

local vStart = LocalPlayer():GetPos()
local vEnd = v:GetPos() + Vector(0,0,40)
local trace = {}

trace.start = vStart
trace.endpos = vEnd
local trace = util.TraceLine( trace )

if trace.HitWorld then
--Do nothing!
else
local mepos = LocalPlayer():GetPos()
local tpos = v:GetPos()
local tdist = mepos:Distance(tpos)

if tdist <= 3000 then
local zadj = 0.03334 * tdist
local pos = v:GetPos() + Vector(0,0,v:OBBMaxs().z + 5 + zadj)
pos = pos:ToScreen()

local alphavalue = (600 * distancemulti) - (tdist/1.5)
alphavalue = math.Clamp(alphavalue, 0, 255)

local outlinealpha = (450 * distancemulti) - (tdist/2)
outlinealpha = math.Clamp(outlinealpha, 0, 255)

local playercolour = team.GetColor(v:Team())
local playertitle = v:GetNetworkedString("title")

if ( (v != LocalPlayer()) and (v:GetNWBool("exclusivestatus") == false) ) then
if (enablenames == true) then
draw.SimpleTextOutlined(v:Name(), "TargetID", pos.x, pos.y - 10, Color(playercolour.r, playercolour.g, playercolour.b, alphavalue),textalign,1,2,Color(0,0,0,outlinealpha))
end
if (not (playertitle == "")) and (enabletitles == true) then
draw.SimpleTextOutlined(playertitle, "Trebuchet18", pos.x, pos.y + 6, Color(255,255,255,alphavalue),textalign,1,1,Color(0,0,0,outlinealpha))
end
end
end
end
end
end

hook.Add("HUDPaint", "DrawNameTitle", DrawNameTitle)

All I did was add an alive check to the player to decide if the title should be drawn above their head. 1 line of code.


if not v:Alive() the continue end
Title: Re: Player Title II - Name and Title Display
Post by: PAL-18 on February 18, 2013, 04:46:59 PM
Screenshot link in first post returns a 403 error ...
Title: Re: Player Title II - Name and Title Display
Post by: JamminR on February 18, 2013, 07:36:55 PM
Screenshot link in first post returns a 403 error ...

See the date?
Hence, why I wish most folks would attach their small-ish images and files here, and not link them.
Though majority of the time the code/whatever they posted here won't work in Gmod 2 years after release, it would at least give someone chance to review, perhaps pick back up.
Add in links to other sites, and, well, I've seen those change more often than we keep up with Gmod's code changes. :D
(Lavacano doesn't visit these parts too often...last was Nov 1 2012)
Title: Re: Player Title II - Name and Title Display
Post by: krooks on February 19, 2013, 03:01:55 PM
I haven't tried your code Mr. President, but while messing with this last night I noticed it needs a lot more work than just that to be use on TTT.
As it is, it displays all names in your view, which is really different from TTT, which only displays them within a certain radius of the middle, the names fade in and out depending on distance.
To have them always on would be game changing, as it would be much easier to see the names to call a KOS.

I'll be tinkering with this when I have time, and hopefully release a TTT version of it, unless someone beats me.
Title: Re: Player Title II - Name and Title Display
Post by: pazda on March 05, 2013, 03:19:08 PM
This breaks my DarkRP server. The new names show up, but the commands don't work, the HUD shows nothing, default class is Connecting/Joining, and the default weapons from classes are gone.. Any ideas?
Title: Re: Player Title II - Name and Title Display
Post by: SatoshiAaron on June 26, 2013, 08:29:31 PM
How would I stop PRISONER_DEAD and GUARD_DEAD and SPECTATOR Teams tags from being visible. Because we can see them when they are spectating people or when they join the server in the middle of the map.