Sign in to follow this  
BRCaineMan

[Cerere] Plugins mesaje,ban,mute,etc

5 posts in this topic

Numele Pluginului :vreau plugin-ul care sa arata cand dai gag, etc sa scrie un mesaj exemplu: !gag numele a primit gag pentru ca .... pentru atatea minute


Modul:-


Descriere:Il vreau configurat.


Share this post


Link to post
Share on other sites

Poftim:

 

[CSGO] Gag,Mute with time

 

 

**
* vim: set ts=4 :
* =============================================================================
* SourceMod Basecomm
* Part of Basecomm plugin, menu and other functionality.
*
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or .
*
* Version: $Id$
*/

enum CommType
{
CommType_Mute,
CommType_UnMute,
CommType_Gag,
CommType_UnGag,
CommType_Silence,
CommType_UnSilence
};

void DisplayGagTypesMenu(int client)
{
Menu menu = new Menu(MenuHandler_GagTypes);

char title[100];
Format(title, sizeof(title), "%T: %N", "Choose Type", client, g_GagTarget[client]);
menu.SetTitle(title);
menu.ExitBackButton = true;

int target = g_GagTarget[client];

if (!g_Muted[target])
{
AddTranslatedMenuItem(menu, "0", "Mute Player", client);
}
else
{
AddTranslatedMenuItem(menu, "1", "UnMute Player", client);
}

if (!g_Gagged[target])
{
AddTranslatedMenuItem(menu, "2", "Gag Player", client);
}
else
{
AddTranslatedMenuItem(menu, "3", "UnGag Player", client);
}

if (!g_Muted[target] || !g_Gagged[target])
{
AddTranslatedMenuItem(menu, "4", "Silence Player", client);
}
else
{
AddTranslatedMenuItem(menu, "5", "UnSilence Player", client);
}

menu.Display(client, MENU_TIME_FOREVER);
}

void AddTranslatedMenuItem(Menu menu, const char[] opt, const char[] phrase, int client)
{
char buffer[128];
Format(buffer, sizeof(buffer), "%T", phrase, client);
menu.AddItem(opt, buffer);
}

void DisplayGagPlayerMenu(int client)
{
Menu menu = new Menu(MenuHandler_GagPlayer);

char title[100];
Format(title, sizeof(title), "%T:", "Gag/Mute player", client);
menu.SetTitle(title);
menu.ExitBackButton = true;

AddTargetsToMenu(menu, client, true, false);

menu.Display(client, MENU_TIME_FOREVER);
}

public void AdminMenu_Gag(TopMenu topmenu,
TopMenuAction action,
TopMenuObject object_id,
int param,
char[] buffer,
int maxlength)
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "Gag/Mute player", param);
}
else if (action == TopMenuAction_SelectOption)
{
DisplayGagPlayerMenu(param);
}
}

public int MenuHandler_GagPlayer(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
delete menu;
}
else if (action == MenuAction_Cancel)
{
if (param2 == MenuCancel_ExitBack && hTopMenu)
{
hTopMenu.Display(param1, TopMenuPosition_LastCategory);
}
}
else if (action == MenuAction_Select)
{
char info[32];
int userid, target;

menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);

if ((target = GetClientOfUserId(userid)) == 0)
{
PrintToChat(param1, "[SM] %t", "Player no longer available");
}
else if (!CanUserTarget(param1, target))
{
PrintToChat(param1, "[SM] %t", "Unable to target");
}
else
{
g_GagTarget[param1] = GetClientOfUserId(userid);
DisplayGagTypesMenu(param1);
}
}
}

