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

[REQ] Change This Approved Gag Menu Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Gam3ronE
SourceMod Donor
Join Date: Aug 2010
Old 01-25-2011 , 11:47   [REQ] Change This Approved Gag Menu Plugin
Reply With Quote #1

This plugin works perfectly I just want it changed to suit my needs.

First up here's the AMX Plugin's script in its .sma form:
(or you can download the script here: http://goo.gl/zVglf )

PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < engine >

#define DEFAULT_TIME 600.0 // In Seconds

enum ( <<= ) {
    
GAG_CHAT 1,
    
GAG_TEAMSAY,
    
GAG_VOICE
};

enum _:GagData {
    
GAG_AUTHID20 ],
    
GAG_TIME,
    
GAG_START,
    
GAG_FLAGS
};

new 
g_szAuthid33 ][ 20 ];
new 
g_iThinkerg_iGagged;
new 
bool:g_bColoredMenusTrie:g_tArrayPos, Array:g_aGagData, Array:g_aGagTimes;
new 
g_iMenuOption33 ], g_iMenuPosition33 ], g_iMenuPlayers33 ][ 32 ];

public 
plugin_init( ) {
    
register_plugin"AMXX Gag""1.3 RC""xPaw & Exolent" );
    
    
register_clcmd"say",        "CmdSay" );
    
register_clcmd"say_team",   "CmdTeamSay" );
    
    
register_concmd"amx_gag",       "CmdGagPlayer",   ADMIN_KICK"<nick or #userid> <time> <a|b|c>" );
    
register_concmd"amx_ungag",     "CmdUnGagPlayer"ADMIN_KICK"<nick or #userid>" );
    
register_concmd"amx_gagmenu",   "CmdGagMenu",     ADMIN_KICK"- displays gag menu" );
    
register_srvcmd"amx_gag_times""CmdSetBanTimes" );
    
    
register_menucmdregister_menuid"Gag Menu" ), 1023"ActionGagMenu" );
    
register_messageget_user_msgid"SayText" ), "MessageSayText" );
    
    
g_tArrayPos TrieCreate( );
    
g_aGagData  ArrayCreateGagData );
    
g_aGagTimes ArrayCreate( );
    
g_bColoredMenus bool:colored_menus( );
    
    
// Gag times for the gag menu (amx_gagmenu)
    // Default values: 60 300 600 1800 3600 7200 86400
    
    // Load up standart times
    
ArrayPushCellg_aGagTimes60 );
    
ArrayPushCellg_aGagTimes300 );
    
ArrayPushCellg_aGagTimes600 );
    
ArrayPushCellg_aGagTimes1800 );
    
ArrayPushCellg_aGagTimes3600 );
    
ArrayPushCellg_aGagTimes7200 );
    
ArrayPushCellg_aGagTimes86400 );
    
    
// Set up entity-thinker
    
new const szClassname[ ] = "gag_thinker";
    
    
g_iThinker create_entity"info_target" );
    
entity_set_stringg_iThinkerEV_SZ_classnameszClassname );
    
    
register_thinkszClassname"FwdThink" );
}

public 
CmdSetBanTimes( ) {
    new 
iArgs read_argc( );
    
    if( 
iArgs <= ) {
        
server_print"Usage: amx_gag_times <time1> [time2] [time3] ..." );
        
        return;
    }
    
    
ArrayClearg_aGagTimes );
    
    new 
szBuffer32 ], iTime;
    for( new 
1iArgsi++ ) {
        
read_argviszBuffer31 );
        
        
iTime str_to_numszBuffer );
        
        if( 
iTime 86400 ) {
            
server_print"[AMXX GAG] Time more then 86400 is not allowed!" );
            
            continue;
        }
        
        
ArrayPushCellg_aGagTimesiTime );
    }
}

public 
plugin_end( ) {
    
TrieDestroyg_tArrayPos );
    
ArrayDestroyg_aGagData );
    
ArrayDestroyg_aGagTimes );
}

public 
client_putinserverid )
    if( 
CheckGagFlagidGAG_VOICE ) )
        
set_speakidSPEAK_MUTED );

public 
client_authorizedid )
    
get_user_authididg_szAuthidid ], 19 );

public 
client_disconnectid ) {
    if( 
TrieKeyExistsg_tArrayPosg_szAuthidid ] ) ) {
        new 
szName32 ];
        
get_user_nameidszName31 );
        
        new 
iPlayers32 ], iNumiPlayer;
        
get_playersiPlayersiNum"ch" );
        
        for( new 
iiNumi++ ) {
            
iPlayer iPlayers];
            
            if( 
get_user_flagsiPlayer ) & ADMIN_KICK )
                
client_printiPlayerprint_chat"[AMXX] Gagged player ^"%s<%s>^" has disconnected!"szNameg_szAuthidid ] );
        }
    }
    
    
g_szAuthidid ][ ] = '^0';
}

public 
client_infochangedid ) {
    if( !
CheckGagFlagid, ( GAG_CHAT GAG_TEAMSAY ) ) )
        return;
    
    static const 
name[ ] = "name";
    
    static 
szNewName32 ], szOldName32 ];
    
get_user_infoidnameszNewName31 );
    
get_user_nameidszOldName31 );
    
    if( !
equalszNewNameszOldName ) ) {
        
client_printidprint_chat"[AMXX] Gagged players cannot change their names!" );
        
        
set_user_infoidnameszOldName );
    }
}

public 
MessageSayText( ) {
    static const 
Cstrike_Name_Change[ ] = "#Cstrike_Name_Change";
    
    new 
szMessagesizeofCstrike_Name_Change ) + ];
    
