But I think sourcemod works with a longer user name than 32 bytes. (I must test it.)
In any case, the string returned from GetClientName in conjunction with MAX_NAME_LENGTH returns the corrupted string.
Here is an example of a user with the name "████████████████████" (strlen =
60)
PHP Code:
char sName[MAX_NAME_LENGTH];
GetClientName(client, sName, sizeof(sName));
char escaped_name[MAX_NAME_LENGTH * 2];
hDatabase.Escape(name, escaped_name, sizeof(escaped_name));
FormatEx(query, sizeof(query), "INSERT INTO test (server, steamid, name) VALUES ('%s', '%s', '%s');", ServerIP, steamid, escaped_name);
Missing apostrophe at the end!
Code:
L 02/22/2018 - 09:00:58: Query: INSERT INTO test (server, steamid, name) VALUES ('5.196.99.41:27015', '[U:1:XXXXXXXX]', '██████████?);
L 02/22/2018 - 09:00:58: Query failed! Incorrect string value: '\xE2' for column 'name' at row 1
__________________