public int MenuHandler_GagTypes(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
delete menu;
}
else if (action == MenuAction_Cancel)
{
if (param2 == MenuCancel_ExitBack && hTopMenu)
{
hTopMenu.Display(param1, TopMenuPosition_LastCategory);
}
}
else if (action == MenuAction_Select)
{
char info[32];
CommType type;

menu.GetItem(param2, info, sizeof(info));
type = view_as(StringToInt(info));

char name[MAX_NAME_LENGTH];
GetClientName(g_GagTarget[param1], name, sizeof(name));

switch (type)
{
case CommType_Mute:
{
PerformMute(param1, g_GagTarget[param1]);
ShowActivity2(param1, "[SM] ", "%t", "Muted target", "_s", name);
}
case CommType_UnMute:
{
PerformUnMute(param1, g_GagTarget[param1]);
ShowActivity2(param1, "[SM] ", "%t", "Unmuted target", "_s", name);
}
case CommType_Gag:
{
PerformGag(param1, g_GagTarget[param1]);
ShowActivity2(param1, "[SM] ", "%t", "Gagged target", "_s", name);
}
case CommType_UnGag:
{
PerformUnGag(param1, g_GagTarget[param1]);
ShowActivity2(param1, "[SM] ", "%t", "Ungagged target", "_s", name);
}
case CommType_Silence:
{
PerformSilence(param1, g_GagTarget[param1]);
ShowActivity2(param1, "[SM] ", "%t", "Silenced target", "_s", name);
}
case CommType_UnSilence:
{
PerformUnSilence(param1, g_GagTarget[param1]);
ShowActivity2(param1, "[SM] ", "%t", "Unsilenced target", "_s", name);
}
}
}
}

void PerformMute(int client, int target, bool silent=false)
{
g_Muted[target] = true;
SetClientListeningFlags(target, VOICE_MUTED);

FireOnClientMute(target, true);

if (!silent)
{
LogAction(client, target, "\"%L\" muted \"%L\"", client, target);
}
}

void PerformUnMute(int client, int target, bool silent=false)
{
g_Muted[target] = false;
if (g_Cvar_Deadtalk.IntValue == 1 && !IsPlayerAlive(target))
{
SetClientListeningFlags(target, VOICE_LISTENALL);
}
else if (g_Cvar_Deadtalk.IntValue == 2 && !IsPlayerAlive(target))
{
SetClientListeningFlags(target, VOICE_TEAM);
}
else
{
SetClientListeningFlags(target, VOICE_NORMAL);
}

FireOnClientMute(target, false);

if (!silent)
{
LogAction(client, target, "\"%L\" unmuted \"%L\"", client, target);
}
}

void PerformGag(int client, int target, bool silent=false)
{
g_Gagged[target] = true;
FireOnClientGag(target, true);

if (!silent)
{
LogAction(client, target, "\"%L\" gagged \"%L\"", client, target);
}
}

void PerformUnGag(int client, int target, bool silent=false)
{
g_Gagged[target] = false;
FireOnClientGag(target, false);

if (!silent)
{
LogAction(client, target, "\"%L\" ungagged \"%L\"", client, target);
}
}

void PerformSilence(int client, int target)
{
if (!g_Gagged[target])
{
g_Gagged[target] = true;
FireOnClientGag(target, true);
}

if (!g_Muted[target])
{
g_Muted[target] = true;
SetClientListeningFlags(target, VOICE_MUTED);
FireOnClientMute(target, true);
}

LogAction(client, target, "\"%L\" silenced \"%L\"", client, target);
}

void PerformUnSilence(int client, int target)
{
if (g_Gagged[target])
{
g_Gagged[target] = false;
FireOnClientGag(target, false);
}

if (g_Muted[target])
{
g_Muted[target] = false;

if (g_Cvar_Deadtalk.IntValue == 1 && !IsPlayerAlive(target))
{
SetClientListeningFlags(target, VOICE_LISTENALL);
}
else if (g_Cvar_Deadtalk.IntValue == 2 && !IsPlayerAlive(target))
{
SetClientListeningFlags(target, VOICE_TEAM);
}
else
{
SetClientListeningFlags(target, VOICE_NORMAL);
}
FireOnClientMute(target, false);
}

LogAction(client, target, "\"%L\" unsilenced \"%L\"", client, target);
}

public Action Command_Mute(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "★ \x04[HNS] \x01Usage: \x07sm_mute \x02 \x01[reason]");
return Plugin_Handled;
}

char Arguments[256];
GetCmdArgString(Arguments, sizeof(Arguments));

char ArgumentsT[256];
GetCmdArgString(ArgumentsT, sizeof(ArgumentsT));

char arg[64];
GetCmdArg(1, arg, sizeof(arg));
int len = BreakString(Arguments, arg, sizeof(arg));

if (len == -1)
{
/* Safely null terminate */
len = 0;
Arguments[0] = '\0';
}

int lenT = BreakString(ArgumentsT, arg, sizeof(arg));

if (lenT == -1)
{
/* Safely null terminate */
lenT = 0;
ArgumentsT[0] = '\0';
}

char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;

if ((target_count = ProcessTargetString(
arg,
client,
target_list,
MAXPLAYERS,
0,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}

for (int i = 0; i < target_count; i++)
{
int target = target_list[i];
PerformMute(client, target);
}

char reason[64];
Format(reason, sizeof(reason), Arguments[len]);

char time[64];
Format(time, sizeof(time), ArgumentsT[len]);

if (tn_is_ml)
{
if (reason[0] == '\0')
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01muted \x02%t \x01with \x07reason : no reason", client, target_name);
}
else
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01muted \x02%t \x01with \x07reason : \x02%s", client, target_name, reason);
}
}
else
{
if (reason[0] == '\0')
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01muted \x02%s \x01with \x07reason : no reason", client, target_name);
}
else
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01muted \x02%s \x01with \x07reason : \x02%s", client, target_name, reason);
}
}

return Plugin_Handled;
}

public Action Command_Gag(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "★ \x04[HNS] \x01Usage: \x07sm_gag \x02 \x01[reason]");
return Plugin_Handled;
}

char Arguments[256];
GetCmdArgString(Arguments, sizeof(Arguments));

char arg[64];
GetCmdArg(1, arg, sizeof(arg));
int len = BreakString(Arguments, arg, sizeof(arg));

if (len == -1)
{
/* Safely null terminate */
len = 0;
Arguments[0] = '\0';
}

char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;

if ((target_count = ProcessTargetString(
arg,
client,
target_list,
MAXPLAYERS,
0,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}

for (int i = 0; i < target_count; i++)
{
int target = target_list[i];

PerformGag(client, target);
}

char reason[64];
Format(reason, sizeof(reason), Arguments[len]);

if (tn_is_ml)
{
if (reason[0] == '\0')
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01gagged \x02%t \x01with \x07reason : no reason", client, target_name);
}
else
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01gagged \x02%t \x01with \x07reason : \x02%s", client, target_name, reason);
}
}
else
{
if (reason[0] == '\0')
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01gagged \x02%s \x01with \x07reason : no reason", client, target_name);
}
else
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01gagged \x02%s \x01with \x07reason : \x02%s", client, target_name, reason);
}
}

return Plugin_Handled;
}

public Action Command_Silence(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "★ \x04[HNS] \x01Usage: \x07sm_silence \x02 \x01[reason]");
return Plugin_Handled;
}

char Arguments[256];
GetCmdArgString(Arguments, sizeof(Arguments));

char arg[64];
GetCmdArg(1, arg, sizeof(arg));
int len = BreakString(Arguments, arg, sizeof(arg));

if (len == -1)
{
/* Safely null terminate */
len = 0;
Arguments[0] = '\0';
}

char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;

if ((target_count = ProcessTargetString(
arg,
client,
target_list,
MAXPLAYERS,
0,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}

for (int i = 0; i < target_count; i++)
{
int target = target_list[i];

PerformSilence(client, target);
}

char reason[64];
Format(reason, sizeof(reason), Arguments[len]);

if (tn_is_ml)
{
if (reason[0] == '\0')
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01silenced \x02%t \x01with \x07reason : no reason", client, target_name);
}
else
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01silenced \x02%t \x01with \x07reason : \x02%s", client, target_name, reason);
}
}
else
{
if (reason[0] == '\0')
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01silenced \x02%s \x01with \x07reason : no reason", client, target_name);
}
else
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01silenced \x02%s \x01with \x07reason : \x02%s", client, target_name, reason);
}
}

return Plugin_Handled;
}

public Action Command_Unmute(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "★ \x04[HNS] \x01Usage: \x07sm_unmute \x02 \x01[reason]");
return Plugin_Handled;
}

char arg[64];
GetCmdArg(1, arg, sizeof(arg));

char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;

if ((target_count = ProcessTargetString(
arg,
client,
target_list,
MAXPLAYERS,
0,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}

for (int i = 0; i < target_count; i++)
{
int target = target_list[i];

if (!g_Muted[target])
{
continue;
}

PerformUnMute(client, target);
}

if (tn_is_ml)
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01unmuted \x02%t", client, target_name);
}
else
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01unmuted \x02%s", client, target_name);
}

return Plugin_Handled;
}

public Action Command_Ungag(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "★ \x04[HNS] \x01Usage: \x07sm_ungag \x02 \x01[reason]");
return Plugin_Handled;
}

char arg[64];
GetCmdArg(1, arg, sizeof(arg));

char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;

if ((target_count = ProcessTargetString(
arg,
client,
target_list,
MAXPLAYERS,
0,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}

for (int i = 0; i < target_count; i++)
{
int target = target_list[i];

PerformUnGag(client, target);
}

if (tn_is_ml)
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01ungagged \x02%t", client, target_name);
}
else
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01ungagged \x02%s", client, target_name);
}

return Plugin_Handled;
}

public Action Command_Unsilence(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "★ \x04[HNS] \x01Usage: \x07sm_unsilence \x02");
return Plugin_Handled;
}

char arg[64];
GetCmdArg(1, arg, sizeof(arg));

char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;

if ((target_count = ProcessTargetString(
arg,
client,
target_list,
MAXPLAYERS,
0,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}

for (int i = 0; i < target_count; i++)
{
int target = target_list[i];

PerformUnSilence(client, target);
}

if (tn_is_ml)
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01unsilenced \x02%t", client, target_name);
}
else
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01unsilenced \x02%s", client, target_name);
}

return Plugin_Handled;
}
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod Basecomm
* Part of Basecomm plugin, menu and other functionality.
*
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or .
*
* Version: $Id$
*/

enum CommType
{
CommType_Mute,
CommType_UnMute,
CommType_Gag,
CommType_UnGag,
CommType_Silence,
CommType_UnSilence
};

void DisplayGagTypesMenu(int client)
{
Menu menu = new Menu(MenuHandler_GagTypes);

char title[100];
Format(title, sizeof(title), "%T: %N", "Choose Type", client, g_GagTarget[client]);
menu.SetTitle(title);
menu.ExitBackButton = true;

int target = g_GagTarget[client];

if (!g_Muted[target])
{
AddTranslatedMenuItem(menu, "0", "Mute Player", client);
}
else
{
AddTranslatedMenuItem(menu, "1", "UnMute Player", client);
}

if (!g_Gagged[target])
{
AddTranslatedMenuItem(menu, "2", "Gag Player", client);
}
else
{
AddTranslatedMenuItem(menu, "3", "UnGag Player", client);
}

if (!g_Muted[target] || !g_Gagged[target])
{
AddTranslatedMenuItem(menu, "4", "Silence Player", client);
}
else
{
AddTranslatedMenuItem(menu, "5", "UnSilence Player", client);
}

menu.Display(client, MENU_TIME_FOREVER);
}

void AddTranslatedMenuItem(Menu menu, const char[] opt, const char[] phrase, int client)
{
char buffer[128];
Format(buffer, sizeof(buffer), "%T", phrase, client);
menu.AddItem(opt, buffer);
}