get_msg_arg_string2szMessagesizeofszMessage ) - );
    
    if( 
equalszMessageCstrike_Name_Change ) ) {
        new 
szName32 ], id;
        for( new 
3<= 4i++ ) {
            
get_msg_arg_stringiszName31 );
            
            
id get_user_indexszName );
            
            if( 
is_user_connectedid ) ) {
                if( 
CheckGagFlagid, ( GAG_CHAT GAG_TEAMSAY ) ) )
                    return 
PLUGIN_HANDLED;
                
                break;
            }
        }
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
FwdThink( const iEntity ) {
    if( !
g_iGagged )
        return;
    
    new 
Float:fGametime;
    
fGametime get_gametime( );
    
    new 
dataGagData ], idszName32 ];
    for( new 
0g_iGaggedi++ ) {
        
ArrayGetArrayg_aGagDataidata );
        
        if( ( 
Float:dataGAG_START ] + Float:dataGAG_TIME ] - 0.5 ) <= fGametime ) {
            
id find_player"c"dataGAG_AUTHID ] );
            
            if( 
is_user_connectedid ) ) {
                
get_user_nameidszName31 );
                
                
client_print0print_chat"[AMXX] Player ^"%s^" is no longer gagged."szName );
            }
            
            
DeleteGag);
            
            
i--;
        }
    }
    
    if( !
g_iGagged )
        return;
    
    new 
Float:flNextTime 999999.9;
    for( new 
0g_iGaggedi++ ) {
        
ArrayGetArrayg_aGagDataidata );
        
        
flNextTime floatminflNextTimeFloat:dataGAG_START ] + Float:dataGAG_TIME ] );
    }
    
    
entity_set_floatiEntityEV_FL_nextthinkflNextTime );
}

public 
CmdSay( const id )
    return 
CheckSayid);

public 
CmdTeamSay( const id )
    return 
CheckSayid);

CheckSay( const id, const bTeam ) {
    new 
iArrayPos;
    if( 
TrieGetCellg_tArrayPosg_szAuthidid ], iArrayPos ) ) {
        new 
dataGagData ];
        
ArrayGetArrayg_aGagDataiArrayPosdata );
        
        new const 
iFlags[ ] = { GAG_CHATGAG_TEAMSAY };
        
        if( 
dataGAG_FLAGS ] & iFlagsbTeam ] ) {
            new 
szInfo32 ], iLeniTime floatround( ( Float:dataGAG_START ] + Float:dataGAG_TIME ] ) - get_gametime( ) ), iMinutes iTime 60iSeconds iTime 60;
            
            if( 
iMinutes )
                
iLen formatexszInfo31"%i minute%s"iMinutesiMinutes == "" "s" );
            if( 
iSeconds )
                
formatexszInfoiLen ], 31 iLen"%s%i second%s"iLen " and " ""iSecondsiSeconds == "" "s" );
            
            
client_printidprint_chat"[AMXX] %s left before your ungag!"szInfo );
            
client_printidprint_center"** You are gagged from%s chat! **"bTeam " team" "" );
            
            return 
PLUGIN_HANDLED;
        }
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
CmdGagPlayer( const id, const iLevel, const iCid ) {
    if( !
cmd_accessidiLeveliCid) ) {
        
console_printid"Flags: a - Chat | b - Team Chat | c - Voice communications" );
        
        return 
PLUGIN_HANDLED;
    }
    
    new 
szArg32 ];
    
read_argv1szArg31 );
    
    new 
iPlayer cmd_targetidszArgCMDTARGET_OBEY_IMMUNITY CMDTARGET_NO_BOTS );
    
    if( !
iPlayer )
        return 
PLUGIN_HANDLED;
    
    new 
szName20 ];
    
get_user_nameiPlayerszName19 );
    
    if( 
TrieKeyExistsg_tArrayPosg_szAuthidiPlayer ] ) ) {
        
console_printid"User ^"%s^" is already gagged!"szName );
        
        return 
PLUGIN_HANDLED;
    }
    
    new 
szFlags], Float:flGagTime;
    
read_argv2szArg31 );
    
    if( !
szArg] ) { // No time entered
        
flGagTime DEFAULT_TIME;
        
        
formatexszFlags3"abc" );
    } else {
        if( 
is_str_numszArg ) ) { // Seconds entered
            
flGagTime floatstrszArg );
            
            if( 
flGagTime 86400.0 )
                
flGagTime 86400.0;
        } else {
            
console_printid"The value must be in seconds!" );
            
            return 
PLUGIN_HANDLED;
        }
        
        
read_argv3szArg31 );
        
        if( !
szArg] ) // No flag entered
            
formatexszFlags3"abc" );
        else
            
formatexszFlags3szArg );
    }
    
    new 
iFlags read_flagsszFlags );
    
    new 
dataGagData ];
    
dataGAG_START ] = _:get_gametime( );
    
dataGAG_TIME ]  = _:flGagTime;
    
dataGAG_FLAGS ] = iFlags;
    
copydataGAG_AUTHID ], 19g_szAuthidiPlayer ] );
    
    
TrieSetCellg_tArrayPosg_szAuthidiPlayer ], g_iGagged );
    
ArrayPushArrayg_aGagDatadata );
    
    new 
szFrom64 ];
    
    if( 
iFlags GAG_CHAT )
        
formatexszFrom63"say" );
    
    if( 
iFlags GAG_TEAMSAY ) {
        if( !
szFrom] )
            
formatexszFrom63"say_team" );
        else
            
formatszFrom63"%s / say_team"szFrom );
    }
    
    if( 
iFlags GAG_VOICE ) {
        
set_speakiPlayerSPEAK_MUTED );
        
        if( !
szFrom] )
            
