Ulysses

Ulysses Stuff => Releases => Topic started by: Aaron113 on April 14, 2015, 06:31:22 AM

Title: Fakename - Go Undercover!
Post by: Aaron113 on April 14, 2015, 06:31:22 AM
Fakename

What does this do?
This is a small module for ULX that will hide your name and uteam from the public eye.  This would let you go undercover to watch people do things they originally would not do with you present.  Commonly could be used to watch rule breakers quietly or to watch staff members and how they behave without you.

I do not and will not go into huge depths with this module as there are too many circumstances to consider.  Anything you wish to do beyond the basics, you will have to work on yourself.

What this doesn't do?
 - Hide your steamid in the status command
 - Hide your group in the ulx who command
 - Hide your avatar
 - Hide your name when using chatbox

Commands
ulx fakename <fake name> <group>
ulx unfakename

Download
https://github.com/Aaron113/fakename (https://github.com/Aaron113/fakename)

Additional Downloads
Download TTT name change fix (https://www.dropbox.com/s/1oe5ec4dmsqtwe1/sv_fakename_ttt.lua?dl=1) - Place file in fakename/lua/ulx/modules/
Title: Re: UFakename - Go Undercover!
Post by: allofmywutsteam on April 14, 2015, 08:36:13 AM
So it makes your line on the Scoreboard blank, but leaves the avatar? Have any screencaps?
Title: Re: UFakename - Go Undercover!
Post by: Aaron113 on April 14, 2015, 03:15:16 PM
It changes your name without actually requiring you to change your name.  It kind of changes your rank, but without modifying ULib, it's impossible to fully hide your rank.  I'll put some more effort into the post in a bit.

The commands are:
ulx fakename <name> <group>
ulx unfakename
Title: Re: Fakename - Go Undercover!
Post by: Aaron113 on April 14, 2015, 08:20:19 PM
Just so everyone is aware, it has been renamed to just "Fakename".  You can either redownload it with the new URL or relocate your repository.  I will stick a bit more effort into this addon, but I'm trying to keep it pretty basic.
Title: Re: Fakename - Go Undercover!
Post by: Marmigamed on April 18, 2015, 12:54:20 PM
Great job
Title: Re: Fakename - Go Undercover!
Post by: Zoeo on April 19, 2015, 07:38:04 AM
It works but I seem to be getting an annoying error:
Code: [Select]
[ERROR] addons/fakename/lua/ulx/modules/sh/sh_fakename.lua:31: attempt to call field 'UTeamSpawnAuth' (a nil value)
1. SetFakegroup - addons/fakename/lua/ulx/modules/sh/sh_fakename.lua:31
2. call - addons/fakename/lua/ulx/modules/sh/sh_fakename.lua:68
3. __fn - addons/ulib/lua/ulib/shared/commands.lua:943
4. unknown - addons/ulib/lua/ulib/shared/commands.lua:1296
5. Run - lua/includes/modules/concommand.lua:54
6. unknown - addons/ulib/lua/ulib/shared/commands.lua:1310
7. unknown - lua/includes/modules/concommand.lua:54

Using your latest version of the code, it will also not allow me to change my name to another fake name or unfakename myself.
It is also not compatible with TTT - Easyscoreboard (in the sense of changing ranks on the scoreboard)

EDIT:It also literally puts you into the group you specify and restricts your commands to that group, even though it looks like you have access to those commands.
And for some reason when I put the command in it's own file (I previously had it in a file with other commands) it takes away the ability to use the drop down to select your group.
Title: Re: Fakename - Go Undercover!
Post by: Aaron113 on April 19, 2015, 03:03:11 PM
It works but I seem to be getting an annoying error:
Code: [Select]
[ERROR] addons/fakename/lua/ulx/modules/sh/sh_fakename.lua:31: attempt to call field 'UTeamSpawnAuth' (a nil value)
1. SetFakegroup - addons/fakename/lua/ulx/modules/sh/sh_fakename.lua:31
2. call - addons/fakename/lua/ulx/modules/sh/sh_fakename.lua:68
3. __fn - addons/ulib/lua/ulib/shared/commands.lua:943
4. unknown - addons/ulib/lua/ulib/shared/commands.lua:1296
5. Run - lua/includes/modules/concommand.lua:54
6. unknown - addons/ulib/lua/ulib/shared/commands.lua:1310
7. unknown - lua/includes/modules/concommand.lua:54
Fixed in 0e89afac (https://github.com/Aaron113/fakename/commit/e89afac33f559ef8cac03934b612f7ad11a0931b).

Using your latest version of the code, it will also not allow me to change my name to another fake name or unfakename myself.
I do not have this problem, elaborate?

It is also not compatible with TTT - Easyscoreboard (in the sense of changing ranks on the scoreboard)
As I said many times, I am keeping this addon basic.  It is your job to make it compatible, which isn't hard at all.

EDIT:It also literally puts you into the group you specify and restricts your commands to that group, even though it looks like you have access to those commands.
This sounds like an old version where I literally replaced the group function.  Have you updated recently and/or relocated your repository to the latest url?

And for some reason when I put the command in it's own file (I previously had it in a file with other commands) it takes away the ability to use the drop down to select your group.
I will have to investigate this one.  I seem to be having the same issue with group completes not always showing.  I'm sure they did at some point.  Perhaps some assistance from the Ulysses team?
Title: Re: Fakename - Go Undercover!
Post by: Zoeo on April 19, 2015, 04:43:57 PM
Fixed in 0e89afac (https://github.com/Aaron113/fakename/commit/e89afac33f559ef8cac03934b612f7ad11a0931b).
Sweet.

I do not have this problem, elaborate?
It was fixed in the recent update.

As I said many times, I am keeping this addon basic.  It is your job to make it compatible, which isn't hard at all.
I shall try to do that if I can.

This sounds like an old version where I literally replaced the group function.  Have you updated recently and/or relocated your repository to the latest url?
Fixed and added.

Title: Re: Fakename - Go Undercover!
Post by: McSniper121 on April 22, 2015, 07:00:30 AM
I don't seem to understand how this works. Does it hide your name and group in any scoreboard script?
Title: Re: Fakename - Go Undercover!
Post by: Aaron113 on April 22, 2015, 09:51:45 AM
I don't seem to understand how this works. Does it hide your name and group in any scoreboard script?
It will hide your name from the scoreboard and anywhere else other than the default chatbox (it must use some engine name method or something).  It will hide your team from any scoreboard that uses UTeam, but if it doesn't use UTeam, you will have to modify it to work with this addon.  For example, that scoreboard mentioned above seems to use IsAdmin and IsSuperAdmin for rank setting (didn't look thoroughly).  To fix it, you would have to use one of the functions I built into this addon such as Player:GetFakegroup().

To make this addon flawless, I would have to consider too many different scenarios.  This is completely unrealistic for me as a developer.  So, your job as a server owner, is to make it compatible with what addons you wish.  The server that I worked with had everything custom coded without a single addon.  All 100% their/my code.  This made it easy because you can just change everything to work with the fakename.  Without modifying every release to work with my addon, it will never work with everything unless you make it.

This is mostly being considerate of ULib's ranks.  I can't change what group the server sees you as without completely removing all your access as well.
Title: Re: Fakename - Go Undercover!
Post by: McSniper121 on April 22, 2015, 09:57:38 AM
It will hide your name from the scoreboard and anywhere else other than the default chatbox (it must use some engine name method or something).  It will hide your team from any scoreboard that uses UTeam, but if it doesn't use UTeam, you will have to modify it to work with this addon.  For example, that scoreboard mentioned above seems to use IsAdmin and IsSuperAdmin for rank setting (didn't look thoroughly).  To fix it, you would have to use one of the functions I built into this addon such as Player:GetFakegroup().

To make this addon flawless, I would have to consider too many different scenarios.  This is completely unrealistic for me as a developer.  So, your job as a server owner, is to make it compatible with what addons you wish.  The server that I worked with had everything custom coded without a single addon.  All 100% their/my code.  This made it easy because you can just change everything to work with the fakename.  Without modifying every release to work with my addon, it will never work with everything unless you make it.

This is mostly being considerate of ULib's ranks.  I can't change what group the server sees you as without completely removing all your access as well.

Awesome thanks!
Title: Re: Fakename - Go Undercover!
Post by: Neku on April 23, 2015, 10:07:35 PM
Include meta:Name() too. That'll most likely fix that TTT problem.

Edit: Here's a reference: https://github.com/NekuMitsurugi/Simple-Nickname-Functions/blob/master/lua/autorun/neko_nickname_sh.lua
Title: Re: Fakename - Go Undercover!
Post by: Aaron113 on April 23, 2015, 10:46:20 PM
Include meta:Name() too. That'll most likely fix that TTT problem.

Edit: Here's a reference: https://github.com/NekuMitsurugi/Simple-Nickname-Functions/blob/master/lua/autorun/neko_nickname_sh.lua
Ohhh, I got you.  Name just points to the Nick function... For some reason, I thought replacing Nick would also make Name point to the new function.  I should have realized that, I just wasn't thinking.  I'll fix it tomorrow.
Title: Re: Fakename - Go Undercover!
Post by: Zoeo on May 02, 2015, 07:43:35 PM
Include meta:Name() too. That'll most likely fix that TTT problem.

Edit: Here's a reference: https://github.com/NekuMitsurugi/Simple-Nickname-Functions/blob/master/lua/autorun/neko_nickname_sh.lua
What TTT problem would this fix exactly?

If it's the kicking the person for changing name during round, it doesn't sadly :\
Title: Re: Fakename - Go Undercover!
Post by: Zoeo on May 31, 2015, 12:37:30 PM
If anyone wants to fix the issue with not hiding your name from chat.

Find function meta:IsFakenamed() and put this below it (Not in the function, below the function):
Code: [Select]
local function AddFakeNameText( ply, text )
if ply:Alive() and not ply:IsSpec() and not ply:IsActiveDetective() then
chat.AddText( Color( 0, 200, 0 ),
ply:Nick(),
color_white,
": " .. text )
end
if ply:Alive() and ply:IsActiveDetective() then
chat.AddText( Color( 50, 200, 255 ),
ply:Nick(),
color_white,
": " .. text )
end
if ply:IsSpec() and not ply:IsDeadTerror() then
chat.AddText( Color( 24, 161, 35 ),
Format( "(%s) ", string.upper( "team" ) ),
Color( 200, 200, 0 ),
ply:Nick(),
color_white,
": " .. text )
end
if ply:IsDeadTerror() then
chat.AddText( Color( 255, 30, 40 ),
Format( "*%s* ", string.upper( "dead" ) ),
Color( 24, 161, 35 ),
Format( "(%s) ", string.upper( "team" ) ),
Color( 200, 200, 0 ),
ply:Nick(),
color_white,
": " .. text )
end
end

hook.Add( "OnPlayerChat", "Fake_Chatname", function( ply, text, teamchat, dead )
if IsValid( ply ) and ply:IsFakenamed() then
AddFakeNameText( ply, text )
return true
end
end )

Not sure if this is the best way to fix it, but it's the way I've found so far that works.  This will work but when you're a spectator it will always say (TEAM)[fake name]: [message] regardless of whether you say it in team chat or not.  Same goes for player chat it will always say [fake name]: [message] even if you use team chat (Pre round only, when you're a detective or traitor is will say what it normally says when you're unfakenamed).
Title: Re: Fakename - Go Undercover!
Post by: Aaron113 on June 07, 2015, 11:56:08 AM
With help from Zoeo pointing out a couple of things in an example, I just posted a download for a file that will fix TTT name changes.  Just see first post, it is self explanatory.

I also pushed a small change to fakename.  I guess I was removing networked variables the wrong way.  It seems like I can never get it just right or it keeps changing.  No idea.
Title: Re: Fakename - Go Undercover!
Post by: Zoeo on June 09, 2015, 01:18:03 PM
I found a way to change the entity:GetUserGroup(), but by doing so it changes how the ULib and ULX see your rank meaning you cannot use any commands.
Code: [Select]
function meta:GetUserGroup()
local realgroup = self:GetNetworkedString( "UserGroup", "user" )
local fakegroup = self:GetNWString( "FakeGroup", "user" )
if not self:IsFakenamed() then
return realgroup
else
return fakegroup
end
end

As I said though, when the ULX and ULib look at this it thinks that it is your actual rank and not a fake one, so any powers you have are unusable while hidden.  I tried to overwrite a ULib function in order to look at it as your real group instead of as a fakegroup, but I can't seem to get it to work.

NOTE: I should note that the rank MUST exist with this method, attempting to use a rank that is not on the server will cause errors and the ULiband ULX will break/lock you out until you change map/reset server and set your rank back.

As for the issue with the networked varibles, the NWVars were updated in the latest big update so I knew something was going to be up with them.  Setting it as nil instead of false also works.
Title: Re: Fakename - Go Undercover!
Post by: Aaron113 on June 10, 2015, 02:28:54 PM
I found a way to change the entity:GetUserGroup(), but by doing so it changes how the ULib and ULX see your rank meaning you cannot use any commands.
Code: [Select]
function meta:GetUserGroup()
local realgroup = self:GetNetworkedString( "UserGroup", "user" )
local fakegroup = self:GetNWString( "FakeGroup", "user" )
if not self:IsFakenamed() then
return realgroup
else
return fakegroup
end
end

As I said though, when the ULX and ULib look at this it thinks that it is your actual rank and not a fake one, so any powers you have are unusable while hidden.  I tried to overwrite a ULib function in order to look at it as your real group instead of as a fakegroup, but I can't seem to get it to work.

NOTE: I should note that the rank MUST exist with this method, attempting to use a rank that is not on the server will cause errors and the ULiband ULX will break/lock you out until you change map/reset server and set your rank back.
Issues I all ran into.  This is why I am leaving it to server owners to incorporate it into their servers.
Title: Re: Fakename - Go Undercover!
Post by: captainz on June 10, 2015, 07:57:54 PM
Doesn't work with Darkrp though!  :( :(
Title: Re: Fakename - Go Undercover!
Post by: Aaron113 on June 10, 2015, 09:24:39 PM
Doesn't work with Darkrp though!  :( :(
I never tested it, I would have to check it out later.
Title: Re: Fakename - Go Undercover!
Post by: captainz on June 16, 2015, 07:00:08 PM
Have you tested it yet?
Title: Re: Fakename - Go Undercover!
Post by: Zoeo on June 17, 2015, 09:49:20 AM
Here is a fix for the player not showing up as the rank they're supposed to show up as in the ULX playerarg list and in the "ulx who" command

WARNING: These files will overwrite the commands.lua and util.lua within the ULX, if you are using a modified version of commands.lua/util.lua or an updated ULX and ULib that has changed the commands.lua/util.lua in some way, those modifications will no longer exist and could break your ULX/ULib.  This version is made for ULib version 2.52 ULX version 3.62. USE AT YOUR OWN RISK

Put the commands.lua in fakename/lua/ulx/xgui/

Put the util.lua in fakename/lua/ulx/modules/sh/
Title: Re: Fakename - Go Undercover!
Post by: Aaron113 on June 17, 2015, 10:42:01 AM
Doesn't work with Darkrp though!  :( :(
Have you tested it yet?

Fixed 154058ca54 (https://github.com/Aaron113/fakename/commit/154058ca54693ffcf56d2dce499cc285ba250231).  I assume DarkRP overwrites the name functions as well (to add nicknames or something like that).  I simply added more things to hopefully ensure we are the last to overwrite anything.
Title: Re: Fakename - Go Undercover!
Post by: Ryan Hemmet on August 06, 2015, 10:37:45 AM
I wonder if it would be suspicious to go undercover as Nyan Yemmet.. hmmmm....

Anyways, I love this because otherwise I need to change my name on steam, change my group, etc.
Title: Re: Fakename - Go Undercover!
Post by: Aaron113 on August 06, 2015, 10:44:03 AM
I wonder if it would be suspicious to go undercover as Nyan Yemmet.. hmmmm....

Anyways, I love this because otherwise I need to change my name on steam, change my group, etc.
Not at all!  This is indeed one of my favorites from a server I used to admin on a long time ago.  Simply recreated for ULX.
Title: Re: Fakename - Go Undercover!
Post by: jakobg223 on June 17, 2017, 10:40:24 AM
I know basically nothing about lua and all that , so could someone give me some sort of idea on how to make this compatible with ttt easyscoreboardranks?