void DisplayGagPlayerMenu(int client)
{
Menu menu = new Menu(MenuHandler_GagPlayer);

char title[100];
Format(title, sizeof(title), "%T:", "Gag/Mute player", client);
menu.SetTitle(title);
menu.ExitBackButton = true;

AddTargetsToMenu(menu, client, true, false);

menu.Display(client, MENU_TIME_FOREVER);
}

public void AdminMenu_Gag(TopMenu topmenu,
TopMenuAction action,
TopMenuObject object_id,
int param,
char[] buffer,
int maxlength)
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "Gag/Mute player", param);
}
else if (action == TopMenuAction_SelectOption)
{
DisplayGagPlayerMenu(param);
}
}

public int MenuHandler_GagPlayer(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
delete menu;
}
else if (action == MenuAction_Cancel)
{
if (param2 == MenuCancel_ExitBack && hTopMenu)
{
hTopMenu.Display(param1, TopMenuPosition_LastCategory);
}
}
else if (action == MenuAction_Select)
{
char info[32];
int userid, target;

menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);

if ((target = GetClientOfUserId(userid)) == 0)
{
PrintToChat(param1, "[SM] %t", "Player no longer available");
}
else if (!CanUserTarget(param1, target))
{
PrintToChat(param1, "[SM] %t", "Unable to target");
}
else
{
g_GagTarget[param1] = GetClientOfUserId(userid);
DisplayGagTypesMenu(param1);
}
}
}

public int MenuHandler_GagTypes(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
delete menu;
}
else if (action == MenuAction_Cancel)
{
if (param2 == MenuCancel_ExitBack && hTopMenu)
{
hTopMenu.Display(param1, TopMenuPosition_LastCategory);
}
}
else if (action == MenuAction_Select)
{
char info[32];
CommType type;

menu.GetItem(param2, info, sizeof(info));
type = view_as(StringToInt(info));

char name[MAX_NAME_LENGTH];
GetClientName(g_GagTarget[param1], name, sizeof(name));

switch (type)
{
case CommType_Mute:
{
PerformMute(param1, g_GagTarget[param1]);
ShowActivity2(param1, "[SM] ", "%t", "Muted target", "_s", name);
}
case CommType_UnMute:
{
PerformUnMute(param1, g_GagTarget[param1]);
ShowActivity2(param1, "[SM] ", "%t", "Unmuted target", "_s", name);
}
case CommType_Gag:
{
PerformGag(param1, g_GagTarget[param1]);
ShowActivity2(param1, "[SM] ", "%t", "Gagged target", "_s", name);
}
case CommType_UnGag:
{
PerformUnGag(param1, g_GagTarget[param1]);
ShowActivity2(param1, "[SM] ", "%t", "Ungagged target", "_s", name);
}
case CommType_Silence:
{
PerformSilence(param1, g_GagTarget[param1]);
ShowActivity2(param1, "[SM] ", "%t", "Silenced target", "_s", name);
}
case CommType_UnSilence:
{
PerformUnSilence(param1, g_GagTarget[param1]);
ShowActivity2(param1, "[SM] ", "%t", "Unsilenced target", "_s", name);
}
}
}
}

void PerformMute(int client, int target, bool silent=false)
{
g_Muted[target] = true;
SetClientListeningFlags(target, VOICE_MUTED);

FireOnClientMute(target, true);

if (!silent)
{
LogAction(client, target, "\"%L\" muted \"%L\"", client, target);
}
}

void PerformUnMute(int client, int target, bool silent=false)
{
g_Muted[target] = false;
if (g_Cvar_Deadtalk.IntValue == 1 && !IsPlayerAlive(target))
{
SetClientListeningFlags(target, VOICE_LISTENALL);
}
else if (g_Cvar_Deadtalk.IntValue == 2 && !IsPlayerAlive(target))
{
SetClientListeningFlags(target, VOICE_TEAM);
}
else
{
SetClientListeningFlags(target, VOICE_NORMAL);
}

FireOnClientMute(target, false);

if (!silent)
{
LogAction(client, target, "\"%L\" unmuted \"%L\"", client, target);
}
}

void PerformGag(int client, int target, bool silent=false)
{
g_Gagged[target] = true;
FireOnClientGag(target, true);

if (!silent)
{
LogAction(client, target, "\"%L\" gagged \"%L\"", client, target);
}
}

void PerformUnGag(int client, int target, bool silent=false)
{
g_Gagged[target] = false;
FireOnClientGag(target, false);

if (!silent)
{
LogAction(client, target, "\"%L\" ungagged \"%L\"", client, target);
}
}

void PerformSilence(int client, int target)
{
if (!g_Gagged[target])
{
g_Gagged[target] = true;
FireOnClientGag(target, true);
}

if (!g_Muted[target])
{
g_Muted[target] = true;
SetClientListeningFlags(target, VOICE_MUTED);
FireOnClientMute(target, true);
}

LogAction(client, target, "\"%L\" silenced \"%L\"", client, target);
}

void PerformUnSilence(int client, int target)
{
if (g_Gagged[target])
{
g_Gagged[target] = false;
FireOnClientGag(target, false);
}

if (g_Muted[target])
{
g_Muted[target] = false;

if (g_Cvar_Deadtalk.IntValue == 1 && !IsPlayerAlive(target))
{
SetClientListeningFlags(target, VOICE_LISTENALL);
}
else if (g_Cvar_Deadtalk.IntValue == 2 && !IsPlayerAlive(target))
{
SetClientListeningFlags(target, VOICE_TEAM);
}
else
{
SetClientListeningFlags(target, VOICE_NORMAL);
}
FireOnClientMute(target, false);
}

LogAction(client, target, "\"%L\" unsilenced \"%L\"", client, target);
}

public Action Command_Mute(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "★ \x04[HNS] \x01Usage: \x07sm_mute \x02 \x01[reason]");
return Plugin_Handled;
}

char Arguments[256];
GetCmdArgString(Arguments, sizeof(Arguments));

char ArgumentsT[256];
GetCmdArgString(ArgumentsT, sizeof(ArgumentsT));

char arg[64];
GetCmdArg(1, arg, sizeof(arg));
int len = BreakString(Arguments, arg, sizeof(arg));

if (len == -1)
{
/* Safely null terminate */
len = 0;
Arguments[0] = '\0';
}

int lenT = BreakString(ArgumentsT, arg, sizeof(arg));

if (lenT == -1)
{
/* Safely null terminate */
lenT = 0;
ArgumentsT[0] = '\0';
}

char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;

if ((target_count = ProcessTargetString(
arg,
client,
target_list,
MAXPLAYERS,
0,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}

for (int i = 0; i < target_count; i++)
{
int target = target_list[i];
PerformMute(client, target);
}

char reason[64];
Format(reason, sizeof(reason), Arguments[len]);

char time[64];
Format(time, sizeof(time), ArgumentsT[len]);

if (tn_is_ml)
{
if (reason[0] == '\0')
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01muted \x02%t \x01with \x07reason : no reason", client, target_name);
}
else
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01muted \x02%t \x01with \x07reason : \x02%s", client, target_name, reason);
}
}
else
{
if (reason[0] == '\0')
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01muted \x02%s \x01with \x07reason : no reason", client, target_name);
}
else
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01muted \x02%s \x01with \x07reason : \x02%s", client, target_name, reason);
}
}

return Plugin_Handled;
}

public Action Command_Gag(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "★ \x04[HNS] \x01Usage: \x07sm_gag \x02 \x01[reason]");
return Plugin_Handled;
}

char Arguments[256];
GetCmdArgString(Arguments, sizeof(Arguments));

char arg[64];
GetCmdArg(1, arg, sizeof(arg));
int len = BreakString(Arguments, arg, sizeof(arg));

if (len == -1)
{
/* Safely null terminate */
len = 0;
Arguments[0] = '\0';
}

char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;