formatexszFrom63"voicecomm" );
        else
            
formatszFrom63"%s / voicecomm"szFrom );
    }
    
    
g_iGagged++;
    
    new 
Float:flGametime get_gametime( ), Float:flNextThink;
    
flNextThink entity_get_floatg_iThinkerEV_FL_nextthink );
    
    if( !
flNextThink || flNextThink > ( flGametime flGagTime ) )
        
entity_set_floatg_iThinkerEV_FL_nextthinkflGametime flGagTime );
    
    new 
szInfo32 ], szAdmin20 ], iTime floatroundflGagTime ), iMinutes iTime 60iSeconds iTime 60;
    
get_user_nameidszAdmin19 );
    
    if( !
iMinutes )
        
formatexszInfo31"%i second%s"iSecondsiSeconds == "" "s" );
    else
        
formatexszInfo31"%i minute%s"iMinutesiMinutes == "" "s" );
    
    
show_activityidszAdmin"Has gagged %s from speaking for %s! (%s)"szNameszInfoszFrom );
    
    
console_printid"You have gagged ^"%s^" (%s) !"szNameszFrom );
    
    
log_amx"Gag: ^"%s<%s>^" has gagged ^"%s<%s>^" for %i minutes. (%s)"szAdming_szAuthidid ], szNameg_szAuthidiPlayer ], floatroundflGagTime 60 ), szFrom );
    
    return 
PLUGIN_HANDLED;
}

public 
CmdUnGagPlayer( const id, const iLevel, const iCid ) {
    if( !
cmd_accessidiLeveliCid) )
        return 
PLUGIN_HANDLED;
    
    new 
szArg32 ];
    
read_argv1szArg31 );
    
    if( 
equaliszArg"@all" ) ) {
        if( !
g_iGagged ) {
            
console_printid"No gagged players!" );
            
            return 
PLUGIN_HANDLED;
        }
        
        while( 
g_iGagged DeleteGag); // Excellent by Exolent
        
        
if( entity_get_floatg_iThinkerEV_FL_nextthink ) > 0.0 )
            
entity_set_floatg_iThinkerEV_FL_nextthink0.0 );
        
        
console_printid"You have ungagged all players!" );
        
        new 
szAdmin32 ];
        
get_user_nameidszAdmin31 );
        
        
show_activityidszAdmin"Has ungagged all players." );
        
        
log_amx"UnGag: ^"%s<%s>^" has ungagged all players."szAdming_szAuthidid ] );
        
        return 
PLUGIN_HANDLED;
    }
    
    new 
iPlayer cmd_targetidszArgCMDTARGET_OBEY_IMMUNITY CMDTARGET_NO_BOTS );
    
    if( !
iPlayer )
        return 
PLUGIN_HANDLED;
    
    new 
szName32 ];
    
get_user_nameiPlayerszName31 );
    
    new 
iArrayPos;
    if( !
TrieGetCellg_tArrayPosg_szAuthidiPlayer ], iArrayPos ) ) {
        
console_printid"User ^"%s^" is not gagged!"szName );
        
        return 
PLUGIN_HANDLED;
    }
    
    
DeleteGagiArrayPos );
    
    new 
szAdmin32 ];
    
get_user_nameidszAdmin31 );
    
    
show_activityidszAdmin"Has ungagged %s."szName );
    
    
console_printid"You have ungagged ^"%s^" !"szName );
    
    
log_amx"UnGag: ^"%s<%s>^" has ungagged ^"%s<%s>^""szAdming_szAuthidid ], szNameg_szAuthidiPlayer ] );
    
    return 
PLUGIN_HANDLED;
}

public 
CmdGagMenu( const id, const iLevel, const iCid ) {
    if( !
cmd_accessidiLeveliCid) )
        return 
PLUGIN_HANDLED;
    
    
g_iMenuOptionid ] = 0;
    
arraysetg_iMenuPlayersid ], 032 );
    
    
DisplayGagMenuidg_iMenuPositionid ] = );
    
    return 
PLUGIN_HANDLED;
}

public 
ActionGagMenu( const id, const iKey ) {
    switch( 
iKey ) {
        case 
7: {
            ++
g_iMenuOptionid ];
            
g_iMenuOptionid ] %= ArraySizeg_aGagTimes );
            
            
DisplayGagMenuidg_iMenuPositionid ] );
        }
        case 
8DisplayGagMenuid, ++g_iMenuPositionid ] );
        case 
9DisplayGagMenuid, --g_iMenuPositionid ] );
        default: {
            new 
iPlayer g_iMenuPlayersid ][ g_iMenuPositionid ] * iKey ];
            
            if( 
TrieKeyExistsg_tArrayPosg_szAuthidiPlayer ] ) )
                
client_cmdid"amx_ungag #%i"get_user_useridiPlayer ) );
            else
                
client_cmdid"amx_gag #%i %i"get_user_useridiPlayer ), ArrayGetCellg_aGagTimesg_iMenuOptionid ] ) );
            
            
DisplayGagMenuidg_iMenuPositionid ] );
        }
    }
}

// I just copied this from AMXX Ban menu, so don't blame me :D
DisplayGagMenu( const idiPosition ) {
    if( 
iPosition ) {
        
arraysetg_iMenuPlayersid ], 032 );
        
        return;
    }
    
    new 
iPlayers32 ], iNumiCountszMenu512 ], iPlayeriFlagsszName32 ];
    
get_playersiPlayersiNum"ch" ); // Ignore bots and hltv
    
    
new iStart iPosition 7;
    
    if( 
iStart >= iNum )
        
