Added ClearSyncHud()

This commit is contained in:
David Anderson 2006-03-01 02:17:20 +00:00
parent d89f216682
commit 48377168b2
2 changed files with 20 additions and 9 deletions

View File

@ -176,7 +176,7 @@ new t_sText[MAX_TEXT_LENGTH + 1] = ""
new t_sName[MAX_NAME_LENGTH + 1] = "" new t_sName[MAX_NAME_LENGTH + 1] = ""
new t_sWpn[MAX_WEAPON_LENGTH + 1] = "" new t_sWpn[MAX_WEAPON_LENGTH + 1] = ""
new g_LastChannel[33] = {0, ...} new g_HudSync_EndRound
//-------------------------------- //--------------------------------
// Initialize // Initialize
@ -225,6 +225,8 @@ public plugin_init()
// Init buffers and some global vars. // Init buffers and some global vars.
g_sBuffer[0] = 0 g_sBuffer[0] = 0
save_team_chatscore() save_team_chatscore()
g_HudSync_EndRound = CreateHudSyncObj()
} }
public plugin_cfg() public plugin_cfg()
@ -262,9 +264,9 @@ public plugin_cfg()
set_hudtype_killer(Float:fDuration) 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_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) 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 round end timer is zero clear round end stats.
if (g_fShowStatsTime == 0.0) if (g_fShowStatsTime == 0.0)
{ {
set_hudtype_endround(id, 0.05) ClearSyncHud(id, g_HudSync_EndRound)
show_hudmessage(id, "")
#if defined STATSX_DEBUG #if defined STATSX_DEBUG
log_amx("Clear round end HUD stats for #%d", id) log_amx("Clear round end HUD stats for #%d", id)
#endif #endif
@ -854,9 +855,8 @@ show_roundend_hudstats(id, Float:fGameTime)
// Show stats only if more time left than coded minimum. // Show stats only if more time left than coded minimum.
if (fDuration >= HUD_MIN_DURATION) if (fDuration >= HUD_MIN_DURATION)
{ {
g_LastChannel[id] = next_hudchannel(id) set_hudtype_endround(fDuration)
set_hudtype_endround(id, fDuration) ShowSyncHudMsg(id, g_HudSync_EndRound, "%s", g_sAwardAndScore)
show_hudmessage(id, "%s", g_sAwardAndScore)
#if defined STATSX_DEBUG #if defined STATSX_DEBUG
log_amx("Show %1.2fs round end HUD stats for #%d", fDuration, id) log_amx("Show %1.2fs round end HUD stats for #%d", fDuration, id)
#endif #endif
@ -1679,7 +1679,6 @@ public client_connect(id)
g_izKilled[id][KILLED_KILLER_STATSFIX] = 0 g_izKilled[id][KILLED_KILLER_STATSFIX] = 0
g_izShowStatsFlags[id] = 0 // Clear all flags g_izShowStatsFlags[id] = 0 // Clear all flags
g_fzShowUserStatsTime[id] = 0.0 g_fzShowUserStatsTime[id] = 0.0
g_LastChannel[id] = 0
return PLUGIN_CONTINUE return PLUGIN_CONTINUE
} }

View File

@ -946,9 +946,21 @@ native CreateHudSyncObj(num=0, ...);
* it proceeds to write another. It will only do this in the case * it proceeds to write another. It will only do this in the case
* of that channel not having been cleared already. * of that channel not having been cleared already.
* Target can be 0 for all players or 1-get_maxplayers(). * 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[], ...); 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 //no
native int3(); native int3();