if ((target_count = ProcessTargetString(
arg,
client,
target_list,
MAXPLAYERS,
0,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}

for (int i = 0; i < target_count; i++)
{
int target = target_list[i];

PerformGag(client, target);
}

char reason[64];
Format(reason, sizeof(reason), Arguments[len]);

if (tn_is_ml)
{
if (reason[0] == '\0')
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01gagged \x02%t \x01with \x07reason : no reason", client, target_name);
}
else
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01gagged \x02%t \x01with \x07reason : \x02%s", client, target_name, reason);
}
}
else
{
if (reason[0] == '\0')
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01gagged \x02%s \x01with \x07reason : no reason", client, target_name);
}
else
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01gagged \x02%s \x01with \x07reason : \x02%s", client, target_name, reason);
}
}

return Plugin_Handled;
}

public Action Command_Silence(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "★ \x04[HNS] \x01Usage: \x07sm_silence \x02 \x01[reason]");
return Plugin_Handled;
}

char Arguments[256];
GetCmdArgString(Arguments, sizeof(Arguments));

char arg[64];
GetCmdArg(1, arg, sizeof(arg));
int len = BreakString(Arguments, arg, sizeof(arg));

if (len == -1)
{
/* Safely null terminate */
len = 0;
Arguments[0] = '\0';
}

char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;

if ((target_count = ProcessTargetString(
arg,
client,
target_list,
MAXPLAYERS,
0,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}

for (int i = 0; i < target_count; i++)
{
int target = target_list[i];

PerformSilence(client, target);
}

char reason[64];
Format(reason, sizeof(reason), Arguments[len]);

if (tn_is_ml)
{
if (reason[0] == '\0')
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01silenced \x02%t \x01with \x07reason : no reason", client, target_name);
}
else
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01silenced \x02%t \x01with \x07reason : \x02%s", client, target_name, reason);
}
}
else
{
if (reason[0] == '\0')
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01silenced \x02%s \x01with \x07reason : no reason", client, target_name);
}
else
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01silenced \x02%s \x01with \x07reason : \x02%s", client, target_name, reason);
}
}

return Plugin_Handled;
}

public Action Command_Unmute(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "★ \x04[HNS] \x01Usage: \x07sm_unmute \x02 \x01[reason]");
return Plugin_Handled;
}

char arg[64];
GetCmdArg(1, arg, sizeof(arg));

char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;

if ((target_count = ProcessTargetString(
arg,
client,
target_list,
MAXPLAYERS,
0,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}

for (int i = 0; i < target_count; i++)
{
int target = target_list[i];

if (!g_Muted[target])
{
continue;
}

PerformUnMute(client, target);
}

if (tn_is_ml)
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01unmuted \x02%t", client, target_name);
}
else
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01unmuted \x02%s", client, target_name);
}

return Plugin_Handled;
}

public Action Command_Ungag(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "★ \x04[HNS] \x01Usage: \x07sm_ungag \x02 \x01[reason]");
return Plugin_Handled;
}

char arg[64];
GetCmdArg(1, arg, sizeof(arg));

char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;

if ((target_count = ProcessTargetString(
arg,
client,
target_list,
MAXPLAYERS,
0,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}

for (int i = 0; i < target_count; i++)
{
int target = target_list[i];

PerformUnGag(client, target);
}

if (tn_is_ml)
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01ungagged \x02%t", client, target_name);
}
else
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01ungagged \x02%s", client, target_name);
}

return Plugin_Handled;
}

public Action Command_Unsilence(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "★ \x04[HNS] \x01Usage: \x07sm_unsilence \x02");
return Plugin_Handled;
}

char arg[64];
GetCmdArg(1, arg, sizeof(arg));

char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;

if ((target_count = ProcessTargetString(
arg,
client,
target_list,
MAXPLAYERS,
0,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}

for (int i = 0; i < target_count; i++)
{
int target = target_list[i];

PerformUnSilence(client, target);
}

if (tn_is_ml)
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01unsilenced \x02%t", client, target_name);
}
else
{
PrintToChatAll("★ \x04[HNS] Admin \x02%N \x01unsilenced \x02%s", client, target_name);
}

return Plugin_Handled;
}

 

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this