iStart iPosition g_iMenuPositionid ] = 0;
    
    new 
iEnd iStart 7iKeys MENU_KEY_0 MENU_KEY_8;
    new 
iLen formatexszMenu511g_bColoredMenus "\rGag Menu\R%i/%i\w^n^n" "Gag Menu %i %i^n^n"iPosition 1, ( iNum + ( ( iNum ) ? ) ) );
    
    if( 
iEnd iNum iEnd iNum;
    
    for( new 
iStartiEnd; ++) {
        
iPlayer iPlayers];
        
iFlags  get_user_flagsiPlayer );
        
get_user_nameiPlayerszName31 );
        
        if( 
iPlayer != id && iFlags ADMIN_IMMUNITY ) {
            ++
iCount;
            
            if( 
g_bColoredMenus )
                
iLen += formatexszMenuiLen ], 511 iLen"\d%i. %s^n"iCountszName );
            else
                
iLen += formatexszMenuiLen ], 511 iLen"#. %s^n"szName );
        } else {
            
iKeys |= ( << iCount );
            ++
iCount;
            
            
iLen += formatexszMenuiLen ], 511 iLeng_bColoredMenus "\r%i.\w %s\y%s\r%s^n" "%i. %s%s%s^n"iCountszNameTrieKeyExistsg_tArrayPosg_szAuthidiPlayer ] ) ? " GAGGED" "", ( ~iFlags ADMIN_USER " *" "" ) );
        }
    }
    
    
g_iMenuPlayersid ] = iPlayers;
    
    new 
iSeconds ArrayGetCellg_aGagTimesg_iMenuOptionid ] );
    new 
iTime    iSeconds 60;
    
    
iLen += formatexszMenuiLen ], 511 iLeng_bColoredMenus "^n\r8.\w Gag for\y %i\w %s^n" "^n8. Gag for %i %s^n", ( iSeconds 60 iTime iSeconds ), ( iSeconds 60 "minutes" "seconds" ) );
    
    if( 
iEnd != iNum ) {
        
formatexszMenuiLen ], 511 iLeng_bColoredMenus "^n\r9.\w More...^n\r0.\w %s" "^n9. More...^n0. %s"iPosition "Back" "Exit" );
        
iKeys |= MENU_KEY_9;
    } else
        
formatexszMenuiLen ], 511 iLeng_bColoredMenus "^n\r0.\w %s" "^n0. %s"iPosition "Back" "Exit" );
    
    
show_menuidiKeysszMenu, -1"Gag Menu" );
}

CheckGagFlag( const id, const iFlag ) {
    new 
iArrayPos;
    
    if( 
TrieGetCellg_tArrayPosg_szAuthidid ], iArrayPos ) ) {
        new 
dataGagData ];
        
ArrayGetArrayg_aGagDataiArrayPosdata );
        
        return ( 
dataGAG_FLAGS ] & iFlag );
    }
    
    return 
0;
}

DeleteGag( const iArrayPos ) {
    new 
dataGagData ];
    
ArrayGetArrayg_aGagDataiArrayPosdata );
    
    if( 
dataGAG_FLAGS ] & GAG_VOICE ) {
        new 
iPlayer find_player"c"dataGAG_AUTHID ] );
        if( 
is_user_connectediPlayer ) )
            
set_speakiPlayerSPEAK_NORMAL );
    }
    
    
TrieDeleteKeyg_tArrayPosdataGAG_AUTHID ] );
    
ArrayDeleteItemg_aGagDataiArrayPos );
    
g_iGagged--;
    
    for( new 
iArrayPosg_iGaggedi++ ) {
        
ArrayGetArrayg_aGagDataidata );
        
TrieSetCellg_tArrayPosdataGAG_AUTHID ], );
    }

This plugin currently works for the admin, but I want it to be for the VIP. Can you change the 'show activity' so it says 'VIP' instead of 'ADMIN'. Then finally can you change the flags the plugin works by, currently the user must have flags 'abc' in the 'users.ini' file. Can you set the plugin to work by custom flags? For example 'custom level F, G & H' which would be 'rst' in the 'users.ini'. Any custom flags that work are fine to use for me.

The purpose is that I can give this to VIP's without them appearing to be an admin and having access to immunity, reservation and the amx_kick command.

Thanks if your able to help me.
Gam3ronE is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-25-2011 , 14:46   Re: [REQ] Change This Approved Gag Menu Plugin
Reply With Quote #2

1.
PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < engine >

#define DEFAULT_TIME 600.0 // In Seconds

enum ( <<= ) {
    
GAG_CHAT 1,
    
GAG_TEAMSAY,
    
GAG_VOICE
};

enum _:GagData {
    
GAG_AUTHID20 ],
    
GAG_TIME,
    
GAG_START,
    
GAG_FLAGS
};

new 
g_szAuthid33 ][ 20 ];
new 
g_iThinkerg_iGagged;
new 
bool:g_bColoredMenusTrie:g_tArrayPos, Array:g_aGagData, Array:g_aGagTimes;
new 
g_iMenuOption33 ], g_iMenuPosition33 ], g_iMenuPlayers33 ][ 32 ];

public 
plugin_init( ) {
    
register_plugin"AMXX Gag""1.3 RC""xPaw & Exolent" );
    
    
register_clcmd"say",        "CmdSay" );
    
register_clcmd"say_team",   "CmdTeamSay" );
    
    
register_concmd"amx_gag",       "CmdGagPlayer",   ADMIN_KICK"<nick or #userid> <time> <a|b|c>" );
    
register_concmd"amx_ungag",     "CmdUnGagPlayer"ADMIN_KICK"<nick or #userid>" );
    
