Fixed bugs:

client_print: if used with index=0, the message was printed many times
 show_hudmessage: correct language handling for index index=0
This commit is contained in:
Pavol Marko 2004-08-19 16:37:15 +00:00
parent 36aa331530
commit 008474fbe5

View File

@ -205,7 +205,7 @@ static cell AMX_NATIVE_CALL client_print(AMX *amx, cell *params) /* 3 param */
msg = format_amxstring(amx, params, 3, len);
msg[len++] = '\n';
msg[len] = 0;
UTIL_ClientPrint(NULL, params[2], msg);
UTIL_ClientPrint(pPlayer->pEdict, params[2], msg);
}
}
}
@ -288,11 +288,23 @@ static cell AMX_NATIVE_CALL show_hudmessage(AMX *amx, cell *params) /* 2 param
{
int len;
g_langMngr.SetDefLang(params[1]);
char* message = UTIL_SplitHudMessage( format_amxstring(amx,params,2,len) );
if (params[1] == 0) {
UTIL_HudMessage(NULL, g_hudset, message );
char* message = NULL;
if (params[1] == 0)
{
for (int i = 1; i <= gpGlobals->maxClients; ++i)
{
CPlayer *pPlayer = GET_PLAYER_POINTER_I(i);
if (pPlayer->ingame)
{
g_langMngr.SetDefLang(i);
message = UTIL_SplitHudMessage(format_amxstring(amx, params, 2, len));
UTIL_HudMessage(pPlayer->pEdict, g_hudset, message);
}
else {
}
}
else
{
message = UTIL_SplitHudMessage(format_amxstring(amx,params,2,len));
int index = params[1];
if (index < 1 || index > gpGlobals->maxClients){
amx_RaiseError(amx,AMX_ERR_NATIVE);