From: Lyberta Date: Thu, 23 Mar 2017 05:04:38 +0000 (+0300) Subject: Added more useful PrintToChat functions. X-Git-Tag: xonotic-v0.8.5~2842^2~3 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3699a2f4d18803b8909e43e1fe21dceb9cda8223;p=xonotic%2Fxonotic-data.pk3dir.git Added more useful PrintToChat functions. --- diff --git a/qcsrc/server/player.qc b/qcsrc/server/player.qc index 091b97862..c0460aedc 100644 --- a/qcsrc/server/player.qc +++ b/qcsrc/server/player.qc @@ -692,6 +692,23 @@ void DebugPrintToChat(entity player, string text) } } +void PrintToChatAll(string text) +{ + text = strcat("\{1}^7", text, "\n"); + FOREACH_CLIENT(IS_REAL_CLIENT(it), + { + sprint(it, text); + }); +} + +void DebugPrintToChatAll(string text) +{ + if (autocvar_developer) + { + PrintToChatAll(text); + } +} + /** * message "": do not say, just test flood control * return value: diff --git a/qcsrc/server/player.qh b/qcsrc/server/player.qh index 40812a765..08702316d 100644 --- a/qcsrc/server/player.qh +++ b/qcsrc/server/player.qh @@ -24,6 +24,17 @@ void PrintToChat(entity player, string text); /// \return No return. void DebugPrintToChat(entity player, string text); +/// \brief Prints the string to all players' chat. +/// \param[in] text Text to print. +/// \return No return. +void PrintToChatAll(string text); + +/// \brief Prints the string to all players' chat if the server cvar "developer" +/// is not 0. +/// \param[in] text Text to print. +/// \return No return. +void DebugPrintToChatAll(string text); + void player_setupanimsformodel(entity this); void player_anim(entity this);