From 4ffd847b7adc1c9351a6c9b42a55d112d152fa00 Mon Sep 17 00:00:00 2001 From: Arkshine Date: Thu, 13 Nov 2014 19:01:26 +0100 Subject: [PATCH] Fix typo in get_user_name() where hostname was returned as blank string --- amxmodx/amxmodx.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/amxmodx/amxmodx.cpp b/amxmodx/amxmodx.cpp index c4b90a37..60f5daf5 100755 --- a/amxmodx/amxmodx.cpp +++ b/amxmodx/amxmodx.cpp @@ -668,10 +668,12 @@ static cell AMX_NATIVE_CALL show_dhudmessage(AMX *amx, cell *params) /* 2 param static cell AMX_NATIVE_CALL get_user_name(AMX *amx, cell *params) /* 3 param */ { int index = params[1]; - - return set_amxstring_utf8(amx, params[2], (index < 1 || index > gpGlobals->maxClients) ? - hostname->string : - g_players[index].name.c_str(), g_players[index].name.size(), params[3] + 1); + int maxlen = params[3] + 1; // EOS. + + if (index < 1 || index > gpGlobals->maxClients) + return set_amxstring_utf8(amx, params[2], hostname->string, strlen(hostname->string), maxlen); + else + return set_amxstring_utf8(amx, params[2], g_players[index].name.c_str(), g_players[index].name.size(), maxlen); } static cell AMX_NATIVE_CALL get_user_index(AMX *amx, cell *params) /* 1 param */