Namechange Kick Addon

Hey guys, I’m looking for an addon much like the one found in terrortown that disallows players to change name.
I plan to add it to my jailbreak server to prevent people from breaking rules then just changing their name.
Therefore if they do get kicked, I can see their SteamID in console and ban appropriately.

If you know of anything, let me know.

Don’t kick innocent players. There’s a better way: Display all names as they were originally.

[lua]
local ply = FindMetaTable(“Player”)
local oldnick = ply.Nick
function ply:Nick()
if ply.origname == nil then ply.origname = oldnick(self) end
return ply.origname
end
[/lua]

[editline]24th February 2015[/editline]

This might not make the console status command see them by the original name. That code goes in a shared file by the way (autorun folder).

[editline]24th February 2015[/editline]

They could still rejoin under a new name, but that’s little matter.

Thanks buddy, this is a much better solution!

This doesn’t work, it just renames everyone as “Unconnected”

best part about running your own server is reserving the right to kick anyone you want :stuck_out_tongue:

Sure, but kicking them for changing their name when there is an easy solution to it is pointless.

[lua]
local ply = FindMetaTable(“Player”)
local oldnick = ply.Nick
function ply:Nick()
if ply.origname == nil && oldnick(self) != “Unconnected” then ply.origname = oldnick(self) end
return ply.origname
end
[/lua]

[editline]25th February 2015[/editline]

you could’ve at least tried to help yourself

Actually, just use this: https://dl.dropboxusercontent.com/u/26074909/tutoring/game_events/game_event_listeners.lua.html

Try this: https://dl.dropboxusercontent.com/u/26074909/tutoring/tracking_players/name_change_tracking_system.lua.html – Untested but logic should be sound… Remove .html to view .lua

PlayerSpawn any queued name-changes are processed. PlayerInitialSpawn initial name is broadcasted. Logs all prior aliases, kicks / disconnect reason, etc in a table. What’s done with that is up to you.

It is a little sloppier than I would’ve liked but I squeezed it together with a few of my tut contents…

PlayerCanChangeNick is set by default to return false if dead to prevent meta-gaming. When alive there should be no issues… hook.Add to overwrite how this is handled, you could set it to true for a small time from when PlayerSpawn is called, or leave as is…

PlayerChangedNick is called when the nick CAN be changed and this handles the logic and networking for that…

Instead of using NWVars for the nickname, I rely on networking. As said, it should all work, let me know if it doesn’t and I’ll fix… Untested.

Not my code plus I didin’t want to butcher it, haha.

[editline]26th February 2015[/editline]

Thanks man, I’ll definitely give it a try.

[editline]26th February 2015[/editline]

That’s the spirit, just not mine :wink:

I just think that if you’re not paying the bills and I don’t like you, then you can gtfo. Simple as that. You wouldnt let someone you didnt like sit around your house just because they followed your rules.

also my reasoning behind this attitude is that I do not host my server with a goal of becoming a super overpopulated amazing server that everyone wants to play on and donate to. I solely host my server for a refuge for myself and a few friends to play on. The fact that it is public is merely a privilege for anyone else to join us.

Why not just password lock it if you “solely host my server for a refuge for myself and a few friends”? You are just asking for unwanted trouble leaving it open.

you’re missing the context, which is whether or not players should be automatically kicked for changing their names

it’s just dumb

I guess roleplaying in Jailbreak is dead. Just like it died in DarkRP… And everywhere else on Gmod for that matter.