register_concmd"amx_gagmenu",   "CmdGagMenu",     ADMIN_KICK"- displays gag menu" );
    
register_srvcmd"amx_gag_times""CmdSetBanTimes" );
    
    
register_menucmdregister_menuid"Gag Menu" ), 1023"ActionGagMenu" );
    
register_messageget_user_msgid"SayText" ), "MessageSayText" );
    
    
g_tArrayPos TrieCreate( );
    
g_aGagData  ArrayCreateGagData );
    
g_aGagTimes ArrayCreate( );
    
g_bColoredMenus bool:colored_menus( );
    
    
// Gag times for the gag menu (amx_gagmenu)
    // Default values: 60 300 600 1800 3600 7200 86400
    
    // Load up standart times
    
ArrayPushCellg_aGagTimes60 );
    
ArrayPushCellg_aGagTimes300 );
    
ArrayPushCellg_aGagTimes600 );
    
ArrayPushCellg_aGagTimes1800 );
    
ArrayPushCellg_aGagTimes3600 );
    
ArrayPushCellg_aGagTimes7200 );
    
ArrayPushCellg_aGagTimes86400 );
    
    
// Set up entity-thinker
    
new const szClassname[ ] = "gag_thinker";
    
    
g_iThinker create_entity"info_target" );
    
entity_set_stringg_iThinkerEV_SZ_classnameszClassname );
    
    
register_thinkszClassname"FwdThink" );
}

public 
CmdSetBanTimes( ) {
    new 
iArgs read_argc( );
    
    if( 
iArgs <= ) {
        
server_print"Usage: amx_gag_times <time1> [time2] [time3] ..." );
        
        return;
    }
    
    
ArrayClearg_aGagTimes );
    
    new 
szBuffer32 ], iTime;
    for( new 
1iArgsi++ ) {
        
read_argviszBuffer31 );
        
        
iTime str_to_numszBuffer );
        
        if( 
iTime 86400 ) {
            
server_print"[AMXX GAG] Time more then 86400 is not allowed!" );
            
            continue;
        }
        
        
ArrayPushCellg_aGagTimesiTime );
    }
}

public 
plugin_end( ) {
    
TrieDestroyg_tArrayPos );
    
ArrayDestroyg_aGagData );
    
ArrayDestroyg_aGagTimes );
}

public 
client_putinserverid )
    if( 
CheckGagFlagidGAG_VOICE ) )
        
set_speakidSPEAK_MUTED );

public 
client_authorizedid )
    
get_user_authididg_szAuthidid ], 19 );

public 
client_disconnectid ) {
    if( 
TrieKeyExistsg_tArrayPosg_szAuthidid ] ) ) {
        new 
szName32 ];
        
get_user_nameidszName31 );
        
        new 
iPlayers32 ], iNumiPlayer;
        
get_playersiPlayersiNum"ch" );
        
        for( new 
iiNumi++ ) {
            
iPlayer iPlayers];
            
            if( 
get_user_flagsiPlayer ) & ADMIN_KICK )
                
client_printiPlayerprint_chat"[AMXX] Gagged player ^"%s<%s>^" has disconnected!"szNameg_szAuthidid ] );
        }
    }
    
    
g_szAuthidid ][ ] = '^0';
}

public 
client_infochangedid ) {
    if( !
CheckGagFlagid, ( GAG_CHAT GAG_TEAMSAY ) ) )
        return;
    
    static const 
name[ ] = "name";
    
    static 
szNewName32 ], szOldName32 ];
    
get_user_infoidnameszNewName31 );
    
get_user_nameidszOldName31 );
    
    if( !
equalszNewNameszOldName ) ) {
        
client_printidprint_chat"[AMXX] Gagged players cannot change their names!" );
        
        
set_user_infoidnameszOldName );
    }
}

public 
MessageSayText( ) {
    static const 
Cstrike_Name_Change[ ] = "#Cstrike_Name_Change";
    
    new 
szMessagesizeofCstrike_Name_Change ) + ];
    
get_msg_arg_string2szMessagesizeofszMessage ) - );
    
    if( 
equalszMessageCstrike_Name_Change ) ) {
        new 
szName32 ], id;
        for( new 
3<= 4i++ ) {
            
get_msg_arg_stringiszName31 );
            
            
id get_user_indexszName );
            
            if( 
is_user_connectedid ) ) {
                if( 
CheckGagFlagid, ( GAG_CHAT GAG_TEAMSAY ) ) )
                    return 
PLUGIN_HANDLED;
                
                break;
            }
        }
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
FwdThink( const iEntity ) {
    if( !
g_iGagged )
        return;
    
    new 
Float:fGametime;
    
fGametime get_gametime( );
    
    new 
dataGagData ], idszName32 ];
    for( new 
0g_iGaggedi++ ) {
        
ArrayGetArrayg_aGagDataidata );
        
        if( ( 
Float:dataGAG_START ] + Float:dataGAG_TIME ] - 0.5 ) <= fGametime ) {
            
id find_player"c"dataGAG_AUTHID ] );
            
            if( 
is_user_connectedid ) ) {
                
get_user_nameidszName31 );
                
                
client_print0print_chat"[AMXX] Player ^"%s^" is no longer gagged."szName );
            }
            
            
DeleteGag);
            
            
i--;
        }
    }
    
    if( !
g_iGagged )
        return;
    
    new 
Float:flNextTime 999999.9;
    for( new 
0g_iGaggedi++ ) {
        
ArrayGetArrayg_aGagDataidata );
        
        
flNextTime floatminflNextTimeFloat:dataGAG_START ] + Float:dataGAG_TIME ] );
    }
    
    
