Raised This Month: $32 Target: $400
 8% 

Gag plugin with only commands


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Magicher0ex
Member
Join Date: Dec 2019
Old 12-03-2021 , 09:01   Gag plugin with only commands
Reply With Quote #1

Hey guys, is there any gag plugin where the gagged person can use first sign (/)
For example if he type messages like /rtv, /timeleft, /shop & etc.
Magicher0ex is offline
SHIFT0
Senior Member
Join Date: Apr 2021
Location: Palestine
Old 12-03-2021 , 09:45   Re: Gag plugin with only commands
Reply With Quote #2

Doesntt understand what u want
SHIFT0 is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 12-03-2021 , 10:06   Re: Gag plugin with only commands
Reply With Quote #3

The gag plugin I have constructed does what you asked. Commands are still allowed through. It responds to the gagged client if you want via CVAR exactly in years, months, days, hours, minutes, and seconds when it will be lifted in their language, gag_flood_advise. Over 2 it has additional unique radio feedback to make the client feel like there is somebody in command on the other end. It may extinguish them from spamming due to waiting for some kind of response and otherwise getting none. Occasionally monster grabs the mic too to add drama. It has a built in flood control if anybody talks too much without one of these longer term gags also CVAR controlled, gag_flood_time. Nobody else has tested it besides me and you are welcome to it.

e.g.
Code:
amx_gag "STEAM_0:x:xxxx HH:MM:SS mm/dd/yyyy"
hours are in military
__________________
DJEarthQuake is offline
Magicher0ex
Member
Join Date: Dec 2019
Old 12-03-2021 , 10:08   Re: Gag plugin with only commands
Reply With Quote #4

Quote:
Originally Posted by SHIFT0 View Post
Doesntt understand what u want
I want player to have access with commands when he's gagged
So when gagged player start mesage with "/" to be accepted.
Magicher0ex is offline
Magicher0ex
Member
Join Date: Dec 2019
Old 12-03-2021 , 10:10   Re: Gag plugin with only commands
Reply With Quote #5

Quote:
Originally Posted by DJEarthQuake View Post
The gag plugin I have constructed does what you asked. Commands are still allowed through. It responds to the gagged client if you want via CVAR exactly in years, months, days, hours, minutes, and seconds when it will be lifted in their language, gag_flood_advise. Over 2 it has additional unique radio feedback to make the client feel like there is somebody in command on the other end. It may extinguish them from spamming due to waiting for some kind of response and otherwise getting none. Occasionally monster grabs the mic too to add drama. It has a built in flood control if anybody talks too much without one of these longer term gags also CVAR controlled, gag_flood_time. Nobody else has tested it besides me and you are welcome to it.

e.g.
Code:
amx_gag "STEAM_0:x:xxxx HH:MM:SS mm/dd/yyyy"
hours are in military

Ohh thank you, i'm gonna try it.
Magicher0ex is offline
Old 12-03-2021, 10:47
Magicher0ex
This message has been deleted by Magicher0ex.
Magicher0ex
Member
Join Date: Dec 2019
Old 12-03-2021 , 11:01   Re: Gag plugin with only commands
Reply With Quote #6

Quote:
Originally Posted by DJEarthQuake View Post
The gag plugin I have constructed does what you asked. Commands are still allowed through. It responds to the gagged client if you want via CVAR exactly in years, months, days, hours, minutes, and seconds when it will be lifted in their language, gag_flood_advise. Over 2 it has additional unique radio feedback to make the client feel like there is somebody in command on the other end. It may extinguish them from spamming due to waiting for some kind of response and otherwise getting none. Occasionally monster grabs the mic too to add drama. It has a built in flood control if anybody talks too much without one of these longer term gags also CVAR controlled, gag_flood_time. Nobody else has tested it besides me and you are welcome to it.

