From 48377168b2801ae7a4aca54ca59a2f91e7380b5e Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 1 Mar 2006 02:17:20 +0000 Subject: [PATCH] Added ClearSyncHud() --- plugins/cstrike/statsx.sma | 17 ++++++++--------- plugins/include/amxmodx.inc | 12 ++++++++++++ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/plugins/cstrike/statsx.sma b/plugins/cstrike/statsx.sma index 9bb6ece5..8279bb1a 100755 --- a/plugins/cstrike/statsx.sma +++ b/plugins/cstrike/statsx.sma @@ -176,7 +176,7 @@ new t_sText[MAX_TEXT_LENGTH + 1] = "" new t_sName[MAX_NAME_LENGTH + 1] = "" new t_sWpn[MAX_WEAPON_LENGTH + 1] = "" -new g_LastChannel[33] = {0, ...} +new g_HudSync_EndRound //-------------------------------- // Initialize @@ -225,6 +225,8 @@ public plugin_init() // Init buffers and some global vars. g_sBuffer[0] = 0 save_team_chatscore() + + g_HudSync_EndRound = CreateHudSyncObj() } public plugin_cfg() @@ -262,9 +264,9 @@ public plugin_cfg() set_hudtype_killer(Float:fDuration) set_hudmessage(220, 80, 0, 0.05, 0.15, 0, 6.0, fDuration, (fDuration >= g_fHUDDuration) ? 1.0 : 0.0, 1.0, -1) -set_hudtype_endround(id, Float:fDuration) +set_hudtype_endround(Float:fDuration) { - set_hudmessage(100, 200, 0, 0.05, 0.55, 0, 0.02, fDuration, (fDuration >= g_fHUDDuration) ? 1.0 : 0.0, 1.0, g_LastChannel[id]) + set_hudmessage(100, 200, 0, 0.05, 0.55, 0, 0.02, fDuration, (fDuration >= g_fHUDDuration) ? 1.0 : 0.0, 1.0) } set_hudtype_attacker(Float:fDuration) @@ -831,8 +833,7 @@ show_roundend_hudstats(id, Float:fGameTime) // If round end timer is zero clear round end stats. if (g_fShowStatsTime == 0.0) { - set_hudtype_endround(id, 0.05) - show_hudmessage(id, "") + ClearSyncHud(id, g_HudSync_EndRound) #if defined STATSX_DEBUG log_amx("Clear round end HUD stats for #%d", id) #endif @@ -854,9 +855,8 @@ show_roundend_hudstats(id, Float:fGameTime) // Show stats only if more time left than coded minimum. if (fDuration >= HUD_MIN_DURATION) { - g_LastChannel[id] = next_hudchannel(id) - set_hudtype_endround(id, fDuration) - show_hudmessage(id, "%s", g_sAwardAndScore) + set_hudtype_endround(fDuration) + ShowSyncHudMsg(id, g_HudSync_EndRound, "%s", g_sAwardAndScore) #if defined STATSX_DEBUG log_amx("Show %1.2fs round end HUD stats for #%d", fDuration, id) #endif @@ -1679,7 +1679,6 @@ public client_connect(id) g_izKilled[id][KILLED_KILLER_STATSFIX] = 0 g_izShowStatsFlags[id] = 0 // Clear all flags g_fzShowUserStatsTime[id] = 0.0 - g_LastChannel[id] = 0 return PLUGIN_CONTINUE } diff --git a/plugins/include/amxmodx.inc b/plugins/include/amxmodx.inc index 055a83f9..48abfdad 100755 --- a/plugins/include/amxmodx.inc +++ b/plugins/include/amxmodx.inc @@ -946,9 +946,21 @@ native CreateHudSyncObj(num=0, ...); * it proceeds to write another. It will only do this in the case * of that channel not having been cleared already. * Target can be 0 for all players or 1-get_maxplayers(). + * You must use set_hudmessage, although the channel parameter is + * entirely ignored. */ native ShowSyncHudMsg(target, syncObj, const fmt[], ...); +/** + * Clears the display on a HudSync Object. This is essentially the same + * thing as: ShowSyncHudMsg(x, y, ""), except doing that would send + * out two messages and use up another channel. This re-uses the last + * channel and clears it at the same time. + * Note: for this you do not have to use set_hudmessage(). + * Note: target can be 0 for all players. + */ +native ClearSyncHud(target, syncObj); + //no native int3();