Merge pull request #159 from Arkshine/fix-get_user_name

Fix typo in get_user_name() where hostname was returned as blank string
This commit is contained in:
Vincent Herbet 2014-11-13 21:20:40 +01:00
commit 8951f80748

View File

@ -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];
int maxlen = params[3] + 1; // EOS.
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);
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 */