e.g.
Code:
amx_gag "STEAM_0:x:xxxx HH:MM:SS mm/dd/yyyy"
hours are in military
Mhm this plugin doesn't help me. I want gag to be fast and simple like the others one with menu. Here you haven't a menu which u can choose between time and type of gag, so thank you but i can't approve it as well as.
Magicher0ex is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 12-03-2021 , 11:44   Re: Gag plugin with only commands
Reply With Quote #7

GUI, menus are next. When I tested plugin the said commands were still able to pass, as requested. Are you able to confirm?
__________________
DJEarthQuake is offline
Old 12-03-2021, 19:48
Yusochan
This message has been deleted by Yusochan.
Magicher0ex
Member
Join Date: Dec 2019
Old 12-03-2021 , 20:17   Re: Gag plugin with only commands
Reply With Quote #8

Quote:
Originally Posted by Yusochan View Post
Here u go !

PS : It's not my plugin but idk the author who made this plugin but its really a good one

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <regex>
#include <nvault>
#include <cromchat>

#define LOG_GAGS

#define IP_PATTERN "([0-9]+.*[1-9][0-9]+.*[0-9]+.*[0-9])"
#define VERSION "1.1"

enum _:GagState
{
    
GAG_NOT,
    
GAG_YES,
    
GAG_EXPIRED
};

enum _:GagTimeData
{
    
DISPLAY[64],
    
MINUTES
};

new const 
g_GagTimes[][GagTimeData] =
{
    { 
"1 minute"},
    { 
"5 minutes"},
    { 
"10 minutes"10 },
    { 
"15 minutes"15 },
    { 
"20 minutes"20 },
    { 
"30 minutes"30 },
    { 
"1 hour"60 },
    { 
"2 hours"120 },
    { 
"6 hours"360 },
    { 
"1 day"1440 },
    { 
"1 week"10080 },
    { 
"Permanent"}
}

new const 
g_szVaultName[] = "gagsystem";
new const 
g_szGagSound[] = "buttons/blip1.wav";
new const 
g_szLineStyle[] = "======================================================";
#if defined LOG_GAGS
new const g_szLogFile[] = "addons/amxmodx/logs/gag_system.log";
#endif

new g_iNVaultHandleRegex:g_iRegexIPPatterng_iUnusedg_iHudChannelg_iThinkingEnt;
new 
g_iGagTimeIndex[33], g_iUserTarget[33], bool:g_blIsUserMuted[33];
new 
gp_blHudEnabledgp_blEnableGagExpireMsg;
new 
g_GagForwardg_UngagForward;

public 
plugin_init()
{
    
register_plugin("Gag System"VERSION"Idk"); // I'll put 'idk' cuz i don't know the guy who made this plugin but i like it :)
    
register_cvar("gagsystem_shoko"VERSIONFCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED);

    
register_clcmd("say""CommandSayExecuted");
    
register_clcmd("say_team""CommandSayExecuted");

    
g_GagForward CreateMultiForward("user_gagged"ET_IGNOREFP_CELL);
    
g_UngagForward CreateMultiForward("user_ungagged"ET_IGNOREFP_CELL);

    
gp_blHudEnabled register_cvar("gagsystem_showhud""1");
    
gp_blEnableGagExpireMsg register_cvar("gagsystem_printexpired""1");

    
#if AMXX_VERSION_NUM >= 183
    
hook_cvar_change(gp_blEnableGagExpireMsg"GagExpireCvarChanged");
    
#endif

    
register_forward(FM_Voice_SetClientListening"PlayerVoiceSpeak"0);
    
register_forward(FM_ClientUserInfoChanged"FwClientInfoChanged"0);
    
register_forward(FM_Think"FwEntityThink"1);

    
register_clcmd("amx_gag""CommandGag"ADMIN_SLAY"<name | #id | ip> <time> <reason>");
    
register_clcmd("amx_ungag""CommandUngag"ADMIN_SLAY"<name | #id | ip>");
    
register_clcmd("amx_gagmenu""CommandGagMenu"ADMIN_SLAY);
    
register_clcmd("amx_TYPE_GAGREASON""CommandGagReason"ADMIN_SLAY);
    
register_clcmd("amx_cleangags""CommandCleanDB"ADMIN_RCON);

    
#if AMXX_VERSION_NUM < 183
    
g_iRegexIPPattern regex_compile(IP_PATTERNg_iUnused""0);
    
#else
    
g_iRegexIPPattern regex_compile_ex(IP_PATTERN);
    
#endif

    
g_iNVaultHandle nvault_open(g_szVaultName);

    if (
g_iNVaultHandle == INVALID_HANDLE)
    {
        
set_fail_state("Failed to open NVault DB!");
    }

    
g_iHudChannel CreateHudSyncObj();
    
g_iThinkingEnt engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"));
    
set_pev(g_iThinkingEntpev_nextthinkget_gametime() + 0.1);
}

