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

Add SetClientName native. #313

Merged
merged 6 commits into from Apr 2, 2015
Merged

Add SetClientName native. #313

merged 6 commits into from Apr 2, 2015

Conversation

psychonic
Copy link
Member

Our current method for changing names (SetUserInfo), as implemented in the sm_rename command, does not work on the top three games by SM install count - TF2 (temporarily due to game bug, this works around), CS:S, and CS:GO. There may be others as well.

By implementing a new SetClientName native to wrap CBaseClient::SetName, we gain better game compatibility as well as bypass name change cooldown restrictions in the engine. SetName is one function earlier in the same vtable as SetUserInfo for every supported game, so there's very little extra support burden.

I've also updated the playercommands plugin to use the new native for sm_rename. I removed the old, ep1-specific logic and message for name changes while dead, too. The game logic it was considering was actually specific to CS:S, not the ep1 base, and hasn't been present in CS:S since the Orangebox port years ago.

However, due to some of the legacy code in CS:S, a hook on IVEngineServer::ClientCommand was added to block changes of the client "name" convar sent from the server. Any change to that client convar in Orangebox or later now resets the client's name to their Steam name.

@GoD-Tony
@KyleSanderson

@@ -333,6 +333,15 @@ native ActivateEntity(entity);
native SetClientInfo(client, const String:key[], const String:value[]);

/**
* Something
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something appears to be outstanding.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. This is fixed now.

@ghost
Copy link

ghost commented Mar 23, 2015

Is this for 1.7 possible or only 1.8+?

@GoD-Tony
Copy link
Contributor

The old bug report for reference: https://bugs.alliedmods.net/show_bug.cgi?id=5441

However, due to some of the legacy code in CS:S, a hook on IVEngineServer::ClientCommand was added to block changes of the client "name" convar sent from the server.

Finally some closure on that problem. Nice find!

@psychonic
Copy link
Member Author

Is this for 1.7 possible or only 1.8+?

I don't have a firm answer for that yet. We generally try to avoid new features in stable releases, especially ones that add new gamedata. However, this could also be considered a bug fix.

The old bug report for reference: https://bugs.alliedmods.net/show_bug.cgi?id=5441

Thanks. I had forgotten about that. I've left a comment there to point here.

psychonic added a commit that referenced this pull request Apr 2, 2015
@psychonic psychonic merged commit 91302da into master Apr 2, 2015
@ghost
Copy link

ghost commented Apr 2, 2015

So 1.8+?

@psychonic
Copy link
Member Author

So 1.8+?

It has been less than 24 hours since it landed on the dev branch. That is not an indication that it will or will not end up on the stable branch before the next stable release.

One would think that we might want to intentionally wait some time and let early-adopters test it before we determine it to be "stable".

psychonic added a commit that referenced this pull request Apr 7, 2015
@PlayBoy31
Copy link
Contributor

can you had this for Day of Defeat source too please ?

@KyleSanderson
Copy link
Member

What issues are you seeing on Day of Defeat: Source?

@psychonic
Copy link
Member Author

can you had this for Day of Defeat source too please ?

This works for all games that SM supports. (The old sm_rename should have worked fine too for DoD:S).

@PlayBoy31
Copy link
Contributor

I tested (on 1.7.1 182) on dods but no success: SetClientName not supported by this mod
there is no gamedata for dods, normal?

@psychonic
Copy link
Member Author

The gamedata updater hasn't been updated for this game yet and is probably overwriting your gamedata files with ones from before this was added.

@PlayBoy31
Copy link
Contributor

ok, so it will be updated in a few minutes/hours?

@psychonic
Copy link
Member Author

The updater is updated now.

@heshengjie
Copy link

It seems that sm_rename(SetClientName) doesn't work properly in CS:GO, the player name will be reverse to steam name after sm_rename command executed
I tested "1.7.1-git5182.tar.gz" and "1.8.0-git5393.tar.gz" on CS:GO server with Metamod:Source version 1.10.4 and OS version centos 6.5 32bit,

@psychonic
Copy link
Member Author

CS:GO was one of the game explicitly tested with this. Unless the last game update happened it break it, it should work.

I'll try to take a look in the next day or two.

@heshengjie
Copy link

I notic that in extension.cpp, some code under the compile switch "SOURCE_ENGINE == SE_CSS" is added to fix the name reverting in CSS.
so, I change "SOURCE_ENGINE == SE_CSGO" here and recompile, the sm_rename works in CS:GO

@psychonic
Copy link
Member Author

Good investigative work! I can confirm now looking at CS:GO's server.so that CCSPlayer::ChangeName does have similar to or the same logic as CS:S's version. I must have not added the ifdef until after testing.

@psychonic
Copy link
Member Author

This is fixed now.

peace-maker added a commit that referenced this pull request Mar 29, 2023
peace-maker added a commit that referenced this pull request Mar 29, 2023
* Remove obsolete slapslay.phrases.txt

That plugin isn't in the stock arsenal since forever.

* Remove "Dead Player Rename" phrase

Unused since #313

* Remove nominations phrases from rockthevote

Those phrases were moved to their own nominations.phrases.txt

* Remove "Next Map" phrase from nextmap.phrases.txt

It was moved to basetriggers.phrases.txt

* Remove unused phrases from common.phrases.txt

Only "Slapped Player" was moved to funvotes.phrases.txt

* Delete empty phrase files

* Fix workflow python version selection

3.10 would select Python 3.1 and fail

* Deduplicate "Please select a map" phrase

Only keep it in the plugin.basecommands.txt file and remove it from the basevotes.phrases.txt.

Both plugins using the phrase load the basecommands phrases.

* Allow manual triggering of translations action

* Actually use the nextmap phrases

They were never referenced in the plugin. The "ago" phrase doesn't work the way it is and needs more rethinking.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants