Ulysses Stuff > Releases

Player Connect/Disconnect Message [1.11v]

<< < (2/37) > >>

JamminR:
ULib has a way to set up team colors by group name, but, for life of me, I can't find our documentation for how to do it, or if it only works in Sandbox.
It is possible that no matter what script you write, text color will be overwritten by the TTT game mode. (Member 'Adult' released setcolor, and it apparently doesn't work in TTT).

Bite That Apple:

--- Quote from: Eccid on February 11, 2013, 02:20:48 AM ---Is it possible to get this to grab the group name, and set custom colors in the script? I run a TTT server, and the game mode takes over team settings, but leaves group settings as they are. You can't set colors fro groups, so I just need to make it set a custom color per group name manually. I thought I had it figured out, but I failed miserably. Any help would be appreciated.

--- End quote ---


here you go, this is what you're looking for
https://mega.co.nz/#!jN8CTKLR!c4AS-T7b5W991j3ynXb3ana7WWdod9NMJhug5OqbG9s

because this script may be a bit confusing, I'll explain this a bit:


--- Code: ---local Tags =
{
--Group    --Tag     --Color
{"admin", "ADMIN", Color(0, 0, 255, 255) },
{"superadmin", "SUPERADMIN", Color(255, 0, 0, 255) },
{"owner", "OWNER", Color(0, 255, 0, 255) }
}
--- End code ---

Here is the only code you will need to touch. as an example, the name "admin" lowercase

--- Code: ---{"admin", "ADMIN", Color(0, 0, 255, 255) },
--- End code ---
is the group name. So if you make a group in ulib/xgui/ttt that's what the first name of it has to be.

The second line that say's "ADMIN" uppercase is the name you can change to anything you want, because this will be the thing that will say "[aGFSDGSDSDFGHSDF]"

The last line that say's color, this will be the thing you can use to color the team name
"[aGFSDGSDSDFGHSDF]" ect...


Please read the rest of the replys first before questioning why I said all this
need anymore more help, you can just use this forum

Eccid:
I don't think you get what I mean. Your script colors the users name in the join text based on what team they're on. In sandbox modes and such, you can set team colors through the xgui, so this works natively. With TTT, it takes over the team commands, because everyone is designated one of 2 teams when joining (innocent or spectator). The work around for many codes has been to get the name of each individual group, and specify a color per team. I'll show you what I tried that didn't work.


--- Code: ---function player_connect( data )
local name1 = data:ReadString()
if ply:IsUserGroup("superadmin") then
nickteamcolour1 = Color(232,228,5)
elseif ply:IsUserGroup("admin") then
nickteamcolour1 = Color(22,128,5)
else
nickteamcolour1 = team.GetColor(data:ReadShort())
end
chat.AddText( Color( 151, 211, 255 ), "Console", Color( 255, 255, 255 ), ": ", nickteamcolour1, name1, Color( 255, 255, 255 ), " has joined the server." )
end
usermessage.Hook("player_connect", player_connect)

--- End code ---

That way I can set up what color to make the name, as per group. The only problem is, it won't recongnize "ply" and I'm still too new to really know why/how to fix it.

Bite That Apple:

--- Quote from: Eccid on February 11, 2013, 03:00:12 PM ---I don't think you get what I mean. Your script colors the users name in the join text based on what team they're on. In sandbox modes and such, you can set team colors through the xgui, so this works natively. With TTT, it takes over the team commands, because everyone is designated one of 2 teams when joining (innocent or spectator). The work around for many codes has been to get the name of each individual group, and specify a color per team. I'll show you what I tried that didn't work.


--- Code: ---function player_connect( data )
local name1 = data:ReadString()
if ply:IsUserGroup("superadmin") then
nickteamcolour1 = Color(232,228,5)
elseif ply:IsUserGroup("admin") then
nickteamcolour1 = Color(22,128,5)
else
nickteamcolour1 = team.GetColor(data:ReadShort())
end
chat.AddText( Color( 151, 211, 255 ), "Console", Color( 255, 255, 255 ), ": ", nickteamcolour1, name1, Color( 255, 255, 255 ), " has joined the server." )
end
usermessage.Hook("player_connect", player_connect)

--- End code ---

That way I can set up what color to make the name, as per group. The only problem is, it won't recongnize "ply" and I'm still too new to really know why/how to fix it.

--- End quote ---


aww... why you make my job so hard.. Nah joking. Yeah, I for some reason thought this was my other addon, and I got the two confused... sorry. Yeah, give me a few minutes, this one should be easier to fix for your needs. :S

edit:
You won't be able to use 'ply' because 'ply' doesn't exist for that part of the client side script..

Also, this might be a little harder than I thought.

Bite That Apple:

--- Quote from: JamminR on February 11, 2013, 02:19:31 PM ---ULib has a way to set up team colors by group name, but, for life of me, I can't find our documentation for how to do it, or if it only works in Sandbox.
It is possible that no matter what script you write, text color will be overwritten by the TTT game mode. (Member 'Adult' released setcolor, and it apparently doesn't work in TTT).

--- End quote ---


Well, now that I read everything AGAIN I really don't think this would work anyways with TTT so I don't really know if I should continue to work on this but because I like lua I will continue.


Edit:
So is this how you want it to say when someone joins the server?
[Server] [Admin] Mr. Apple has joined the server!

??

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version