public 
plugin_precache()
{
    
precache_sound(g_szGagSound);
}

public 
plugin_end()
{
    
nvault_close(g_iNVaultHandle);
    
regex_free(g_iRegexIPPattern);
}

public 
plugin_natives()
{
    
register_native("is_user_gagged""native_is_gagged");

    
register_native("gag_user""native_gag_user");
    
register_native("gag_user_byid""native_gag_id");

    
register_native("ungag_user""native_ungag_user");
    
register_native("ungag_user_byid""native_ungag_id");
}

public 
native_is_gagged()
{
    new 
id get_param(1);
    new 
bool:shouldPrint bool:get_param(2);

    if (!
is_user_connected(id))
    {
        
log_error(AMX_ERR_NATIVE"Invalid player ID %d"id);
        return 
false;
    }

    return 
IsUserGagged(idshouldPrint) == GAG_YES;
}

public 
native_gag_user()
{
    new 
szIP[16], szName[32], iDurationszReason[64], szAdmin[32];

    
get_string(1szNamecharsmax(szName));
    
get_string(2szIPcharsmax(szIP));
    
iDuration get_param(3);
    
get_string(4szReasoncharsmax(szReason));
    
get_string(5szAdmincharsmax(szAdmin));

    if (!
regex_match_c(szIPg_iRegexIPPatterng_iUnused))
    {
        
log_error(AMX_ERR_NATIVE"%s is not a valid IP Address!"szIP);
        return;
    }

    if (
iDuration 0
    {
        
log_error(AMX_ERR_NATIVE"Time cannot be negative!");
        return;
    }

    
GagUser(szNameszIPiDurationszReasonszAdmin);
}

public 
native_gag_id()
{
    new 
id;

    
id get_param(1);

    if (!
is_user_connected(id))
    {
        
log_error(AMX_ERR_NATIVE"Invalid player ID %d"id);
        return;
    }

    new 
szName[32], szIP[16], szReason[64], iDurationszAdmin[32];
    
iDuration get_param(2);

    if (
iDuration 0
    {
        
log_error(AMX_ERR_NATIVE"Time cannot be negative!");
        return;
    }

    
get_string(3szReasoncharsmax(szReason));
    
get_string(4szAdmincharsmax(szAdmin));

    
get_user_name(idszNamecharsmax(szName));
    
get_user_ip(idszIPcharsmax(szIP), 1);

    
GagUser(szNameszIPiDurationszReasonszAdmin);
}

public 
native_ungag_user()
{
    new 
szIP[16], szName[32], szAdmin[32];

    
get_string(1szNamecharsmax(szName));
    
get_string(2szIPcharsmax(szIP));
    
get_string(3szAdmincharsmax(szAdmin));

    if (!
regex_match_c(szIPg_iRegexIPPatterng_iUnused))
    {
        
log_error(AMX_ERR_NATIVE"%s is not a valid IP Address!"szIP);
        return;
    }

    
UngagUser(szNameszIPszAdmin);
}

public 
native_ungag_id()
{
    new 
id;

    
id get_param(1);

    if (!
is_user_connected(id))
    {
        
log_error(AMX_ERR_NATIVE"Invalid player ID %d"id);
        return;
    }

    new 
szAdmin[32], szName[32], szIP[16];

    
get_string(2szAdmincharsmax(szAdmin));

    
get_user_name(idszNamecharsmax(szName));
    
get_user_ip(idszIPcharsmax(szIP), 1);

    
UngagUser(szNameszIPszAdmin);
}

public 
client_putinserver(id)
{
    
g_blIsUserMuted[id] = IsUserGagged(idfalse) == GAG_YES;
}

#if AMXX_VERSION_NUM >= 183
public GagExpireCvarChanged(pcvarszOldValue[], szNewValue[])
{
    if (
str_to_num(szNewValue) == 1)
    {
        
set_pev(g_iThinkingEntpev_nextthinkget_gametime() + 1.0);
    }
}
#endif

public PlayerVoiceSpeak(receiverid)
{
    if (
receiver == id || !is_user_connected(id))
    {
        return 
FMRES_IGNORED;
    }

    if (
g_blIsUserMuted[id])
    {
        
engfunc(EngFunc_SetClientListeningreceiveridfalse);
        return 
FMRES_SUPERCEDE;
    }

    return 
FMRES_IGNORED;
}

public 
FwClientInfoChanged(id)
{
    if (!
is_user_connected(id))
    {
        return 
FMRES_IGNORED;
    }

    new 
szOldName[32], szNewName[32];
    
get_user_name(idszOldNamecharsmax(szOldName));
    
get_user_info(id"name"szNewNamecharsmax(szNewName));

    if (!
equal(szOldNameszNewName) && szOldName[0] != EOS && IsUserGagged(idfalse) == GAG_YES)
    {
        
set_user_info(id"name"szOldName);
        return 
FMRES_HANDLED;
    }

    return 
FMRES_IGNORED;
}

public 
FwEntityThink(iEnt)
{
    if (
iEnt != g_iThinkingEnt || !get_pcvar_num(gp_blEnableGagExpireMsg))
    {
        return;
    }

    static 
iPlayers[32], iPlayersNumid;
    
get_players(iPlayersiPlayersNum);

    for (new 
0iPlayersNumi++)
    {
        
id iPlayers[i];

        if (
IsUserGagged(idfalse) == GAG_EXPIRED)
        {
            static 
szName[32];
            
get_user_name(idszNamecharsmax(szName));

            
CC_SendMessage(0"&x01[&x04GAG&x01] &x03 Player &x04%s &x01is no longer gagged!"szName);

            if (
get_pcvar_num(gp_blHudEnabled))
            {
                
set_hudmessage(255000.050.30);
                
ShowSyncHudMsg(0g_iHudChannel"%s^n%s gag has expired^n%s"g_szLineStyleszNameg_szLineStyle);
            }
        }
    }

    
set_pev(iEntpev_nextthinkget_gametime() + 10.0);
}

public 
CommandSayExecuted(id)
{
    if (
IsUserGagged(id) == GAG_YES)
    {
        return 
PLUGIN_HANDLED;
    }

    return 
PLUGIN_CONTINUE;
}

public 
CommandGag(idiLeveliCmdId)
{
    if (!
cmd_access(idiLeveliCmdId4))
    {
        return 
PLUGIN_HANDLED;
    }

    new 
szTarget[33], szTargetIP[16], szTime[8], szReason[64];
    
read_argv(1szTargetcharsmax(szTarget));

    if (!
regex_match_c(szTargetg_iRegexIPPatterng_iUnused))
    {
        new 
iTarget cmd_target(idszTarget);

        if (!
iTarget)
        {
            return 
PLUGIN_HANDLED;
        }

        
get_user_name(iTargetszTargetcharsmax(szTarget));
        
get_user_ip(iTargetszTargetIPcharsmax(szTargetIP), 1);
        
g_blIsUserMuted[iTarget] = true;
    }
    else
    {
        
copy(szTargetIPcharsmax(szTargetIP), szTarget);
    }

    
read_argv(2szTimecharsmax(szTime));
    
read_argv(3szReasoncharsmax(szReason));
    new 
iTime str_to_num(szTime);

    new 
szAdmin[32];
    
get_user_name(idszAdmincharsmax(szAdmin));

    
console_print(id"%s"GagUser(szTargetszTargetIPiTimeszReasonszAdmin));

    return 
PLUGIN_HANDLED;
}

public 
CommandUngag(idiLeveliCmdId)
{
    if (!
cmd_access(idiLeveliCmdId2))
    {
        return 
PLUGIN_HANDLED;
    }

    new 
szTarget[32], szTargetIP[16];
    
read_argv(1szTargetcharsmax(szTarget));

    if (!
regex_match_c(szTargetg_iRegexIPPatterng_iUnused))
    {
        new 
iTarget cmd_target(idszTargetCMDTARGET_ALLOW_SELF);

        if (!
iTarget)
        {
            return 
PLUGIN_HANDLED;
        }

        
get_user_name(iTargetszTargetcharsmax(szTarget));
        
get_user_ip(iTargetszTargetIPcharsmax(szTargetIP), 1);
    }
    else
    {
        
copy(szTargetIPcharsmax(szTargetIP), szTarget);
    }

    new 
szAdminName[32];
    
get_user_name(idszAdminNamecharsmax(szAdminName));

    
console_print(id"%s"UngagUser(szTargetszTargetIPszAdminName));

    return 
PLUGIN_HANDLED;
}

public 
CommandGagMenu(idiLeveliCmdId)
{
    if (!
cmd_access(idiLeveliCmdId1))
    {
        return 
PLUGIN_HANDLED;
    }

    
g_iGagTimeIndex[id] = 0;
    
g_iUserTarget[id] = 0;
    
ShowGagMenu(id);

    return 
PLUGIN_HANDLED;
}

ShowGagMenu(idpage 0)
{
    new 
iMenu menu_create("\rGag Menu""GagMenuHandler");

    new 
iPlayers[32], iPlayersNum;
    
get_players(iPlayersiPlayersNum);

    new 
szItem[64], szName[32], szIndex[8];
    new 
iPlayer;

    for (new 
0iPlayersNumi++)
    {
        
iPlayer iPlayers[i];

        if (
== 0)
        {
            
formatex(szItemcharsmax(szItem), "\yGag length \r[\w%s\r]^n"g_GagTimes[g_iGagTimeIndex[id]][DISPLAY]);
            
menu_additem(iMenuszItem"time");
        }

        
get_user_name(iPlayerszNamecharsmax(szName));
        
num_to_str(iPlayerszIndexcharsmax(szIndex));

        if (
IsUserGagged(iPlayerfalse))
        {
            
formatex(szItemcharsmax(szItem), "\y%s \r[\wGagged\r]"szName);
        }
        else if (
get_user_flags(iPlayer) & ADMIN_IMMUNITY)
        {
            
formatex(szItemcharsmax(szItem), "\d%s \r[\wHas immunity\r]"szName);
        }
        else
        {
            
copy(szItemcharsmax(szItem), szName);
        }

        
menu_additem(iMenuszItemszIndex);
    }

    
menu_display(idiMenupage);
}

public 
GagMenuHandler(idiMenuItem)
{
    if (
Item == MENU_EXIT)
    {
        
menu_destroy(iMenu);
        return;
    }

    new 
szInfo[8], iTemp;
    
menu_item_getinfo(iMenuItemiTempszInfocharsmax(szInfo), __iTemp);

    if (
equal(szInfo"time"))
    {
        ++
g_iGagTimeIndex[id];
        
g_iGagTimeIndex[id] %= sizeof g_GagTimes;
        
menu_destroy(iMenu);
        
ShowGagMenu(idItem 7);
        return;
    }

    new 
iTarget str_to_num(szInfo);

    if (
IsUserGagged(iTargetfalse) == GAG_YES)
    {
        new 
szName[32], szIP[16], szAdminName[32];
        
get_user_name(idszAdminNamecharsmax(szAdminName));
        
get_user_name(iTargetszNamecharsmax(szName));
        
get_user_ip(iTargetszIPcharsmax(szIP), 1);

        
UngagUser(szNameszIPszAdminName);

        
menu_destroy(iMenu);
        return;
    }

    if (
get_user_flags(iTarget) & ADMIN_IMMUNITY)
    {
        
menu_destroy(iMenu);
        return;
    }

    
g_iUserTarget[id] = iTarget;
    
client_cmd(id"messagemode amx_TYPE_GAGREASON");

    
menu_destroy(iMenu);
}

public 
CommandGagReason(idiLeveliCmdId)
{
    if (!
cmd_access(idiLeveliCmdId2) || !is_user_connected(g_iUserTarget[id]))
    {
        return 
PLUGIN_HANDLED;
    }

    new 
szReason[64], szName[32], szIP[16], szAdminName[32];
    
read_argv(1szReasoncharsmax(szReason));

    
get_user_name(idszAdminNamecharsmax(szAdminName));

    
get_user_name(g_iUserTarget[id], szNamecharsmax(szName));
    
get_user_ip(g_iUserTarget[id], szIPcharsmax(szIP), 1);

    
GagUser(szNameszIPg_GagTimes[g_iGagTimeIndex[id]][MINUTES], szReasonszAdminName);
    
g_blIsUserMuted[g_iUserTarget[id]] = true;

    
ShowGagMenu(id);

    return 
PLUGIN_HANDLED;
}

public 
CommandCleanDB(idiLeveliCmdId)
{
    if (!
cmd_access(idiLeveliCmdId1))
    {
        return 
PLUGIN_HANDLED;
    }

    
nvault_prune(g_iNVaultHandle0get_systime());

    
console_print(id"Database has been cleaned.");

    return 
PLUGIN_HANDLED;
}

UngagUser(szName[], szIP[], szAdmin[])
{
    new 
szResult[64], szTemp[3];

    if (!
nvault_get(g_iNVaultHandleszIPszTempcharsmax(szTemp)))
    {
        
formatex(szResultcharsmax(szResult), "User with IP %s not found."szIP);
        return 
szResult;
    }

    
nvault_remove(g_iNVaultHandleszIP);

    if (!
equal(szNameszIP))
    {
        new 
iTarget cmd_target(0szName0);

        
g_blIsUserMuted[iTarget] = false;

        
CC_SendMessage(0"&x01[&x04GAG&x01] &x03You have been ungagged by &x04%s"szAdmin);

        
CC_SendMessage(0"&x01[&x04GAG&x01] &x03Player &x03%s &x01has been ungagged by &x04%s"szNameszAdmin);

        if (
get_pcvar_num(gp_blHudEnabled))
        {
            
set_hudmessage(255000.050.30);
            
ShowSyncHudMsg(0g_iHudChannel"%s^n%s has been ungagged by %s^n%s"g_szLineStyleszNameszAdming_szLineStyle);
        }
    }

    new 
id find_player("d"szIP);
    if (
id != 0)
    {
        
ExecuteForward(g_UngagForwardg_iUnusedid);
    }

    
#if defined LOG_GAGS
    
log_to_file(g_szLogFile"[UNGAG] ADMIN: %s | TARGET_NAME: %s [IP: %s]"szAdminszNameszIP);
    
#endif
    
copy(szResultcharsmax(szResult), "Player has been ungagged");
    return 
szResult;
}

GagUser(szName[], szIP[], iDurationszReason[], szAdminName[])
{
    new 
iExpireTime iDuration != get_systime() + (iDuration 60) : 0;

    new 
szResult[64];

    if (
nvault_get(g_iNVaultHandleszIPszResultcharsmax(szResult)))
    {
        
copy(szResultcharsmax(szResult), "Player is already gagged.");
        return 
szResult;
    }

    new 
szValue[512];
    
formatex(szValuecharsmax(szValue), "^"%s^"#^"%s^"#%d#^"%s^""szNameszReasoniExpireTimeszAdminName);

    
set_hudmessage(025500.050.30);

    if (
iExpireTime == 0)
    {
        
CC_SendMessage(0"&x01[&x04GAG&x01] &x03%s &x01Player &x03%s &x01has been gagged by &x04%s &x01. &x03Reason: &x04%s &x01. &x03Gag expires &x01never"szNameszAdminNameszReason);

        if (
get_pcvar_num(gp_blHudEnabled))
        {
            
ShowSyncHudMsg(0g_iHudChannel"%s^n has been gagged by %s^nExpires never^nReason: %s^n%s"g_szLineStyleszNameszAdminNameszReasong_szLineStyle);
        }
    }
    else
    {
        
CC_SendMessage(0"&x01[&x04GAG&x01] &x03Player &x03%s &x01has been gagged by &x04%s. &x03Reason: &x04%s. &x03Gag expires &x04%s"szNameszAdminNameszReasonGetTimeAsString(iDuration 60));

        if (
get_pcvar_num(gp_blHudEnabled))
        {
            
ShowSyncHudMsg(0g_iHudChannel"%s^n%s has been gagged by %s^nExpires in %s^nReason: %s^n%s"g_szLineStyleszNameszAdminNameGetTimeAsString(iDuration 60), szReasong_szLineStyle);
        }
    }

    
emit_sound(0CHAN_AUTOg_szGagSound1.0ATTN_NORMSND_SPAWNINGPITCH_NORM);

    
#if defined LOG_GAGS
    
log_to_file(g_szLogFile"ADMIN: %s | PLAYER: %s [IP: %s] | REASON: %s | TIME: %s"szAdminNameszNameszIPszReasonGetTimeAsString(iDuration 60));
    
#endif

    
new id find_player("d"szIP);

    if (
id != 0)
    {
        
ExecuteForward(g_GagForwardg_iUnusedid);
    }

    
nvault_set(g_iNVaultHandleszIPszValue);

    
copy(szResultcharsmax(szResult), "Player successfully gagged.");
    return 
szResult;
}

IsUserGagged(idbool:print = true)
{
    new 
szIP[16], szVaultData[512];
    
get_user_ip(idszIPcharsmax(szIP), 1);

    if (!
nvault_get(g_iNVaultHandleszIPszVaultDatacharsmax(szVaultData)))
    {
        
g_blIsUserMuted[id] = false;
        return 
GAG_NOT;
    }

    new 
szGaggedName[32], szReason[64], szExpireDate[32], szAdminName[32];
    
replace_all(szVaultDatacharsmax(szVaultData), "#"" ");
    
parse(szVaultDataszGaggedNamecharsmax(szGaggedName), szReasoncharsmax(szReason), szExpireDatecharsmax(szExpireDate), szAdminNamecharsmax(szAdminName));

    new 
iExpireTime str_to_num(szExpireDate);

    if (
get_systime() < iExpireTime || iExpireTime == 0)
    {
        if (print)
        {
            if (
iExpireTime == 0)
            {
                
CC_SendMessage(0"&x01[&x04GAG&x01] &x03You are gagged! Your gag expires &x01never.");
            }
            else
            {
                
CC_SendMessage(0"&x01[&x04GAG&x01] &x03You are gagged! Your gag expires in &x04%s"GetTimeAsString(iExpireTime get_systime()));
            }

            
CC_SendMessage(0"&x01[&x04GAG&x01] &x03Gagged by &x03%s&x01. &x03Gagged nickname: &x04%s&x01. &x03Gag reason: &x04%s&x01."szAdminNameszGaggedNameszReason);
        }

        
g_blIsUserMuted[id] = true;

        return 
GAG_YES;
    }

    
g_blIsUserMuted[id] = false;
    
ExecuteForward(g_UngagForwardg_iUnusedid);

    
nvault_remove(g_iNVaultHandleszIP);

    return 
GAG_EXPIRED;
}

GetTimeAsString(seconds)
{
    new 
iYears seconds 31536000;
    
seconds %= 31536000;

    new 
iMonths seconds 2592000;
    
seconds %= 2592000;

    new 
iWeeks seconds 604800;
    
seconds %= 604800;

    new 
iDays seconds 86400;
    
seconds %= 86400;

    new 
iHours seconds 3600;
    
seconds %= 3600;

    new 
iMinutes seconds 60;
    
seconds %= 60;

    new 
szResult[256];

    if (
iYears)
    {
        
format(szResultcharsmax(szResult), "%s%d Year%s "szResultiYearsiYears == "" "s");
    }

    if (
iMonths)
    {
        
format(szResultcharsmax(szResult), "%s%d Month%s "szResultiMonthsiMonths == "" "s");
    }

    if (
iWeeks)
    {
        
format(szResultcharsmax(szResult), "%s%d Week%s "szResultiWeeksiWeeks == "" "s");
    }

    if (
iDays)
    {
        
format(szResultcharsmax(szResult), "%s%d Day%s "szResultiDaysiDays == "" "s");
    }

    if (
iHours)
    {
        
format(szResultcharsmax(szResult), "%s%d Hour%s "szResultiHoursiHours == "" "s");
    }

    if (
iMinutes)
    {
        
format(szResultcharsmax(szResult), "%s%d Minute%s "szResultiMinutesiMinutes == "" "s");
    }

    if (
seconds)
    {
        
format(szResultcharsmax(szResult), "%s%d Second%s"szResultsecondsseconds == "" "s");
    }

    return 
szResult;

I can't find the row where u edit the plugin. Would u show me please
Magicher0ex is offline
Old 12-04-2021, 08:28
Yusochan
This message has been deleted by Yusochan.
Magicher0ex
Member
Join Date: Dec 2019
Old 12-04-2021 , 09:03   Re: Gag plugin with only commands
Reply With Quote #9

Quote:
Originally Posted by Yusochan View Post
Line 44 / 56 / 300 / 556 / 558 / 599 / 608 / 658 / 662 / 665
Ohh you just changed with cromchat. But that's not what i mean.
Maybe you don't understand me. I want gag to define this symbol "/". so when gag player start a message with "/" to be ignored and countinue like a normal message, without gag warning.
I want gagged players to use cmds.

I think if there is else if and argument for message which starts with /
PHP Code:
public CommandSayExecuted(id)
{
    if (
IsUserGagged(id) == GAG_YES)
    {
        return 
PLUGIN_HANDLED;
    }

    return 
PLUGIN_CONTINUE;

Hope u understand me.
Magicher0ex is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-04-2021 , 09:11   Re: Gag plugin with only commands
Reply With Quote #10

Quote:
Originally Posted by Yusochan View Post
Here u go !

PS : It's not my plugin but idk the author who made this plugin but its really a good one
So why did you remove the author's name and put "idk" in its place? It's not like there was nothing there when you found the plugin.

Also, the only thing you changed is the colorchat include which has nothing to do with whether or not "/" messages can be used.

https://www.diffchecker.com/eeYox5Hg

-----------

As for the request: simply put your current gag plugin on the bottom of plugins.ini so it cannot block commands registered from plugins above it.

Last edited by OciXCrom; 12-04-2021 at 09:12.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:56.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode