Auto-bind F7 to show server console if it's free

This commit is contained in:
def 2020-09-05 23:15:14 +02:00
parent 2cdc7d0faf
commit 9a5ee2cdbf
3 changed files with 41 additions and 36 deletions

View file

@ -182,8 +182,7 @@ MACRO_CONFIG_INT(SvHit, sv_hit, 1, 0, 1, CFGFLAG_SERVER|CFGFLAG_GAME, "Whether p
MACRO_CONFIG_INT(SvEndlessDrag, sv_endless_drag, 0, 0, 1, CFGFLAG_SERVER|CFGFLAG_GAME, "Turns endless hooking on/off")
MACRO_CONFIG_INT(SvTestingCommands, sv_test_cmds, 0, 0, 1, CFGFLAG_SERVER, "Turns testing commands aka cheats on/off (setting only works in initial config)")
MACRO_CONFIG_INT(SvFreezeDelay, sv_freeze_delay, 3, 1, 30, CFGFLAG_SERVER|CFGFLAG_GAME, "How many seconds the players will remain frozen (applies to all except delayed freeze in switch layer & deepfreeze)")
MACRO_CONFIG_INT(ClDDRaceBinds, cl_race_binds, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Enable Default DDRace builds when pressing the reset binds button")
MACRO_CONFIG_INT(ClDDRaceBindsSet, cl_race_binds_set, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Whether the DDRace binds set or not (this is automated you don't need to use this)")
MACRO_CONFIG_INT(ClDDRaceBindsSet, cl_race_binds_set, 0, 0, 2, CFGFLAG_CLIENT|CFGFLAG_SAVE, "What level the DDRace binds are set to (this is automated, you don't need to use this)")
MACRO_CONFIG_INT(SvEndlessSuperHook, sv_endless_super_hook, 0, 0, 1, CFGFLAG_SERVER, "Endless hook for super players on/off")
MACRO_CONFIG_INT(SvHideScore, sv_hide_score, 0, 0, 1, CFGFLAG_SERVER, "Whether players scores will be announced or not")
MACRO_CONFIG_INT(SvSaveWorseScores, sv_save_worse_scores, 1, 0, 1, CFGFLAG_SERVER|CFGFLAG_GAME, "Whether to save worse scores when you already have a better one")

View file

@ -252,9 +252,8 @@ void CBinds::SetDefaults()
Bind(KEY_P, "say /pause");
// DDRace
if(g_Config.m_ClDDRaceBinds)
SetDDRaceBinds(false);
g_Config.m_ClDDRaceBindsSet = 0;
SetDDRaceBinds(false);
}
void CBinds::OnConsoleInit()
@ -447,34 +446,42 @@ void CBinds::ConfigSaveCallback(IConfig *pConfig, void *pUserData)
void CBinds::SetDDRaceBinds(bool FreeOnly)
{
Bind(KEY_KP_PLUS, "zoom+", FreeOnly);
Bind(KEY_KP_MINUS, "zoom-", FreeOnly);
Bind(KEY_KP_MULTIPLY, "zoom", FreeOnly);
Bind(KEY_PAUSE, "say /pause", FreeOnly);
Bind(KEY_UP, "+jump", FreeOnly);
Bind(KEY_LEFT, "+left", FreeOnly);
Bind(KEY_RIGHT, "+right", FreeOnly);
Bind(KEY_LEFTBRACKET, "+prevweapon", FreeOnly);
Bind(KEY_RIGHTBRACKET, "+nextweapon", FreeOnly);
Bind(KEY_C, "say /rank", FreeOnly);
Bind(KEY_V, "say /info", FreeOnly);
Bind(KEY_B, "say /top5", FreeOnly);
Bind(KEY_X, "emote 14", FreeOnly);
Bind(KEY_H, "emote 2", FreeOnly);
Bind(KEY_M, "emote 5", FreeOnly);
Bind(KEY_S, "+showhookcoll", FreeOnly);
Bind(KEY_X, "toggle cl_dummy 0 1", FreeOnly);
Bind(KEY_PAGEDOWN, "toggle cl_show_quads 0 1", FreeOnly);
Bind(KEY_PAGEUP, "toggle cl_overlay_entities 0 100", FreeOnly);
Bind(KEY_KP_0, "say /emote normal 999999", FreeOnly);
Bind(KEY_KP_1, "say /emote happy 999999", FreeOnly);
Bind(KEY_KP_2, "say /emote angry 999999", FreeOnly);
Bind(KEY_KP_3, "say /emote pain 999999", FreeOnly);
Bind(KEY_KP_4, "say /emote surprise 999999", FreeOnly);
Bind(KEY_KP_5, "say /emote blink 999999", FreeOnly);
Bind(KEY_MOUSE_3, "+spectate", FreeOnly);
Bind(KEY_MINUS, "spectate_previous", FreeOnly);
Bind(KEY_EQUALS, "spectate_next", FreeOnly);
if(g_Config.m_ClDDRaceBindsSet < 2)
{
Bind(KEY_F7, "toggle_server_console", FreeOnly);
}
g_Config.m_ClDDRaceBindsSet = 1;
if(g_Config.m_ClDDRaceBindsSet < 1)
{
Bind(KEY_KP_PLUS, "zoom+", FreeOnly);
Bind(KEY_KP_MINUS, "zoom-", FreeOnly);
Bind(KEY_KP_MULTIPLY, "zoom", FreeOnly);
Bind(KEY_PAUSE, "say /pause", FreeOnly);
Bind(KEY_UP, "+jump", FreeOnly);
Bind(KEY_LEFT, "+left", FreeOnly);
Bind(KEY_RIGHT, "+right", FreeOnly);
Bind(KEY_LEFTBRACKET, "+prevweapon", FreeOnly);
Bind(KEY_RIGHTBRACKET, "+nextweapon", FreeOnly);
Bind(KEY_C, "say /rank", FreeOnly);
Bind(KEY_V, "say /info", FreeOnly);
Bind(KEY_B, "say /top5", FreeOnly);
Bind(KEY_X, "emote 14", FreeOnly);
Bind(KEY_H, "emote 2", FreeOnly);
Bind(KEY_M, "emote 5", FreeOnly);
Bind(KEY_S, "+showhookcoll", FreeOnly);
Bind(KEY_X, "toggle cl_dummy 0 1", FreeOnly);
Bind(KEY_PAGEDOWN, "toggle cl_show_quads 0 1", FreeOnly);
Bind(KEY_PAGEUP, "toggle cl_overlay_entities 0 100", FreeOnly);
Bind(KEY_KP_0, "say /emote normal 999999", FreeOnly);
Bind(KEY_KP_1, "say /emote happy 999999", FreeOnly);
Bind(KEY_KP_2, "say /emote angry 999999", FreeOnly);
Bind(KEY_KP_3, "say /emote pain 999999", FreeOnly);
Bind(KEY_KP_4, "say /emote surprise 999999", FreeOnly);
Bind(KEY_KP_5, "say /emote blink 999999", FreeOnly);
Bind(KEY_MOUSE_3, "+spectate", FreeOnly);
Bind(KEY_MINUS, "spectate_previous", FreeOnly);
Bind(KEY_EQUALS, "spectate_next", FreeOnly);
}
g_Config.m_ClDDRaceBindsSet = 2;
}

View file

@ -332,8 +332,7 @@ void CGameClient::OnInit()
m_ShowOthers[1] = -1;
// Set free binds to DDRace binds if it's active
if(!g_Config.m_ClDDRaceBindsSet && g_Config.m_ClDDRaceBinds)
gs_Binds.SetDDRaceBinds(true);
gs_Binds.SetDDRaceBinds(true);
if(g_Config.m_ClTimeoutCode[0] == '\0' || str_comp(g_Config.m_ClTimeoutCode, "hGuEYnfxicsXGwFq") == 0)
{