entity_set_floatiEntityEV_FL_nextthinkflNextTime );
}

public 
CmdSay( const id )
    return 
CheckSayid);

public 
CmdTeamSay( const id )
    return 
CheckSayid);

CheckSay( const id, const bTeam ) {
    new 
iArrayPos;
    if( 
TrieGetCellg_tArrayPosg_szAuthidid ], iArrayPos ) ) {
        new 
dataGagData ];
        
ArrayGetArrayg_aGagDataiArrayPosdata );
        
        new const 
iFlags[ ] = { GAG_CHATGAG_TEAMSAY };
        
        if( 
dataGAG_FLAGS ] & iFlagsbTeam ] ) {
            new 
szInfo32 ], iLeniTime floatround( ( Float:dataGAG_START ] + Float:dataGAG_TIME ] ) - get_gametime( ) ), iMinutes iTime 60iSeconds iTime 60;
            
            if( 
iMinutes )
                
iLen formatexszInfo31"%i minute%s"iMinutesiMinutes == "" "s" );
            if( 
iSeconds )
                
formatexszInfoiLen ], 31 iLen"%s%i second%s"iLen " and " ""iSecondsiSeconds == "" "s" );
            
            
client_printidprint_chat"[AMXX] %s left before your ungag!"szInfo );
            
client_printidprint_center"** You are gagged from%s chat! **"bTeam " team" "" );
            
            return 
PLUGIN_HANDLED;
        }
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
CmdGagPlayer( const id, const iLevel, const iCid ) {
    if( !
cmd_accessidiLeveliCid) ) {
        
console_printid"Flags: a - Chat | b - Team Chat | c - Voice communications" );
        
        return 
PLUGIN_HANDLED;
    }
    
    new 
szArg32 ];
    
read_argv1szArg31 );
    
    new 
iPlayer cmd_targetidszArgCMDTARGET_OBEY_IMMUNITY CMDTARGET_NO_BOTS );
    
    if( !
iPlayer )
        return 
PLUGIN_HANDLED;
    
    new 
szName20 ];
    
get_user_nameiPlayerszName19 );
    
    if( 
TrieKeyExistsg_tArrayPosg_szAuthidiPlayer ] ) ) {
        
console_printid"User ^"%s^" is already gagged!"szName );
        
        return 
PLUGIN_HANDLED;
    }
    
    new 
szFlags], Float:flGagTime;
    
read_argv2szArg31 );
    
    if( !
szArg] ) { // No time entered
        
flGagTime DEFAULT_TIME;
        
        
formatexszFlags3"abc" );
    } else {
        if( 
is_str_numszArg ) ) { // Seconds entered
            
flGagTime floatstrszArg );
            
            if( 
flGagTime 86400.0 )
                
flGagTime 86400.0;
        } else {
            
console_printid"The value must be in seconds!" );
            
            return 
PLUGIN_HANDLED;
        }
        
        
read_argv3szArg31 );
        
        if( !
szArg] ) // No flag entered
            
formatexszFlags3"abc" );
        else
            
formatexszFlags3szArg );
    }
    
    new 
iFlags read_flagsszFlags );
    
    new 
dataGagData ];
    
dataGAG_START ] = _:get_gametime( );
    
dataGAG_TIME ]  = _:flGagTime;
    
dataGAG_FLAGS ] = iFlags;
    
copydataGAG_AUTHID ], 19g_szAuthidiPlayer ] );
    
    
TrieSetCellg_tArrayPosg_szAuthidiPlayer ], g_iGagged );
    
ArrayPushArrayg_aGagDatadata );
    
    new 
szFrom64 ];
    
    if( 
iFlags GAG_CHAT )
        
formatexszFrom63"say" );
    
    if( 
iFlags GAG_TEAMSAY ) {
        if( !
szFrom] )
            
formatexszFrom63"say_team" );
        else
            
formatszFrom63"%s / say_team"szFrom );
    }
    
    if( 
iFlags GAG_VOICE ) {
        
set_speakiPlayerSPEAK_MUTED );
        
        if( !
szFrom] )
            
formatexszFrom63"voicecomm" );
        else
            
formatszFrom63"%s / voicecomm"szFrom );
    }
    
    
g_iGagged++;
    
    new 
Float:flGametime get_gametime( ), Float:flNextThink;
    
flNextThink entity_get_floatg_iThinkerEV_FL_nextthink );
    
    if( !
flNextThink || flNextThink > ( flGametime flGagTime ) )
        
entity_set_floatg_iThinkerEV_FL_nextthinkflGametime flGagTime );
    
    new 
szInfo32 ], szAdmin20 ], iTime floatroundflGagTime ), iMinutes iTime 60iSeconds iTime 60;
    
get_user_nameidszAdmin19 );
    
    if( !
iMinutes )
        
formatexszInfo31"%i second%s"iSecondsiSeconds == "" "s" );
    else
        
formatexszInfo31"%i minute%s"iMinutesiMinutes == "" "s" );
    
    
_show_activityidszAdmin"Has gagged %s from speaking for %s! (%s)"szNameszInfoszFrom );
    
    
console_printid"You have gagged ^"%s^" (%s) !"szNameszFrom );
    
    
log_amx"Gag: ^"%s<%s>^" has gagged ^"%s<%s>^" for %i minutes. (%s)"szAdming_szAuthidid ], szNameg_szAuthidiPlayer ], floatroundflGagTime 60 ), szFrom );
    
    return 
PLUGIN_HANDLED;
}

public 
CmdUnGagPlayer( const id, const iLevel, const iCid ) {
    if( !
cmd_accessidiLeveliCid) )
        return 
PLUGIN_HANDLED;
    
    new 
szArg32 ];
    
read_argv1szArg31 );
    
    if( 
equaliszArg"@all" ) ) {
        if( !
g_iGagged ) {
            
console_printid"No gagged players!" );
            
            return 
PLUGIN_HANDLED;
        }
        
        while( 
g_iGagged DeleteGag); // Excellent by Exolent
        
        
if( entity_get_floatg_iThinkerEV_FL_nextthink ) > 0.0 )
            
entity_set_floatg_iThinkerEV_FL_nextthink0.0 );
        
        
console_printid"You have ungagged all players!" );
        
        new 
szAdmin32 ];
        
get_user_nameidszAdmin31 );
        
        
show_activityidszAdmin"Has ungagged all players." );
        
        
log_amx"UnGag: ^"%s<%s>^" has ungagged all players."szAdming_szAuthidid ] );
        
        return 
PLUGIN_HANDLED;
    }
    
    new 
iPlayer cmd_targetidszArgCMDTARGET_OBEY_IMMUNITY CMDTARGET_NO_BOTS );
    
    if( !
iPlayer )
        return 
PLUGIN_HANDLED;
    
    new 
szName32 ];
    
get_user_nameiPlayerszName31 );
    
    new 
iArrayPos;
    if( !
TrieGetCellg_tArrayPosg_szAuthidiPlayer ], iArrayPos ) ) {
        
console_printid"User ^"%s^" is not gagged!"szName );
        
        return 
PLUGIN_HANDLED;
    }
    
    
DeleteGagiArrayPos );
    
    new 
szAdmin32 ];
    
get_user_nameidszAdmin31 );
    
    
_show_activityidszAdmin"Has ungagged %s."szName );
    
    
console_printid"You have ungagged ^"%s^" !"szName );
    
    
log_amx"UnGag: ^"%s<%s>^" has ungagged ^"%s<%s>^""szAdming_szAuthidid ], szNameg_szAuthidiPlayer ] );
    
    return 
PLUGIN_HANDLED;
}

public 
CmdGagMenu( const id, const iLevel, const iCid ) {
    if( !
cmd_accessidiLeveliCid) )
        return 
PLUGIN_HANDLED;
    
    
g_iMenuOptionid ] = 0;
    
arraysetg_iMenuPlayersid ], 032 );
    
    
DisplayGagMenuidg_iMenuPositionid ] = );
    
    return 
PLUGIN_HANDLED;
}

public 
ActionGagMenu( const id, const iKey ) {
    switch( 
iKey ) {
        case 
7: {
            ++
g_iMenuOptionid ];
            
g_iMenuOptionid ] %= ArraySizeg_aGagTimes );
            
            
DisplayGagMenuidg_iMenuPositionid ] );
        }
        case 
8DisplayGagMenuid, ++g_iMenuPositionid ] );
        case 
9DisplayGagMenuid, --g_iMenuPositionid ] );
        default: {
            new 
iPlayer g_iMenuPlayersid ][ g_iMenuPositionid ] * iKey ];
            
            if( 
TrieKeyExistsg_tArrayPosg_szAuthidiPlayer ] ) )
                
client_cmdid"amx_ungag #%i"get_user_useridiPlayer ) );
            else
                
client_cmdid"amx_gag #%i %i"get_user_useridiPlayer ), ArrayGetCellg_aGagTimesg_iMenuOptionid ] ) );
            
            
DisplayGagMenuidg_iMenuPositionid ] );
        }
    }
}

// I just copied this from AMXX Ban menu, so don't blame me :D
DisplayGagMenu( const idiPosition ) {
    if( 
iPosition ) {
        
arraysetg_iMenuPlayersid ], 032 );
        
        return;
    }
    
    new 
iPlayers32 ], iNumiCountszMenu512 ], iPlayeriFlagsszName32 ];
    
get_playersiPlayersiNum"ch" ); // Ignore bots and hltv
    
    
new iStart iPosition 7;
    
    if( 
iStart >= iNum )
        
iStart iPosition g_iMenuPositionid ] = 0;
    
    new 
iEnd iStart 7iKeys MENU_KEY_0 MENU_KEY_8;
    new 
iLen formatexszMenu511g_bColoredMenus "\rGag Menu\R%i/%i\w^n^n" "Gag Menu %i %i^n^n"iPosition 1, ( iNum + ( ( iNum ) ? ) ) );
    
    if( 
iEnd iNum iEnd iNum;
    
    for( new 
iStartiEnd; ++) {
        
iPlayer iPlayers];
        
iFlags  get_user_flagsiPlayer );
        
get_user_nameiPlayerszName31 );
        
        if( 
iPlayer != id && iFlags ADMIN_IMMUNITY ) {
            ++
iCount;
            
            if( 
g_bColoredMenus )
                
iLen += formatexszMenuiLen ], 511 iLen"\d%i. %s^n"iCountszName );
            else
                
iLen += formatexszMenuiLen ], 511 iLen"#. %s^n"szName );
        } else {
            
iKeys |= ( << iCount );
            ++
iCount;
            
            
iLen += formatexszMenuiLen ], 511 iLeng_bColoredMenus "\r%i.\w %s\y%s\r%s^n" "%i. %s%s%s^n"iCountszNameTrieKeyExistsg_tArrayPosg_szAuthidiPlayer ] ) ? " GAGGED" "", ( ~iFlags ADMIN_USER " *" "" ) );
        }
    }
    
    
g_iMenuPlayersid ] = iPlayers;
    
    new 
iSeconds ArrayGetCellg_aGagTimesg_iMenuOptionid ] );
    new 
