UTIL SayTextAll: Difference between revisions
Jump to navigation
Jump to search
m (Category) |
GamerDude27 (talk | contribs) m (Cleanup) |
||
Line 2: | Line 2: | ||
==Usage== | ==Usage== | ||
<source lang=cpp> | |||
void UTIL_SayTextAll( const char *pText, CBasePlayer *pPlayer, bool bChat ) | |||
</source> | |||
==Examples== | ==Examples== | ||
Tells everyone in chat that the server will restart in <code>sv_restart_server_delay</code> (not defined for concisement reasons) seconds. | Tells everyone in chat that the server will restart in <code>sv_restart_server_delay</code> (not defined for concisement reasons) seconds. | ||
<source lang=cpp> | |||
char *pszNotifyRestartText = ""; | |||
V_snprintf( pszNotifyRestartText, sizeof(pszNotifyRestartText), "This server will restart in %f seconds.", sv_restart_server_delay.GetFloat() ); | |||
UTIL_SayTextAll( pszNotifyRestartText, UTIL_GetCommandClientIndex(), true ); | |||
</source> | |||
A message that emits to all players' console output. | A message that emits to all players' console output. | ||
<source lang=cpp> | |||
UTIL_SayTextAll( "I'm a console message that is sent to everyone!", UTIL_GetCommandClient(), false ); | |||
</source> | |||
[[Category:UTIL]] | [[Category:UTIL]] |
Latest revision as of 13:29, 29 July 2021
A UTIL wrapper function for UTIL_SayTextFilter that sends a message to all players.
Usage
void UTIL_SayTextAll( const char *pText, CBasePlayer *pPlayer, bool bChat )
Examples
Tells everyone in chat that the server will restart in sv_restart_server_delay
(not defined for concisement reasons) seconds.
char *pszNotifyRestartText = "";
V_snprintf( pszNotifyRestartText, sizeof(pszNotifyRestartText), "This server will restart in %f seconds.", sv_restart_server_delay.GetFloat() );
UTIL_SayTextAll( pszNotifyRestartText, UTIL_GetCommandClientIndex(), true );
A message that emits to all players' console output.
UTIL_SayTextAll( "I'm a console message that is sent to everyone!", UTIL_GetCommandClient(), false );