Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toggleable name hider #120

Closed
AverageVirusTotalEnjoyer opened this issue Dec 31, 2023 · 37 comments
Closed

toggleable name hider #120

AverageVirusTotalEnjoyer opened this issue Dec 31, 2023 · 37 comments
Labels
enhancement New feature or request

Comments

@AverageVirusTotalEnjoyer

please make a feature where we can toggle on and off our nametag when looked at and in chat

@AverageVirusTotalEnjoyer
Copy link
Author

@winstxnhdw

@winstxnhdw
Copy link
Owner

I don't understand. You mean you don't want your name to be shown in chat?

@AverageVirusTotalEnjoyer
Copy link
Author

basically, and also my nametag

@AverageVirusTotalEnjoyer
Copy link
Author

yk, the name that shows over your head?

@winstxnhdw
Copy link
Owner

Sure, I'll take a look to see if it's possible.

@AverageVirusTotalEnjoyer
Copy link
Author

alright keep me updated

@armorfid
Copy link
Contributor

armorfid commented Jan 2, 2024

@AverageVirusTotalEnjoyer be aware, if you don't have a proper name, some hosts will start saying "who the fuck are you" and kicking you, I speak from experience from having my name set to ''' 😅

@winstxnhdw
Copy link
Owner

winstxnhdw commented Jan 2, 2024

I am not even sure if it's possible to change your username in runtime via RPCs. They have a method that is called when you join a lobby but the method only accepts the Steam ID, and your username is resolved on their client

private void SendNewPlayerValuesServerRpc(ulong newPlayerSteamId)

@AverageVirusTotalEnjoyer
Copy link
Author

@armorfid each time hosts try to kick me it never works for some reason

@armorfid
Copy link
Contributor

armorfid commented Jan 2, 2024

what happens then? do they start raging? 😆

@tslpy1
Copy link

tslpy1 commented Jan 2, 2024

anti kick ? is it possible?

@AverageVirusTotalEnjoyer
Copy link
Author

@armorfid sometimes, or they just restart the lobby

@AverageVirusTotalEnjoyer
Copy link
Author

I am not even sure if it's possible to change your username in runtime via RPCs. They have a method that is called when you join a lobby but the method only accepts the Steam ID, and your username is resolved on their client

private void SendNewPlayerValuesServerRpc(ulong newPlayerSteamId)

Could you spoof the userid?

@AverageVirusTotalEnjoyer
Copy link
Author

Hypothetically speaking

@armorfid
Copy link
Contributor

armorfid commented Jan 2, 2024

very good question... 😈

@winstxnhdw
Copy link
Owner

Maybe @armorfid can try? 👉👈

@armorfid
Copy link
Contributor

armorfid commented Jan 2, 2024

I dunno if it will prevent kicking, but looking at the code, it seems as it might possibly permit rejoining? 😆 will test!

@armorfid
Copy link
Contributor

armorfid commented Jan 2, 2024

So if you spoof your Steam ID to a random value, the game will kick you on join due to this:

if (!GameNetworkManager.Instance.steamIdsInLobby.Contains(newPlayerSteamId))
{
    NetworkManager.Singleton.DisconnectClient(this.actualClientId);
    return;
}

However, if you cancel out SendNewPlayerValuesServerRpc with static bool Prefix() => false;, it seems the server fails to associated a Steam ID to your player object, so it can't resolve your Steam name and gives you an empty name tag, and you can most likely rejoin after being kicked (unconfirmed) since the KickedClientIds search never happens. Although, I can't tell so far if this prevents being kicked. Looking at the kicking code, I'm still not sure how a player would become unkickable.

@winstxnhdw
Copy link
Owner

winstxnhdw commented Jan 2, 2024

The host keeps tracks of all players that it kicks.

if (StartOfRound.Instance.KickedClientIds.Contains(newPlayerSteamId))
{
	NetworkManager.Singleton.DisconnectClient(this.actualClientId);
	return;
}

If we randomise our steam ID every time we join, we can rejoin a lobby we've been kicked from.

@winstxnhdw
Copy link
Owner

KickPlayer eventually uses Unity's NetworkConnectionManager to kick you. Since the host receives an incorrect Steam ID, NetworkConnectionManager may not be able to resolve your actual Steam ID and fail to kick you.

@armorfid
Copy link
Contributor

armorfid commented Jan 2, 2024

The host keeps tracks of all players that it kicks.

Yes but in KickPlayer, the value added to KickedClientIds is StartOfRound.Instance.allPlayerScripts[playerObjToKick].playerSteamId, which is never instantiated for you if your SendNewPlayerValuesServerRpc didn't run.

If we randomise our steam ID every time we join, we can rejoin a lobby we've been kicked from.

I tried that, like I said, it doesn't work due to the reason in my previous comment, you simply get instakicked on join.

@winstxnhdw
Copy link
Owner

You're right. Let me test.

@winstxnhdw
Copy link
Owner

Looks like they can't kick me LOL

@winstxnhdw
Copy link
Owner

Okay, so our names don't show up on their lobby. They can't kick me. They can only restart the server.

@armorfid
Copy link
Contributor

armorfid commented Jan 2, 2024

with static bool Prefix() => false ?

@winstxnhdw
Copy link
Owner

Yeap.

@winstxnhdw
Copy link
Owner

Problem now is how do we make this a feature. I am sure not everybody wants to play without a name.

@armorfid
Copy link
Contributor

armorfid commented Jan 2, 2024

Replace false with a Setting entry? 🤣 Although, you'd have to join/host a game first to toggle it on, then join a public game. I most definitely think having this enabled by default is not a good idea 😅

@winstxnhdw
Copy link
Owner

Feels bad but I might actually have to introduce a GUI :(

@winstxnhdw
Copy link
Owner

No, I refuse. I will make it a keybind instead.

@winstxnhdw winstxnhdw added the enhancement New feature or request label Jan 2, 2024
@winstxnhdw
Copy link
Owner

winstxnhdw commented Jan 2, 2024

Alright, I've pushed. Anti-kick has been added! It's funny as hell because your name becomes a random teammate's name and they kick their own friends thinking it's you.

You can toggle on Anti-kick with \. As mentioned above, this must be done before joining a game.

@armorfid
Copy link
Contributor

armorfid commented Jan 2, 2024

evil laugh

@winstxnhdw
Copy link
Owner

Oh, and 100% thanks to @armorfid.

@armorfid
Copy link
Contributor

armorfid commented Jan 2, 2024

I do feel like we may have opened a Pandora's box with this, but only time will tell

@armorfid
Copy link
Contributor

armorfid commented Jan 3, 2024

I don't think your SendNewPlayerValuesClientRpc call works as intended, it's a ClientRpc so it's never sent to the server. All it seems to do is mangle up the player names on our end.

@winstxnhdw
Copy link
Owner

Names are mangled either way. With this, at least locally, you can see your own name.

@armorfid
Copy link
Contributor

armorfid commented Jan 3, 2024

ah you're right, I got mixed up, with the anti-kick we don't receive any names until someone else connects either way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants