Chat command handling

This commit is contained in:
mittorn 2018-07-29 16:43:58 +07:00
parent fb4635d0c5
commit fe3c7c3f6e
4 changed files with 21 additions and 4 deletions

View File

@ -523,6 +523,7 @@ void ClientCommand( edict_t *pEntity )
if ( FStrEq(pcmd, "say" ) ) if ( FStrEq(pcmd, "say" ) )
{ {
Host_Say( pEntity, 0 ); Host_Say( pEntity, 0 );
GGM_Say(pEntity);
} }
else if ( FStrEq(pcmd, "say_team" ) ) else if ( FStrEq(pcmd, "say_team" ) )
{ {

View File

@ -426,6 +426,24 @@ extern "C" const char *CMD_ARGV( int i )
return g_engfuncs.pfnCmd_Argv( i ); return g_engfuncs.pfnCmd_Argv( i );
} }
// client.cpp
void ClientCommand( edict_t *pEntity );
// Allow say /command as alias to command
void GGM_Say( edict_t *pEntity )
{
const char *args = CMD_ARGS();
if( !args || strlen( args ) < 2 )
return;
if( args[1] != '/' )
return;
GGM::Cmd_TokenizeString( args + 2 );
ClientCommand( pEntity );
GGM::Cmd_Reset();
}
GGM_PlayerMenu &GGM_PlayerMenu::Add(const char *name, const char *command) GGM_PlayerMenu &GGM_PlayerMenu::Add(const char *name, const char *command)
@ -491,9 +509,6 @@ void GGM_PlayerMenu::Show()
} }
} }
// client.cpp
void ClientCommand( edict_t *pEntity );
bool GGM_PlayerMenu::MenuSelect( int select ) bool GGM_PlayerMenu::MenuSelect( int select )
{ {
if( select > m_iCount || select < 1 ) if( select > m_iCount || select < 1 )

View File

@ -26,6 +26,7 @@ void GGM_ClientPutinServer(edict_t *pEntity , CBasePlayer *pPlayer);
void GGM_ClientFirstSpawn(CBasePlayer *pPlayer ); void GGM_ClientFirstSpawn(CBasePlayer *pPlayer );
const char *GGM_GetPlayerID( edict_t *player ); const char *GGM_GetPlayerID( edict_t *player );
edict_t *GGM_PlayerByID( const char *id ); edict_t *GGM_PlayerByID( const char *id );
void GGM_Say( edict_t *pEntity );
enum PlayerState enum PlayerState
{ {
STATE_UNINITIALIZED = 0, STATE_UNINITIALIZED = 0,

View File

@ -524,7 +524,7 @@ void CHalfLifeMultiplay::InitHUD( CBasePlayer *pl )
{ {
pl->gravgunmod_data.m_iMenuState = MENUSTATE_COOPMENU_SPEC; pl->gravgunmod_data.m_iMenuState = MENUSTATE_COOPMENU_SPEC;
if( mp_coop.value ) if( mp_coop.value && !pl->gravgunmod_data.m_fTouchMenu )
{ {
const char *menu[] = { const char *menu[] = {
"Join coop", "Join coop",