support for admin chat from stoat
This commit is contained in:
parent
2e99fec5de
commit
3dc480d564
@ -669,6 +669,12 @@ public Action OnClientSayCommand(int client, const char[] sCommand, const char[]
|
|||||||
else
|
else
|
||||||
Discord_POST(DISCORD_ADMINCHAT_WEBHOOKURL, sFinal, true, sUsername);
|
Discord_POST(DISCORD_ADMINCHAT_WEBHOOKURL, sFinal, true, sUsername);
|
||||||
|
|
||||||
|
Call_StartForward(g_hForwardDiscord);
|
||||||
|
Call_PushString(sUsername);
|
||||||
|
Call_PushString(sFinal);
|
||||||
|
Call_PushCell(6);
|
||||||
|
Call_Finish();
|
||||||
|
|
||||||
if (!bAdmin)
|
if (!bAdmin)
|
||||||
{
|
{
|
||||||
//g_iReplyTargetSerial = GetClientSerial(client);
|
//g_iReplyTargetSerial = GetClientSerial(client);
|
||||||
|
|||||||
@ -21,8 +21,9 @@ public Plugin myinfo =
|
|||||||
public void OnPluginStart()
|
public void OnPluginStart()
|
||||||
{
|
{
|
||||||
AddCommandListener(CommandListener_SmChat_stoat, "say");
|
AddCommandListener(CommandListener_SmChat_stoat, "say");
|
||||||
AddCommandListener(CommandListener_SmChat_stoat, "say_team");
|
|
||||||
RegServerCmd("sm_printtoallchat_stoat", Command_PrintToAllChat_stoat, "Discord Integration");
|
RegServerCmd("sm_printtoallchat_stoat", Command_PrintToAllChat_stoat, "Stoat Integration");
|
||||||
|
RegServerCmd("sm_printtoadminchat_stoat", Command_PrintToAdminChat_stoat, "Stoat Integration");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action CommandListener_SmChat_stoat(int client, const char[] sCommand, int argc)
|
public Action CommandListener_SmChat_stoat(int client, const char[] sCommand, int argc)
|
||||||
@ -95,6 +96,26 @@ public Action Command_PrintToAllChat_stoat(int args)
|
|||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Action Command_PrintToAdminChat_stoat(int args)
|
||||||
|
{
|
||||||
|
char sArgs[1024];
|
||||||
|
char sArgs2[1024];
|
||||||
|
|
||||||
|
GetCmdArg(1, sArgs, sizeof(sArgs));
|
||||||
|
GetCmdArg(2, sArgs2, sizeof(sArgs2));
|
||||||
|
|
||||||
|
for(int i = 0; i < MAXPLAYERS; i++)
|
||||||
|
{
|
||||||
|
if (IsValidClient(i))
|
||||||
|
{
|
||||||
|
bool bAdmin = CheckCommandAccess(i, "", ADMFLAG_GENERIC, true);
|
||||||
|
if (bAdmin)
|
||||||
|
CPrintToChat(i, "{green}(Stoat ADMINS) %s: {yellow}%s", sArgs, sArgs2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
public void GetDiscordToStoat(const char[] username, const char[] message, int type)
|
public void GetDiscordToStoat(const char[] username, const char[] message, int type)
|
||||||
{
|
{
|
||||||
//type = 1. ADMINLOGS
|
//type = 1. ADMINLOGS
|
||||||
@ -102,6 +123,7 @@ public void GetDiscordToStoat(const char[] username, const char[] message, int t
|
|||||||
//type = 3. AMDIN LOGS entwatch
|
//type = 3. AMDIN LOGS entwatch
|
||||||
//type = 4. admin logs ze ban evasion
|
//type = 4. admin logs ze ban evasion
|
||||||
//type = 5. Calladmin
|
//type = 5. Calladmin
|
||||||
|
//type = 6. admin chat ze
|
||||||
if (type == 1)
|
if (type == 1)
|
||||||
{
|
{
|
||||||
SendToStoat(username, message, "");
|
SendToStoat(username, message, "");
|
||||||
@ -122,4 +144,13 @@ public void GetDiscordToStoat(const char[] username, const char[] message, int t
|
|||||||
{
|
{
|
||||||
SendToStoat(username, message, "");
|
SendToStoat(username, message, "");
|
||||||
}
|
}
|
||||||
|
else if(type == 6)
|
||||||
|
{
|
||||||
|
SendToStoat(username, message, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stock bool IsValidClient(int client)
|
||||||
|
{
|
||||||
|
return (client > 0 && client <= MaxClients && IsClientInGame(client));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user