mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-03-13 05:51:19 +00:00
ggm_saytext feature for chat transports
This commit is contained in:
parent
c6947399ef
commit
1e1eac991d
@ -2075,6 +2075,8 @@ int ConnectionlessPacket( const struct netadr_s *net_from, const char *args, cha
|
||||
{
|
||||
// Parse stuff from args
|
||||
//int max_buffer_size = *response_buffer_size;
|
||||
if( GGM_ConnectionlessPacket( net_from, args, response_buffer, response_buffer_size ) )
|
||||
return 1;
|
||||
|
||||
// Zero it out since we aren't going to respond.
|
||||
// If we wanted to response, we'd write data into response_buffer
|
||||
|
@ -3062,6 +3062,36 @@ void GGM_Pause_f( void )
|
||||
g_fPause ^= true;
|
||||
}
|
||||
|
||||
extern int gmsgSayText;
|
||||
|
||||
void GGM_SayText( const char *line )
|
||||
{
|
||||
char text[254] = {};
|
||||
|
||||
snprintf( text, sizeof( text ), "%s\n", line );
|
||||
|
||||
MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
|
||||
WRITE_BYTE( ENTINDEX(0) );
|
||||
WRITE_STRING( text );
|
||||
MESSAGE_END();
|
||||
}
|
||||
|
||||
void GGM_SayText_f( void )
|
||||
{
|
||||
GGM_SayText(CMD_ARGS());
|
||||
}
|
||||
|
||||
int GGM_ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size )
|
||||
{
|
||||
if( !strncmp( args, "ggm_chat ", 9 ) )
|
||||
{
|
||||
GGM_SayText( args + 9 );
|
||||
*response_buffer_size = 0;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
GGM_RegisterCVars
|
||||
@ -3115,6 +3145,7 @@ void GGM_RegisterCVars( void )
|
||||
g_engfuncs.pfnAddServerCommand( "ggm_load", GGM_Load_f );
|
||||
g_engfuncs.pfnAddServerCommand( "ggm_votecommand", GGM_VoteCommand_f );
|
||||
g_engfuncs.pfnAddServerCommand( "ggm_pause", GGM_Pause_f );
|
||||
g_engfuncs.pfnAddServerCommand( "ggm_saytext", GGM_SayText_f );
|
||||
|
||||
zombietime = CVAR_GET_POINTER("zombietime");
|
||||
|
||||
|
@ -204,5 +204,7 @@ int GGM_ChangelevelVote( CBasePlayer *pPlayer, edict_t *pTrigger, const char *ps
|
||||
void GGM_ClearVote( void );
|
||||
void GGM_StartVoteCommand( CBasePlayer *pPlayer, const char *pszCommand, const char *pszMessage );
|
||||
void GGM_ConnectSaveBot( void );
|
||||
int GGM_ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size );
|
||||
|
||||
#endif // GRAVGUNMOD_H
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user