fixed hud message syncing

This commit is contained in:
David Anderson 2006-03-01 00:10:23 +00:00
parent 84b09301e6
commit 62489d05cc

View File

@ -3940,7 +3940,7 @@ static cell AMX_NATIVE_CALL ShowSyncHudMsg(AMX *amx, cell *params)
int len = 0; int len = 0;
char* message = NULL; char* message = NULL;
int index = params[1]; int index = params[1];
unsigned int sync_obj = static_cast<unsigned int>(params[2]) - 1; unsigned int sync_obj = static_cast<unsigned int>(params[2]) - 1;
if (sync_obj >= g_hudsync.size()) if (sync_obj >= g_hudsync.size())
{ {
@ -3959,16 +3959,14 @@ static cell AMX_NATIVE_CALL ShowSyncHudMsg(AMX *amx, cell *params)
if (pPlayer->ingame) if (pPlayer->ingame)
{ {
g_langMngr.SetDefLang(i); g_langMngr.SetDefLang(i);
message = UTIL_SplitHudMessage(format_amxstring(amx, params, 3, len));
g_hudset.channel = pPlayer->NextHUDChannel(); g_hudset.channel = pPlayer->NextHUDChannel();
pPlayer->channels[g_hudset.channel] = gpGlobals->time; pPlayer->channels[g_hudset.channel] = gpGlobals->time;
CheckAndClearPlayerHUD(pPlayer, g_hudset.channel, sync_obj); CheckAndClearPlayerHUD(pPlayer, g_hudset.channel, sync_obj);
message = UTIL_SplitHudMessage(format_amxstring(amx, params, 3, len));
UTIL_HudMessage(pPlayer->pEdict, g_hudset, message); UTIL_HudMessage(pPlayer->pEdict, g_hudset, message);
} }
} }
} else { } else {
message = UTIL_SplitHudMessage(format_amxstring(amx, params, 3, len));
if (index < 1 || index > gpGlobals->maxClients) if (index < 1 || index > gpGlobals->maxClients)
{ {
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index); LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
@ -3982,6 +3980,7 @@ static cell AMX_NATIVE_CALL ShowSyncHudMsg(AMX *amx, cell *params)
g_hudset.channel = pPlayer->NextHUDChannel(); g_hudset.channel = pPlayer->NextHUDChannel();
pPlayer->channels[g_hudset.channel] = gpGlobals->time; pPlayer->channels[g_hudset.channel] = gpGlobals->time;
CheckAndClearPlayerHUD(pPlayer, g_hudset.channel, sync_obj); CheckAndClearPlayerHUD(pPlayer, g_hudset.channel, sync_obj);
message = UTIL_SplitHudMessage(format_amxstring(amx, params, 3, len));
UTIL_HudMessage(pPlayer->pEdict, g_hudset, message); UTIL_HudMessage(pPlayer->pEdict, g_hudset, message);
} }
} }