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

non-english nickname #888

Open
iLuXing opened this issue Mar 7, 2024 · 7 comments
Open

non-english nickname #888

iLuXing opened this issue Mar 7, 2024 · 7 comments
Labels
enhancement New feature or request

Comments

@iLuXing
Copy link

iLuXing commented Mar 7, 2024

When a player enters the game with a non-English nickname, the server will not receive or display any information.

Previously, a Chinese programmer created a plugin for nicknames with Chinese characters. This plugin located the address of the CheckPlayerName function through a characteristic code search and then hooked and managed it. Through this hooking process, the plugin fixed the crash issue caused by the incorrect use of CharLowerA in samp_server.exe.

However, with the updates to the game version, the plugin has become incompatible and can no longer be used. I believe this issue has been a headache for many servers and players, and I hope omp can address and fix this problem.

There are indeed experts who have developed Advanced-SA-NickName (https://github.com/KrYpToDeN/Advanced-SA-NickName), but it is not compatible with omp-server. Furthermore, based on my cursory examination of the code, it seems to be tailored specifically for Cyrillic script.

Thanks for your dedication and efforts.

@iLuXing iLuXing added the enhancement New feature or request label Mar 7, 2024
@NexiusTailer
Copy link
Contributor

Try using AllowNickNameCharacter native.

@iLuXing
Copy link
Author

iLuXing commented Mar 7, 2024

Try using AllowNickNameCharacter native.

This is invalid because when players use Chinese names to connect to the server, the terminal does not indicate that there are players connecting. Furthermore, UTF-8 encodes 27,484 Chinese characters, and I cannot use the function you mentioned to achieve this.

thanks.

@NexiusTailer
Copy link
Contributor

NexiusTailer commented Mar 7, 2024

So, what exact solution done in this Chinese plugin, like, what exactly it modified inside CheckPlayerName to solve the issue? Maybe there is sense to share it, so, other people can help you with porting it or advise some alternative ways similar to the algorithm used in that plugin.

Also a question just of curiosity: does Advanced-SA-NickName plugin fit your needs in general (it solves your problem under samp server) and just have some extra code for Cyrillic you may consider unneded, or it still cannot handle Chinese characters and should be modified to work with them properly? I know this plugin is pretty popular among ru crmp servers so I asking this in favour of that it also can be improved for your case and be more useful for Chinese server owners as well, even though it is currently only available for samp server and not adapted (but may be in future).

@iLuXing
Copy link
Author

iLuXing commented Mar 7, 2024

NPatcher.zip
http://www.gtaun.com/viewthread.php?tid=682&extra=page%3D5

I only have the .dll file of this plugin, which was released in 2011.
According to the description, this .dll file fixes the crash issue caused by the incorrect use of CharLowerA in samp_server.exe.
I don't have much knowledge about C++ and Windows programs, so I guess it might be that server.exe cannot receive double-byte characters.

thanks for replying.

@NexiusTailer
Copy link
Contributor

NexiusTailer commented Mar 7, 2024

Thank you for sharing. Seems the main problem is really just in two-byte characters, so the author also suggest hooking and rewriting strlen, strcmp and strfind to work with such strings contain Chinese nicknames. Now I'm curious is it possible to bring support for non-ANSI encodings for string functions out-of-the-box in omp server, apart from allowing such nicknames too.

@iLuXing
Copy link
Author

iLuXing commented Mar 7, 2024

Thank you for sharing. Seems the main problem is really just in two-byte characters, so the author also suggest hooking and rewriting strlen, strcmp and strfind to work with such strings contain Chinese nicknames. Now I'm curious is it possible to bring support for non-ANSI encodings at least for string functions out-of-the-box in omp server, apart from allowing such nicknames too.

sorry, my programming ability is as bad as my English. I look forward to you and the big shots of omp trying to solve this problem. Thank you.

@dockfries
Copy link

dockfries commented Apr 30, 2024

I think AllowNickNameCharacter is valid as long as it internally judges characters in decimal bytes.

Even if a multi-byte character, such as a Chinese character, may be represented by three decimal numbers as a Chinese character in utf8, then I simply let each bit of 0-255 as a valid character.

At least that's how I implemented it in my own library with samp-node.
That is, the loop is allowed when OnGameModeInit

    for (let i = 0; i <= 255; i++) {
      if (!isNickNameCharacterAllowed(i))
        allowNickNameCharacter(i, true);
    }

As long as his underlying principle is to determine the character of each index, It is equivalent to supporting all encodings of full characters, because the description of a character in different charset always lies in the parsing of 1 or more of 0-255 as a character

Simply doing so allows the player to connect to the server using a nickname with multi-byte characters.

It just means that there are still two issues that are :

  1. current terminal output of open.mp is still not supported, encounter this multi-character output will cut off the string.
  2. when a player connect with a multi-character nickname and not use allowNickNameCharacter, the server shows server closed message for player

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

3 participants