diff --git a/addons/sourcemod/scripting/ff2r_epic_abilities.sp b/addons/sourcemod/scripting/ff2r_epic_abilities.sp index 40c4f9e..5a90462 100644 --- a/addons/sourcemod/scripting/ff2r_epic_abilities.sp +++ b/addons/sourcemod/scripting/ff2r_epic_abilities.sp @@ -211,6 +211,7 @@ ConVar CvarMaxUnlag; bool HookedWeaponSwap[MAXTF2PLAYERS]; int HasAbility[MAXTF2PLAYERS]; +bool PressedInspectKey[MAXTF2PLAYERS]; Handle TimescaleTimer; float DodgeFor[MAXTF2PLAYERS]; @@ -559,6 +560,7 @@ public void FF2R_OnBossRemoved(int client) WallLagComped[client] = false; ClassSwap[client] = TFClass_Unknown; StealNext[client] = 0; + PressedInspectKey[client] = false; if(DodgeFor[client]) DodgeFor[client] = 1.0; @@ -811,6 +813,22 @@ public void OnClientDisconnect(int client) WeapRef[client] = INVALID_ENT_REFERENCE; } +public Action OnClientCommandKeyValues(int client, KeyValues kv) { + if (!HasAbility[client] || !IsPlayerAlive(client)) { + return Plugin_Continue; + } + + char command[64]; + kv.GetSectionName(command, sizeof(command)); + if (strcmp(command, "+inspect_server") == 0) { + PressedInspectKey[client] = true; + } else if (strcmp(command, "-inspect_server") == 0) { + PressedInspectKey[client] = false; + } + + return Plugin_Continue; +} + public Action OnPlayerRunCmd(int client, int &buttons) { if(DodgeFor[client]) @@ -962,19 +980,19 @@ public void OnPlayerRunCmdPost(int client, int buttons) { if(!hud) { - static bool wasDucking[MAXTF2PLAYERS]; - if(buttons & IN_DUCK) + static bool wasInspect[MAXTF2PLAYERS]; + if(PressedInspectKey[client]) { - if(!wasDucking[client]) + if(!wasInspect[client]) { hud = true; - wasDucking[client] = true; + wasInspect[client] = true; } } - else if(!wasDucking[client]) + else if(!wasInspect[client]) { hud = true; - wasDucking[client] = false; + wasInspect[client] = false; } } @@ -1013,7 +1031,7 @@ public void OnPlayerRunCmdPost(int client, int buttons) if(val.tag == KeyValType_Section && val.cfg) { ConfigData cfg = view_as(val.cfg); - if(!(buttons & IN_DUCK) || !GetBossNameCfg(cfg, val.data, sizeof(val.data), lang, "desc")) + if(!PressedInspectKey[client] || !GetBossNameCfg(cfg, val.data, sizeof(val.data), lang, "desc")) { if(!GetBossNameCfg(cfg, val.data, sizeof(val.data), lang)) strcopy(val.data, sizeof(val.data), key); @@ -1021,7 +1039,7 @@ public void OnPlayerRunCmdPost(int client, int buttons) bool blocked = true; - if(buttons & IN_DUCK) + if(PressedInspectKey[client]) { switch(button[i]) { @@ -1139,7 +1157,7 @@ public void OnPlayerRunCmdPost(int client, int buttons) if(val.tag == KeyValType_Section && val.cfg) { ConfigData cfg = view_as(val.cfg); - if(!(buttons & IN_DUCK) || !GetBossNameCfg(cfg, val.data, sizeof(val.data), lang, "desc")) + if(!PressedInspectKey[client] || !GetBossNameCfg(cfg, val.data, sizeof(val.data), lang, "desc")) { if(!GetBossNameCfg(cfg, val.data, sizeof(val.data), lang)) strcopy(val.data, sizeof(val.data), key); @@ -1148,7 +1166,7 @@ public void OnPlayerRunCmdPost(int client, int buttons) GetButtons(ability, true, count, button); bool blocked = true; - if((buttons & IN_DUCK) && count) + if((PressedInspectKey[client]) && count) { switch(button[0]) {