ULX

Poll

Was any of these somewhat interesting or "cool"?

Yes, thank you :)
262 (96.7%)
No, do better next time :(
9 (3.3%)

Total Members Voted: 270

Author Topic: Player Connect/Disconnect Message [1.11v]  (Read 133305 times)

0 Members and 2 Guests are viewing this topic.

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Player Connect/Disconnect Message [1.11v]
« on: February 06, 2013, 06:06:00 PM »
Connect/Disconnect Message

For some reasons, some servers don't get a join or disconnect message which to me is quite strange. I made this plugin in about 7 minutes, with little to no effort so it's very basic. (like it should be).

Please Keep Note:
If you like this addon, I would really appreciate a "Compliment" Karma which is located next to my name. That's how I know you care :)
When anybody joins it sends a message to everyone. (depending on how laggy you are, you may get your own join message)
This plugin is for MULTIPLAYER servers, don't get it for singleplay.
You must be registered and logged in the ulx forum to see the download link which is found under the preview image


HOW TO USE:
You join or leave

FEATURES:
  • A joining sound, and leaving sound (don't worry, you don't have to download them)
  • Team colors when you join or leave
  • A pink server tag next to the person who joins or leaves, to make sure people don't get confused when people are talking
  • ip-steam version will show the steam id and ip address of the person when they join/leave to admins only, for normal players it will just show the message that they joined or left


TO-DO-LIST:
N/A


KNOWN BUGS:
N/A


Preview:



DOWNLOAD LINK BELOW
You must be registered and logged in the ulx forum to see the download link which is found under the preview image
« Last Edit: October 09, 2016, 01:14:11 PM by Bite That Apple »
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline Mesmaroth

  • Newbie
  • *
  • Posts: 5
  • Karma: -1
Re: Player Connect/Disconnect message
« Reply #1 on: February 06, 2013, 07:58:12 PM »
Thanks man. Works great. Commented out the "play sound" if you don't mind.

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Player Connect/Disconnect message
« Reply #2 on: February 07, 2013, 07:51:19 PM »
Thanks man. Works great. Commented out the "play sound" if you don't mind.

lol, I actually forgot about that. I only have that for my own server, and I should have kept it like that. Oh well I guess that's just a bonus
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline Eccid

  • Full Member
  • ***
  • Posts: 115
  • Karma: 11
  • Hey, come on... We just met...
    • Terror Abound! Steam Group
Re: Player Connect/Disconnect message
« Reply #3 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.

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Player Connect/Disconnect message
« Reply #4 on: February 11, 2013, 01:55:17 PM »
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.

Yeah, I have an old script that I believe can help you. It might take a while for me to find because I don't really know where it is.
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Player Connect/Disconnect message
« Reply #5 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).
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Player Connect/Disconnect message
« Reply #6 on: February 11, 2013, 02:34:59 PM »
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.


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: [Select]
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) }
}

Here is the only code you will need to touch. as an example, the name "admin" lowercase
Code: [Select]
{"admin", "ADMIN", Color(0, 0, 255, 255) },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
« Last Edit: August 02, 2013, 05:53:07 PM by chaos13125 »
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline Eccid

  • Full Member
  • ***
  • Posts: 115
  • Karma: 11
  • Hey, come on... We just met...
    • Terror Abound! Steam Group
Re: Player Connect/Disconnect message
« Reply #7 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: [Select]
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)

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.

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Player Connect/Disconnect message
« Reply #8 on: February 11, 2013, 04:18:19 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: [Select]
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)

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.


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.
« Last Edit: February 11, 2013, 04:23:42 PM by chaos13125 »
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Player Connect/Disconnect message
« Reply #9 on: February 11, 2013, 04:30:23 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).


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!

??
« Last Edit: February 11, 2013, 04:38:00 PM by chaos13125 »
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline Eccid

  • Full Member
  • ***
  • Posts: 115
  • Karma: 11
  • Hey, come on... We just met...
    • Terror Abound! Steam Group
Re: Player Connect/Disconnect message
« Reply #10 on: February 11, 2013, 04:42:33 PM »

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!

??

No, I like the way you had it, where it just shows the name and chooses the color depending on the team. Except instead of using the default teams color, I would like for it to read what group the connecting person is, and allow me to set each color depending on group. Something like the code I posted above, so I can manually set colors, I just don't know the command to make it read group names.

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Player Connect/Disconnect message
« Reply #11 on: February 12, 2013, 01:52:12 AM »
No, I like the way you had it, where it just shows the name and chooses the color depending on the team. Except instead of using the default teams color, I would like for it to read what group the connecting person is, and allow me to set each color depending on group. Something like the code I posted above, so I can manually set colors, I just don't know the command to make it read group names.

yeah.. no. I know it's possible, but because I have this strong hated for TTT, I don't really want to work on this at all. I mean I have another script called "Player Chat Tags" which is in this same section somewhere, that most likely can do this.

Don't get me wrong, it's not like I didn't try, but I ended up spending like 45 minutes on this (which I know I shouldn't have, because it's most likely a obvious fix that I can't see) and I couldn't seem to get it to work.. but you know I really don't want to spend too much on this. So anyone is free to modify it to get it to work with this guys needs..

Also, there here -> http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index4317.html <- may be able to help you, but I didn't really test the return value at all.
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline PAL-18

  • Full Member
  • ***
  • Posts: 142
  • Karma: 1
Re: Player Connect/Disconnect message
« Reply #12 on: April 18, 2013, 10:06:25 PM »
Can you add the ability for a random sound (for connect/disconnect) to be played too?

Offline nathan736

  • Full Member
  • ***
  • Posts: 143
  • Karma: 4
Re: Player Connect/Disconnect message
« Reply #13 on: April 19, 2013, 06:06:23 AM »
useing player initial spawn for most things like this is better to make sure the player gets it as well as insuring ulx has a moment to load the player's data  IMO
« Last Edit: April 19, 2013, 06:08:18 AM by nathan736 »
a person asked me how to code lua and i said this " its like building a rocket up side down then  realizing you did it all wrong."

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Player Connect/Disconnect message
« Reply #14 on: April 19, 2013, 12:55:47 PM »
useing player initial spawn for most things like this is better to make sure the player gets it as well as insuring ulx has a moment to load the player's data  IMO

Not sure if you're telling me something, or just stating something...
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.