Open crashzk opened 3 years ago
Duplicate Issues: https://github.com/levelsranks/levels-ranks-core/issues/24
I'm leaving it open just to see if I can solve it and post the feedback here.
Your name buffer is too small which leads to truncation of the name. If the name contained unicode multibyte characters and the last unicode character is cut off mid-bytes, you get the unicode errors reported above. Strings in SourcePawn are just character/byte arrays where one unicode character uses multiple bytes. There is API to check that if you ever need it - as you already use in that GetFixNamePlayer
function.
Use MAX_NAME_LENGTH
(128) when storing client names.
https://github.com/levelsranks/levels-ranks-core/blob/cf155d01f1f508e323d8e7293cbb50022ce412ac/Game%20Server/addons/sourcemod/scripting/levels_ranks/custom_functions.sp#L166-L168
And increase your database schema's name field to 128 as well to be safe. CS:GO was the first game to increase the buffer size from 32 characters to 128 to support up to 32 unicode characters => 32*4. I'm not sure if they restrict the name to max. 32 ascii chars or allow longer names, but you can test that quickly.
@Wend4r I've already tried to hint at a possible truncation problem in the issue you linked above. I see that the original reporter was sent from here - please consider reporting problems in SourceMod with your plugins yourself instead of proxying through a user of yours. We could have solved this 2 years ago! 🍻
@peace-maker, realized there might be a case where the last character becomes invalid due to byte truncation. Size 32 was written with the idea of other Source games in mind, but in CS:GO it's bigger. Thank you for your explanation.
@crashzk, please test 3.1.7 Beta 1
@crashzk, please test 3.1.7 Beta 1
I will be testing and returning with feedback.
Curiosity, I just update the plugin and test it, or would it be better to delete the Levels Ranks tables and start from scratch?
Not obligatory. Core itself will change the column varchar size for MySQL type work https://github.com/levelsranks/levels-ranks-core/blob/7286ed2f38b9f7ee26a99e473a1967ed0695d6c4/Game%20Server/addons/sourcemod/scripting/levels_ranks/database.sp#L182-L183
@Wend4r forgot to send the compiled and when I try to compile the following error:
//SourceMod Batch Compiler
// by the SourceMod Dev Team
//// levelsranks.sp
//
// D:\Google Drive\ZK ServidoresÖ\Servidores CSGO\Editar Plugins\addons\sourcemod\scripting\levelsranks.sp(44) : fatal error 194: user error: This plugin can only compile on lvl_ranks.inc v3.1.6.
//
//
// Compilation aborted.
// 1 Error.
//
// Compilation Time: 0,25 sec
// ----------------------------------------
Press enter to exit ...
@Wend4r I sent it and so far the problem still remains:
L 04/29/2021 - 00:00:52: SourceMod error session started
L 04/29/2021 - 00:00:52: Info (map "de_mirage") (file "/home/clientes/OGP_User_Files/whmcs/2057/csgo/addons/sourcemod/logs/errors_20210429.log")
L 04/29/2021 - 00:00:52: [levelsranks.smx] SQL_Callback Error (178): Incorrect string value: '\xF0\x9D\x99\x8D\xF0\x9D...' for column `zkservid_lvlrank`.`lvl_competitivo`.`name` at row 1
Table apparently updated, but the error continues.
I will check if after a reset in the database the problem continues.
Another thing I noticed, but I don’t know if it has to do with this problem, is that players that enter the nickname invisible, characters invisible rank doesn’t save their data, keeps showing the following message to them when they try to use any LR command:
[LR] You account is not loaded. Please reconnect on the server!
This error only stopped after he put a valid nickname on the stea and reconnected the server.
(╯°□°)╯︵ ┻━┻
No, you should start debugging this first. Logging the failing queries which contain the name might be a good start. If you have a short reproducible test case you're welcome to reopen that issue.
I am resetting the database, and even deleting all of the table that has an empty name, the problem still occurs:
L 04/29/2021 - 07:45:17: [levelsranks.smx] SQL_Callback Error (1922): Incorrect string value: '\xF0\x9D\x99\x8D\xF0\x9D...' for column `zkservid_lvlrank`.`lvl_competitivo`.`name` at row 1
Seeing the database there are no more character errors in the names of the players, everyone is right and they appear as they wrote.
I haven't tested it with the characters of this type: 𝐌𝐎𝐑𝐆𝐀𝐃𝐎
or 𝓼𝔁𝓵𝓽𝔂
I will use some of these characters to test and see if that would be the problem.
@Wend4r apparently I identified the problem, players that use nick with characters, strange
that generate this error 👑𝓕𝓡𝓞𝓢𝓟 👑
.
Player connected with this nick he did not have access to the rank and did not even update his rank, he tried to use the command !lvl
and showed him the following error:
[LR] You account is not loaded. Please reconnect on the server!
Even leaving emojis just doesn't work, it was only when he wrote the normal nickname, frosp
.
You can't even have emojis from what I noticed.
Any way to fix this?
Any way to fix this?
https://github.com/levelsranks/levels-ranks-core/issues/57#issuecomment-828952777
or enter "0"
for "lr_db_allow_utf8mb4"
, since your database is incompatible with SourceMod MySQL Driver with 4-byte characters.
https://github.com/levelsranks/levels-ranks-core/blob/master/Game%20Server/addons/sourcemod/configs/levels_ranks/settings.ini#L124
Any way to fix this?
or enter
"0"
for"lr_db_allow_utf8mb4"
, since your database is incompatible with SourceMod MySQL Driver with 4-byte characters. https://github.com/levelsranks/levels-ranks-core/blob/master/Game%20Server/addons/sourcemod/configs/levels_ranks/settings.ini#L124
Ok, I changed:
// (***) Записывать ли в MySQL базу 4-ёх байтные символы (применение кодировки utf8mb4) из никнеймов игроков? [ 0 - будет использоваться utf8, 1 - да ]
// Некоторые WEB-хостинги не предоставляют поддержку кодировки utf8mb4 для MySQL баз или имеют с ней проблемы.
"lr_db_allow_utf8mb4" "0"
// (***) Тип кодировки в таблице.
// 0 - utf8(mb4)_general_ci .
// 1 - utf8(mb4)_unicode_ci (Рекомендуется для MySQL 8.0+).
"lr_db_character_type" "0"
I will be testing and returning with feedback.
Just passing to leave the feedback, even changing the cvars mentioned above, be it 0 or 1 the error still continues.
L 05/20/2021 - 15:08:36: [levelsranks.smx] SQL_Callback Error (8962): Incorrect string value: '\xF0\x9F\x9B\xB8' for column `zkservid_lvlrank`.`lvl_competitivo`.`name` at row 1
@crashzk any news? I has the same for months now but it barely occurs since there is not much player with special characters and emojis
@Erik-97 problem still occurs with me, I tried everything mentioned in this issues and others and nothing.
As said, problem is with nicks with special characters and emojis, solution I found now would be to send these players to change nicks and even force the change of nicks if necessary.
Also, if they connect with these buggy nicks, these errors still occur for them:
[LR] You account is not loaded. Please reconnect on the server!
I believe just waiting for a fix.
@crashzk this worked for me "lr_db_allow_utf8mb4" "0" "lr_db_character_type" "1" also set all tables and name variables manually to "utf8_unicode_ci", this worked for me surprisingly
@crashzk this worked for me "lr_db_allow_utf8mb4" "0" "lr_db_character_type" "1" also set all tables and name variables manually to "utf8_unicode_ci", this worked for me surprisingly
I will try here and return with the result.
[EDIT1] In any case mine is configured like this:
"lr_db_allow_utf8mb4" "0"
"lr_db_character_type" "0"
In the MySQL database everything was set to utf8mb4_unicode_ci
, apparently without errors too, I didn't have any more problems, at least no errors in the server logs.
Just to leave an updated feedback.
So far the configuration in the settings.ini file:
"lr_db_allow_utf8mb4" "0"
"lr_db_character_type" "0"
Solved my problem, no more error logs regarding it.
I believe it can be marked as resolved. In any case I will be leaving it open in case someone continues to receive an error even with this change.
Doubt, I'm using the latest version of Levels Ranks Core that is on GitHub:
Full list of the plugin and modules I use:
I am always getting this error:
Any way to fix this? What can it be?
I have already completely deleted the tables and created the databases again and nothing to solve the problem.