-
Notifications
You must be signed in to change notification settings - Fork 176
feat(comms): provide custom reason #615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rumblefrog
wants to merge
1
commit into
v1.x
Choose a base branch
from
comms-own-reason
base: v1.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,6 +133,13 @@ enum PeskyPanels | |
int g_iPeskyPanels[MAXPLAYERS + 1][PeskyPanels]; | ||
|
||
bool g_bPlayerStatus[MAXPLAYERS + 1]; // Player block check status | ||
|
||
// Own Reason Section | ||
bool g_bOwnReason[MAXPLAYERS + 1] = { false, ... }; | ||
int g_iTarget[MAXPLAYERS + 1] = { -1, ... }; | ||
int g_iLength[MAXPLAYERS + 1]; | ||
int g_iType[MAXPLAYERS + 1]; | ||
|
||
char g_sName[MAXPLAYERS + 1][MAX_NAME_LENGTH]; | ||
|
||
bType g_MuteType[MAXPLAYERS + 1]; | ||
|
@@ -192,12 +199,17 @@ public void OnPluginStart() | |
g_hServersWhiteList = new ArrayList(); | ||
|
||
CreateConVar("sourcecomms_version", PLUGIN_VERSION, _, FCVAR_SPONLY | FCVAR_REPLICATED | FCVAR_NOTIFY); | ||
|
||
AddCommandListener(CommandCallback, "sm_gag"); | ||
AddCommandListener(CommandCallback, "sm_mute"); | ||
AddCommandListener(CommandCallback, "sm_silence"); | ||
AddCommandListener(CommandCallback, "sm_ungag"); | ||
AddCommandListener(CommandCallback, "sm_unmute"); | ||
AddCommandListener(CommandCallback, "sm_unsilence"); | ||
|
||
AddCommandListener(ReasonHook, "say"); | ||
AddCommandListener(ReasonHook, "say_team"); | ||
|
||
RegServerCmd("sc_fw_block", FWBlock, "Blocking player comms by command from sourceban web site"); | ||
RegServerCmd("sc_fw_ungag", FWUngag, "Ungagging player by command from sourceban web site"); | ||
RegServerCmd("sc_fw_unmute", FWUnmute, "Unmuting player by command from sourceban web site"); | ||
|
@@ -262,6 +274,8 @@ public void OnClientDisconnect(int client) | |
|
||
CloseMuteExpireTimer(client); | ||
CloseGagExpireTimer(client); | ||
|
||
g_bOwnReason[client] = false; | ||
} | ||
|
||
public bool OnClientConnect(int client, char[] rejectmsg, int maxlen) | ||
|
@@ -680,7 +694,10 @@ public int Handle_MenuList(TopMenu menu, TopMenuAction action, TopMenuObject obj | |
|
||
void AdminMenu_Target(int client, int type) | ||
{ | ||
g_bOwnReason[client] = false; | ||
|
||
char Title[192], Option[32]; | ||
|
||
switch (type) | ||
{ | ||
case TYPE_GAG: | ||
|
@@ -914,6 +931,7 @@ public int MenuHandler_MenuReason(Menu menu, MenuAction action, int param1, int | |
int reasonIndex = StringToInt(sTemp[2]); | ||
int lengthIndex = StringToInt(sTemp[3]); | ||
int length; | ||
|
||
if (lengthIndex >= 0 && lengthIndex <= iNumTimes) | ||
length = g_iTimeMinutes[lengthIndex]; | ||
else | ||
|
@@ -922,12 +940,49 @@ public int MenuHandler_MenuReason(Menu menu, MenuAction action, int param1, int | |
LogError("Wrong length index in menu - using default time"); | ||
} | ||
|
||
if (StrEqual(g_sReasonKey[reasonIndex], "Other")) | ||
{ | ||
g_bOwnReason[param1] = true; | ||
g_iTarget[param1] = target; | ||
g_iLength[param1] = length; | ||
g_iType[param1] = type; | ||
|
||
PrintToChat(param1, "%s%t", PREFIX, "Chat Reason"); | ||
|
||
return; | ||
} | ||
|
||
CreateBlock(param1, target, length, type, g_sReasonKey[reasonIndex]); | ||
} | ||
} | ||
} | ||
} | ||
|
||
public Action ReasonHook(int iClient, const char[] sCommand, int iArgC) | ||
{ | ||
if (g_bOwnReason[iClient]) | ||
{ | ||
g_bOwnReason[iClient] = false; | ||
|
||
char sReason[512]; | ||
|
||
GetCmdArgString(sReason, sizeof sReason); | ||
|
||
if (StrEqual(sReason, "!noreason")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On TF2, result of execution |
||
{ | ||
PrintToChat(iClient, "%s%t", PREFIX, "Chat Reason Aborted"); | ||
|
||
return Plugin_Handled; | ||
} | ||
|
||
CreateBlock(iClient, g_iTarget[iClient], g_iLength[iClient], g_iType[iClient], sReason); | ||
|
||
return Plugin_Handled; | ||
} | ||
|
||
return Plugin_Continue; | ||
} | ||
|
||
void AdminMenu_List(int client, int index) | ||
{ | ||
char sTitle[192], sOption[32]; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://sm.alliedmods.net/new-api/console/OnClientSayCommand
Absolute identically forward. Calls when client use
say
orsay_team
.