iTime    iSeconds 60;
    
    
iLen += formatexszMenuiLen ], 511 iLeng_bColoredMenus "^n\r8.\w Gag for\y %i\w %s^n" "^n8. Gag for %i %s^n", ( iSeconds 60 iTime iSeconds ), ( iSeconds 60 "minutes" "seconds" ) );
    
    if( 
iEnd != iNum ) {
        
formatexszMenuiLen ], 511 iLeng_bColoredMenus "^n\r9.\w More...^n\r0.\w %s" "^n9. More...^n0. %s"iPosition "Back" "Exit" );
        
iKeys |= MENU_KEY_9;
    } else
        
formatexszMenuiLen ], 511 iLeng_bColoredMenus "^n\r0.\w %s" "^n0. %s"iPosition "Back" "Exit" );
    
    
show_menuidiKeysszMenu, -1"Gag Menu" );
}

CheckGagFlag( const id, const iFlag ) {
    new 
iArrayPos;
    
    if( 
TrieGetCellg_tArrayPosg_szAuthidid ], iArrayPos ) ) {
        new 
dataGagData ];
        
ArrayGetArrayg_aGagDataiArrayPosdata );
        
        return ( 
dataGAG_FLAGS ] & iFlag );
    }
    
    return 
0;
}

DeleteGag( const iArrayPos ) {
    new 
dataGagData ];
    
ArrayGetArrayg_aGagDataiArrayPosdata );
    
    if( 
dataGAG_FLAGS ] & GAG_VOICE ) {
        new 
iPlayer find_player"c"dataGAG_AUTHID ] );
        if( 
is_user_connectediPlayer ) )
            
set_speakiPlayerSPEAK_NORMAL );
    }
    
    
TrieDeleteKeyg_tArrayPosdataGAG_AUTHID ] );
    
ArrayDeleteItemg_aGagDataiArrayPos );
    
g_iGagged--;
    
    for( new 
iArrayPosg_iGaggedi++ ) {
        
ArrayGetArrayg_aGagDataidata );
        
TrieSetCellg_tArrayPosdataGAG_AUTHID ], );
    }
}

stock _show_activityid, const name[], const fmt[], any:... ) 
{
    static 
__amx_show_activity;
    if (
__amx_show_activity == 0)
    {
        
__amx_show_activity get_cvar_pointer("amx_show_activity");
    
        
// if still not found, then register the cvar as a dummy
        
if (__amx_show_activity == 0)
        {
            
__amx_show_activity register_cvar("amx_show_activity""2");
        }
    }
#if defined AMXMOD_BCOMPAT
    
new buffer[128];
    
format_argsbuffer 127 );
#else
    
    
new buffer[512];
    
vformat(buffercharsmax(buffer), fmt4);
#endif
    
switch(get_pcvar_num(__amx_show_activity))
    {
#if defined AMXMOD_BCOMPAT
        
case 2// show name to all
        
{
            
client_print(0print_chat"%s %s: %s"is_user_admin(id) ? SIMPLE_T("ADMIN") : SIMPLE_T("PLAYER"), namebuffer);
        }
        case 
1// hide name to all
        
{
            
client_print(0print_chat"%s: %s"is_user_admin(id) ? SIMPLE_T("ADMIN") : SIMPLE_T("PLAYER"), buffer);
        }
#else
        
case 5// hide name only to admins, show nothing to normal users
        
{
            new 
__maxclients=get_maxplayers();
            
            
            for (new 
i=1i<=__maxclientsi++)
            {
                if (
is_user_connected(i))
                {
                    if (
is_user_admin(i))
                    {
                        
client_print(iprint_chat"VIP: %s"buffer);
                    }
                }
            }
        }
        case 
4// show name only to admins, show nothing to normal users
        
{
            new 
__maxclients=get_maxplayers();
            
            for (new 
i=1i<=__maxclientsi++)
            {
                if (
is_user_connected(i))
                {
                    if (
is_user_admin(i))
                    {
                        
client_print(iprint_chat"VIP %s: %s"namebuffer);
                    }
                }
            }
        }
        case 
3// show name only to admins, hide name from normal users
        
{
            new 
__maxclients=get_maxplayers();
            
            for (new 
i=1i<=__maxclientsi++)
            {
                if (
is_user_connected(i))
                {
                    if (
is_user_admin(i))
                    {
                        
client_print(iprint_chat"VIP %s: %s"namebuffer);
                    }
                    else
                    {
                        
client_print(iprint_chat"VIP: %s"buffer);
                    }
                }
            }
        }
        case 
2// show name to all
        
{
            
client_print(0print_chat"VIP %s: %s"name buffer );
        }
        case 
1// hide name to all
        
{
            
client_print(0print_chat"VIP: %s"buffer );
        }
#endif
    
}

2. Change flags in addons/amxmodx/configs/cmdaccess.ini
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 01-26-2011 at 13:55.
Exolent[jNr] is offline
Gam3ronE
SourceMod Donor
Join Date: Aug 2010
Old 01-26-2011 , 11:35   Re: [REQ] Change This Approved Gag Menu Plugin
Reply With Quote #3

Thank you so much friend. Without testing I'm pretty sure this will actually work because of you're a well respected moderator here, I appreciate your work.

If you would like to help with some other simple plugin ideas which I have in mind, or even changes to working plugins that I may like to have done, I'm willing to pay you via PayPal for each, upfront of course. If you're willing just send me a PM. Have a great day!
Gam3ronE is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-26-2011 , 13:57   Re: [REQ] Change This Approved Gag Menu Plugin
Reply With Quote #4

Fixed the amx_gag not showing the VIP message.
Also, continue further conversation about private work in PMs.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
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 19:58.


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