Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //-------------------- Includes --------------------//
- #include < amxmodx >
- #include < fakemeta >
- //-------------------- Defines --------------------//
- #define Prefix "AMXX"
- #define ACCESS_ADMIN ADMIN_IMMUNITY
- //-------------------- Functions --------------------//
- enum { CHAT, VOICE, ASKFOR }
- new bool:muteall[ 33 ], bool:mutesystem[ 33 ][ 33 ][ 3 ], bool:sortmenu[ 33 ]
- new askforremove[ 33 ], whoaskme[ 33 ], adminremember[ 33 ]
- //-------------------- Plugin init --------------------//
- public plugin_init()
- {
- register_plugin( "advanced mute menu", "v1.0", "RanAway`" )
- //-------------------- Commands --------------------//
- register_clcmd( "say /mute", "mainmenu" )
- register_message( get_user_msgid( "SayText" ), "Chat" ) //------ chat --------//
- register_forward( FM_Voice_SetClientListening, "Voice" ) //------ voice --------//
- }
- //-------------------- chat --------------------//
- public Chat( Msgid, Msgdest, id )
- {
- new player = get_msg_arg_int( 1 )
- if( is_user_connected( player ) && mutesystem[ id ][ player ][ CHAT ] ) return 1
- return 0
- }
- //-------------------- voice --------------------//
- public Voice( Rec, Send, List )
- {
- if( Rec == Send ) return FMRES_IGNORED
- if( mutesystem[ Rec ][ Send ][ VOICE ] )
- {
- engfunc( EngFunc_SetClientListening, Rec, Send, 0 )
- return FMRES_SUPERCEDE
- }
- return FMRES_IGNORED
- }
- //-------------------- main menu --------------------//
- public mainmenu( id )
- {
- //-------------------- to prevent heap low --------------------//
- if( !is_user_connected( id ) ) return 1
- new item[ 512 ], bool:blocksee = true, menu = menu_create( fmt( "\r[\w %s \r]\w mute menu", Prefix ), "sub_mainmenu" )
- //----- Block "see who muted you" if no one is muted you -----//
- for( new i = 1; i <= get_maxplayers(); i++ ) if( mutesystem[ i ][ id ][ VOICE ] || mutesystem[ i ][ id ][ CHAT ] ) blocksee = false
- get_playersnum() > 1 ? menu_additem( menu, "voice" ) : menu_addtext2( menu, "\r1. \dvoice" )
- get_playersnum() > 1 ? menu_additem( menu, "chat^n" ) : menu_addtext2( menu, "\r2. \dchat^n" )
- formatex( item, charsmax( item ), "%s%smute everyone^n", get_playersnum() > 1 ? "" : "\r3. \d", muteall[ id ] ? "un" : "" )
- get_playersnum() > 1 ? menu_additem( menu, item ) : menu_addtext2( menu, item )
- blocksee ? menu_addtext2( menu, "\r4. \dsee who muted you" ) : menu_additem( menu, "see who muted you" )
- get_user_flags( id ) & ACCESS_ADMIN ? menu_additem( menu, "admin options" ) : menu_addtext2( menu, "\r5. \dadmin options" )
- menu_display( id, menu )
- return 1
- }
- public sub_mainmenu( id, menu, item )
- {
- if( item == MENU_EXIT ) return menu_destroy( menu )
- if( item == 0 ) sortmenu[ id ] = true // Change the menu to voice
- if( item == 1 ) sortmenu[ id ] = false // Change the menu to chat
- if( item == 2 ) // Mute everyone
- {
- muteall[ id ] ^= true
- ColorChat( id, "You've ^3%smuted^1 everyone.", muteall[ id ] ? "" : "un" )
- for( new i = 1; i <= get_maxplayers(); i++ )
- {
- //-------------------- If the player is not connected or you or bot or hltv --------------------//
- if( !is_user_connected( i ) || is_user_bot( i ) || is_user_hltv( i ) || i == id ) continue
- mutesystem[ id ][ i ][ CHAT ] = muteall[ id ]
- mutesystem[ id ][ i ][ VOICE ] = muteall[ id ]
- mutesystem[ i ][ id ][ ASKFOR ] = false
- }
- return mainmenu( id )
- }
- if( item == 3 ) return whomutememenu( id, 0 ) // See who mute you
- if( item == 4 ) return adminmenu( id ) // Admin menu
- return mutemenu( id, 0 ) // Open the mute menu
- }
- //-------------------- mute menu --------------------//
- public mutemenu( id, page )
- {
- //-------------------- to prevent heap low --------------------//
- if( !is_user_connected( id ) ) return 1
- new data[ 6 ], menu = menu_create( fmt( "\r[\w %s \r]\w mute %s", Prefix, sortmenu[ id ] ? "voice" : "chat" ), "sub_mutemenu" )
- for( new i = 1; i <= get_maxplayers(); i++ )
- {
- //-------------------- If the player is not connected or you or bot or hltv --------------------//
- if( !is_user_connected( i ) || is_user_bot( i ) || is_user_hltv( i ) || i == id ) continue
- num_to_str( i, data, charsmax( data ) )
- menu_additem( menu, fmt( "%n \d%s", i, ( sortmenu[ id ] && mutesystem[ id ][ i ][ VOICE ] ) || ( !sortmenu[ id ] && mutesystem[ id ][ i ][ CHAT ] ) ? "- [\r muted \d]" : "" ), data )
- }
- //-------------------- Previous / Next / Exit --------------------//
- menu_setprop( menu, MPROP_BACKNAME, "previous page" )
- menu_setprop( menu, MPROP_NEXTNAME, "next page" )
- menu_setprop( menu, MPROP_EXITNAME, "back" )
- menu_display( id, menu, page )
- return 1
- }
- public sub_mutemenu( id, menu, item )
- {
- if( item == MENU_EXIT ) return mainmenu( id )
- new data[ 6 ], page
- menu_item_getinfo( menu, item, _, data, charsmax( data ) )
- player_menu_info( id, menu, menu, page )
- new player = str_to_num( data )
- //-------------------- If the player is not connected --------------------//
- if( !is_user_connected( player ) ) return ColorChat( id, "^3%n^1 is no longer connected.", player ), mutemenu( id, page )
- if( sortmenu[ id ] )
- {
- mutesystem[ id ][ player ][ VOICE ] = !mutesystem[ id ][ player ][ VOICE ]
- ColorChat( id, mutesystem[ id ][ player ][ VOICE ] ? "you canno't hear ^3%n^1 until you remove his mute." : "you can hear ^3%n^1 now.", player )
- }
- else if( !sortmenu[ id ] )
- {
- mutesystem[ id ][ player ][ CHAT ] = !mutesystem[ id ][ player ][ CHAT ]
- ColorChat( id, mutesystem[ id ][ player ][ CHAT ] ? "you canno't see what ^3%n^1 write until you remove his mute." : "you can see what ^3%n^1 write now.", player )
- }
- //---------- If there is even a single player you didnt mute on ( voice / chat ) turn the "Mute everyone" off ------//
- for( new i= 1; i <= get_maxplayers(); i++ ) if( !mutesystem[ id ][ i ][ VOICE ] && !mutesystem[ id ][ i ][ CHAT ] ) muteall[ id ] = false
- //---------- If the player that you muted has asked you to remove his mute it will remove his block ----------------//
- mutesystem[ id ][ player ][ ASKFOR ] = false
- return mutemenu( id, page )
- }
- //-------------------- See who mute you --------------------//
- public whomutememenu( id, page )
- {
- //-------------------- to prevent heap low --------------------//
- if( !is_user_connected( id ) ) return 1
- new item[ 256 ], data[ 6 ], menu = menu_create( fmt( "\r[\w %s \r]\w see who muted you", Prefix ), "sub_whomenu" )
- for( new i = 1, counter = -1; i <= get_maxplayers(); i++ )
- {
- //-------------------- If the player is not connected or yourself or bot or hltv or not muted you --------------------//
- if( !is_user_connected( i ) || i == id || is_user_bot( i ) || is_user_hltv( i ) || ( !mutesystem[ i ][ id ][ VOICE ] && !mutesystem[ i ][ id ][ CHAT ] ) ) continue
- num_to_str( i, data, charsmax( data ) )
- formatex( item, charsmax( item ), "%n \r[\w %s%s%s \r]%s", i,
- mutesystem[ i ][ id ][ VOICE ] ? "Voice" : "", mutesystem[ i ][ id ][ VOICE ] && mutesystem[ i ][ id ][ CHAT ] ? " \y&\w " : "",
- mutesystem[ i ][ id ][ CHAT ] ? "Chat" : "", mutesystem[ id ][ i ][ ASKFOR ] ? " \d- \wignored your request" : "" )
- mutesystem[ id ][ i ][ ASKFOR ] ? menu_addtext2( menu, fmt( "\r%d. \d%s", ++counter % 6, item ) ) : menu_additem( menu, item, data )
- }
- //-------------------- Previous / Next / Exit --------------------//
- menu_setprop( menu, MPROP_BACKNAME, "previous page" )
- menu_setprop( menu, MPROP_NEXTNAME, "next page" )
- menu_setprop( menu, MPROP_EXITNAME, "back" )
- menu_display( id, menu, page )
- return 1
- }
- public sub_whomenu( id, menu, item )
- {
- if( item == MENU_EXIT ) return mainmenu( id )
- new data[ 6 ], page
- menu_item_getinfo( menu, item, _, data, charsmax( data ) )
- player_menu_info( id, menu, menu, page )
- //-------------------- If the player is not connected --------------------//
- if( !is_user_connected( str_to_num( data ) ) )
- {
- ColorChat( id, "^3%n^1 is no longer connected.", str_to_num( data ) )
- return mainmenu( id )
- }
- askforremove[ id ] = str_to_num( data )
- mutesystem[ id ][ askforremove[ id ] ][ ASKFOR ] = true // Block after you asked
- whoaskme[ askforremove[ id ] ] = id // Show who ask for remove
- acceptionmenu( askforremove[ id ] ) // Open menu for the player you asked
- return whomutememenu( id, page )
- }
- //-------------------- Acception menu --------------------//
- public acceptionmenu( id )
- {
- //-------------------- to prevent heap low --------------------//
- if( !is_user_connected( id ) ) return 1
- new menu = menu_create( fmt( "\r[\w %s \r] \r%n\w ask you to remove his mute", Prefix, whoaskme[ id ] ), "sub_acceptionmenu" )
- menu_additem( menu, "accept" )
- menu_additem( menu, "ignore" )
- menu_setprop( menu, MPROP_EXIT, MEXIT_NEVER )
- menu_display( id, menu, .time = 10 )
- return 1
- }
- public sub_acceptionmenu( id, menu, item )
- {
- if( item == MENU_EXIT ) menu_destroy( menu )
- //-------------------- Accept the request --------------------//
- if( item == 0 )
- {
- mutesystem[ id ][ whoaskme[ id ] ][ VOICE ] = false
- mutesystem[ id ][ whoaskme[ id ] ][ CHAT ] = false
- mutesystem[ id ][ whoaskme[ id ] ][ ASKFOR ] = false
- muteall[ id ] = false
- ColorChat( whoaskme[ id ], "^3%n^1 has accept your request and remove your mute.", askforremove[ id ] )
- return ColorChat( id, "You accept ^3%n^1 request and remove his mute.", whoaskme[ id ] )
- }
- //-------------------- Ignore the request --------------------//
- ColorChat( whoaskme[ id ], "^3%n^1 has ignored your request to remove your mute.", askforremove[ id ] )
- return ColorChat( id, "You ignored ^3%n^1 request to remove his mute.", whoaskme[ id ] )
- }
- //-------------------- Admin menu --------------------//
- public adminmenu( id )
- {
- //-------------------- Access to the menu & to prevent heap low --------------------//
- if( ~get_user_flags( id ) & ACCESS_ADMIN || !is_user_connected( id ) ) return 0
- new bool:blockwhosee = true, bool:blocksee = true, menu = menu_create( fmt( "\r[\w %s \r]\w admin menu", Prefix ), "sub_adminmenu" )
- //-------------------- Block "Show everyone's mute" if no one is muted --------------------//
- for( new i = 1; i <= get_maxplayers(); i++ ) for( new j = 1; j <= get_maxplayers(); j++ )
- if( mutesystem[ i ][ j ][ VOICE ] || mutesystem[ i ][ j ][ CHAT ] ) blockwhosee = false
- //----- Block "remove everyone's mute on you" if no one is muted you -----//
- for( new i = 1; i <= get_maxplayers(); i++ ) if( mutesystem[ i ][ id ][ VOICE ] || mutesystem[ i ][ id ][ CHAT ] ) blocksee = false
- blockwhosee ? menu_addtext2( menu, "\r1. \dremove \reveryone's\d mutes" ) : menu_additem( menu, "remove \reveryone's\w mutes" )
- blocksee ? menu_addtext2( menu, "\r2. \dremove \reveryone's\d mute on you^n" ) : menu_additem( menu, "remove \reveryone's\w mute on you^n" )
- blockwhosee ? menu_addtext2( menu, "\r3. \dshow everyone's mutes in menu" ) : menu_additem( menu, "show everyone's mutes in menu" )
- get_playersnum() > 1 ? menu_additem( menu, "mute someone for someone else" ) : menu_addtext2( menu, "\r4. \dmute someone for someone else" )
- menu_setprop( menu, MPROP_EXITNAME, "back" )
- menu_display( id, menu )
- return 1
- }
- public sub_adminmenu( id, menu, item )
- {
- if( item == MENU_EXIT ) return mainmenu( id )
- //-------------------- Remove everyone's mutes --------------------//
- if( item == 0 )
- {
- ColorChat( 0, "Everyone's ^3mutes^1 has been ^3removed^1." )
- for( new i = 1; i <= get_maxplayers(); i++ )
- {
- //-------------------- If the player is not connected or bot or hltv --------------------//
- if( !is_user_connected( i ) || is_user_bot( i ) || is_user_hltv( i ) ) continue
- for( new j = 1; j <= get_maxplayers(); j++ )
- {
- //-------------------- If the player is not connected or bot or hltv --------------------//
- if( !is_user_connected( j ) || is_user_bot( j ) || is_user_hltv( j ) ) continue
- mutesystem[ i ][ j ][ VOICE ] = false
- mutesystem[ i ][ j ][ CHAT ] = false
- mutesystem[ i ][ j ][ ASKFOR ] = false
- muteall[ i ] = false
- }
- }
- }
- //-------------------- Remove everyone's mutes on you --------------------//
- if( item == 1 )
- {
- ColorChat( id, "Everyone's ^3mutes^1 on you has been ^3removed^1." )
- for( new i = 1; i <= get_maxplayers(); i++ )
- {
- //-------------------- If the player is not connected or bot or hltv --------------------//
- if( !is_user_connected( i ) || is_user_bot( i ) || is_user_hltv( i ) ) continue
- mutesystem[ i ][ id ][ VOICE ] = false
- mutesystem[ i ][ id ][ CHAT ] = false
- mutesystem[ i ][ id ][ ASKFOR ] = false
- muteall[ i ] = false
- }
- }
- if( item == 2 ) return showmutes( id ) // Show who has mute who
- if( item == 3 ) return showmutesforothers( id ) // Put mute for others
- return adminmenu( id )
- }
- //-------------------- Show players mute menu --------------------//
- public showmutes( id )
- {
- //-------------------- Access to the menu & to prevent heap low --------------------//
- if( ~get_user_flags( id ) & ACCESS_ADMIN || !is_user_connected( id ) ) return 0
- new data[ 6 ], menu = menu_create( fmt( "\r[\w %s \r]\w show players that mute someone", Prefix ), "sub_showmutes" )
- for( new i = 1; i <= get_maxplayers(); i++ )
- {
- //-------------------- If the player is not connected or bot or hltv --------------------//
- if( !is_user_connected( i ) || is_user_bot( i ) || is_user_hltv( i ) ) continue
- for( new j = 1; j <= get_maxplayers(); j++ )
- {
- //-------------------- If the player is not connected or yourself or not have mute on someone or bot or hltv --------------------//
- if( !is_user_connected( j ) || is_user_bot( j ) || is_user_hltv( j ) || ( !mutesystem[ i ][ j ][ VOICE ] && !mutesystem[ i ][ j ][ CHAT ] ) || i == j ) continue
- num_to_str( i, data, charsmax( data ) )
- menu_additem( menu, fmt( "%n", i ), data )
- }
- }
- //-------------------- Previous / Next / Exit --------------------//
- menu_setprop( menu, MPROP_BACKNAME, "previous page" )
- menu_setprop( menu, MPROP_NEXTNAME, "next page" )
- menu_setprop( menu, MPROP_EXITNAME, "back" )
- menu_display( id, menu )
- return 1
- }
- public sub_showmutes( id, menu, item )
- {
- if( item == MENU_EXIT ) return adminmenu( id )
- new data[ 6 ]
- menu_item_getinfo( menu, item, _, data, charsmax( data ) )
- return adminremember[ id ] = str_to_num( data ), showplayermutes( id, 0 )
- }
- //-------------------- Show players mutes --------------------//
- public showplayermutes( id, page )
- {
- //-------------------- Access to the menu & to prevent heap low --------------------//
- if( ~get_user_flags( id ) & ACCESS_ADMIN || !is_user_connected( id ) ) return 0
- new data[ 6 ], menu = menu_create( fmt( "\r[\w %s \r]\w show \r%n\w mutes", Prefix, adminremember[ id ] ), "sub_showplayermutes" )
- for( new i = 1, counter = -1; i <= get_maxplayers(); i++ )
- {
- //-------------------- If the player is not connected or not have mute on someone or bot or hltv --------------------//
- if( !is_user_connected( i ) || is_user_bot( i ) || is_user_hltv( i ) || ( !mutesystem[ adminremember[ id ] ][ i ][ VOICE ] && !mutesystem[ adminremember[ id ] ][ i ][ CHAT ] ) ) continue
- if( ++counter % 6 == 0 ) menu_additem( menu, fmt( "remove \r%n's\w mutes^n", adminremember[ id ] ) )
- num_to_str( i, data, charsmax( data ) )
- menu_additem( menu, fmt( "%n \r[\w %s%s%s \r]", i, mutesystem[ adminremember[ id ] ][ i ][ VOICE ] ? "Voice" : "",
- mutesystem[ adminremember[ id ] ][ i ][ VOICE ] && mutesystem[ adminremember[ id ] ][ i ][ CHAT ] ? " \y&\w " : "",
- mutesystem[ adminremember[ id ] ][ i ][ CHAT ] ? "Chat" : "" ), data )
- }
- //-------------------- Previous / Next / Exit --------------------//
- menu_setprop( menu, MPROP_BACKNAME, "previous page" )
- menu_setprop( menu, MPROP_NEXTNAME, "next page" )
- menu_setprop( menu, MPROP_EXITNAME, "back" )
- menu_display( id, menu, page )
- return 1
- }
- public sub_showplayermutes( id, menu, item )
- {
- if( item == MENU_EXIT ) return showmutes( id )
- new data[ 6 ], page
- menu_item_getinfo( menu, item, _, data, charsmax( data ) )
- player_menu_info( id, menu, menu, page )
- new player = str_to_num( data )
- //-------------------- If the player is not connected --------------------//
- if( !is_user_connected( player ) ) return ColorChat( id, "^3%n^1 is no longer connected.", player ), showplayermutes( id, page )
- //-------------------- Remove all his mutes --------------------//
- if( item % 7 == 0 )
- {
- for( new i = 1; i <= get_maxplayers(); i++ )
- {
- //-------------------- If the player is not connected or bot or hltv --------------------//
- if( !is_user_connected( i ) || is_user_bot( i ) || is_user_hltv( i ) ) continue
- mutesystem[ adminremember[ id ] ][ i ][ VOICE ] = false
- mutesystem[ adminremember[ id ] ][ i ][ CHAT ] = false
- mutesystem[ adminremember[ id ] ][ i ][ ASKFOR ] = false
- muteall[ adminremember[ id ] ] = false
- }
- return adminmenu( id )
- }
- //-------------------- Remove specific mute from him --------------------//
- mutesystem[ adminremember[ id ] ][ player ][ VOICE ] = false
- mutesystem[ adminremember[ id ] ][ player ][ CHAT ] = false
- mutesystem[ adminremember[ id ] ][ player ][ ASKFOR ] = false
- muteall[ adminremember[ id ] ] = false
- return showplayermutes( id, page )
- }
- //-------------------- Show players for mute others --------------------//
- public showmutesforothers( id )
- {
- //-------------------- Access to the menu & to prevent heap low --------------------//
- if( ~get_user_flags( id ) & ACCESS_ADMIN || !is_user_connected( id ) ) return 0
- new data[ 6 ], menu = menu_create( fmt( "\r[\w %s \r]\w show players to mute someone for them", Prefix ), "sub_showmutesforothers" )
- for( new i = 1; i <= get_maxplayers(); i++ )
- {
- //-------------------- If the player is not connected or bot or hltv --------------------//
- if( !is_user_connected( i ) || is_user_bot( i ) || is_user_hltv( i ) ) continue
- num_to_str( i, data, charsmax( data ) )
- menu_additem( menu, fmt( "%n", i ), data )
- }
- //-------------------- Previous / Next / Exit --------------------//
- menu_setprop( menu, MPROP_BACKNAME, "previous page" )
- menu_setprop( menu, MPROP_NEXTNAME, "next page" )
- menu_setprop( menu, MPROP_EXITNAME, "back" )
- menu_display( id, menu )
- return 1
- }
- public sub_showmutesforothers( id, menu, item )
- {
- if( item == MENU_EXIT ) return adminmenu( id )
- new data[ 6 ]
- menu_item_getinfo( menu, item, _, data, charsmax( data ) )
- return adminremember[ id ] = str_to_num( data ), showplayermutesforothers( id )
- }
- //-------------------- Show players mutes --------------------//
- public showplayermutesforothers( id )
- {
- //-------------------- Access to the menu & to prevent heap low --------------------//
- if( ~get_user_flags( id ) & ACCESS_ADMIN || !is_user_connected( id ) ) return 0
- new bool:blockseeothers = true, menu = menu_create( fmt( "\r[\w %s \r]\w mute profile of: \r%n", Prefix, adminremember[ id ] ), "sub_showplayermutesforothers" )
- //-------------------- Block "see who muted you" --------------------//
- for( new i = 1; i <= get_maxplayers(); i++ ) if( mutesystem[ i ][ adminremember[ id ] ][ VOICE ] || mutesystem[ i ][ adminremember[ id ] ][ CHAT ] ) blockseeothers = false
- menu_additem( menu, "voice" )
- menu_additem( menu, "chat^n" )
- menu_additem( menu, fmt( "%smute everyone^n", muteall[ adminremember[ id ] ] ? "un" : "" ) )
- blockseeothers ? menu_addtext2( menu, "\r4. \dsee who muted him" ) : menu_additem( menu, "see who muted him" )
- menu_setprop( menu, MPROP_EXITNAME, "back" )
- menu_display( id, menu )
- return 1
- }
- public sub_showplayermutesforothers( id, menu, item )
- {
- if( item == MENU_EXIT ) return showmutesforothers( id )
- if( item == 0 ) sortmenu[ id ] = true // Change the menu to voice
- if( item == 1 ) sortmenu[ id ] = false // Change the menu to chat
- if( item == 2 ) // Mute everyone
- {
- muteall[ adminremember[ id ] ] ^= true
- ColorChat( id, "You've ^3%smuted^1 everyone for ^3%n^1.", muteall[ adminremember[ id ] ] ? "" : "un", adminremember[ id ] )
- for( new i = 1; i <= get_maxplayers(); i++ )
- {
- //-------------------- If the player is not connected or bot or hltv or yourself --------------------//
- if( !is_user_connected( i ) || is_user_bot( i ) || is_user_hltv( i ) || i == adminremember[ id ] ) continue
- mutesystem[ adminremember[ id ] ][ i ][ VOICE ] = muteall[ adminremember[ id ] ]
- mutesystem[ adminremember[ id ] ][ i ][ CHAT ] = muteall[ adminremember[ id ] ]
- mutesystem[ adminremember[ id ] ][ i ][ ASKFOR ] = false
- }
- return showplayermutesforothers( id )
- }
- if( item == 3 ) return whomutehim( id, 0 ) // See who mute you
- return mutemenuforothers( id, 0 )
- }
- //-------------------- Mute chat/voice menu --------------------//
- public mutemenuforothers( id, page )
- {
- //-------------------- Access to the menu & to prevent heap low --------------------//
- if( ~get_user_flags( id ) & ACCESS_ADMIN || !is_user_connected( id ) ) return 0
- new data[ 6 ], menu = menu_create( fmt( "\r[\w %s \r]\w mute %s for \r%n", Prefix, sortmenu[ id ] ? "voice" : "chat", adminremember[ id ] ), "sub_mutemenuforothers" )
- for( new i = 1; i <= get_maxplayers(); i++ )
- {
- //-------------------- If the player is not connected or bot or hltv or the chosen player --------------------//
- if( !is_user_connected( i ) || is_user_bot( i ) || is_user_hltv( i ) || i == adminremember[ id ] ) continue
- num_to_str( i, data, charsmax( data ) )
- menu_additem( menu, fmt( "%n \d%s", i, ( sortmenu[ id ] && mutesystem[ adminremember[ id ] ][ i ][ VOICE ] )
- || ( !sortmenu[ id ] && mutesystem[ adminremember[ id ] ][ i ][ CHAT ] ) ? "- [\r muted \d]" : "" ), data )
- }
- //-------------------- Previous / Next / Exit --------------------//
- menu_setprop( menu, MPROP_BACKNAME, "previous page" )
- menu_setprop( menu, MPROP_NEXTNAME, "next page" )
- menu_setprop( menu, MPROP_EXITNAME, "back" )
- menu_display( id, menu, page )
- return 1
- }
- public sub_mutemenuforothers( id, menu, item )
- {
- if( item == MENU_EXIT ) return showplayermutesforothers( id )
- new data[ 6 ], page
- menu_item_getinfo( menu, item, _, data, charsmax( data ) )
- player_menu_info( id, menu, menu, page )
- new player = str_to_num( data )
- //-------------------- If the player is not connected --------------------//
- if( !is_user_connected( player ) ) return ColorChat( id, "^3%n^1 is no longer connected.", player ), mutemenuforothers( id, page )
- if( sortmenu[ id ] )
- {
- mutesystem[ adminremember[ id ] ][ player ][ VOICE ] = !mutesystem[ adminremember[ id ] ][ player ][ VOICE ]
- ColorChat( id, mutesystem[ adminremember[ id ] ][ player ][ VOICE ] ? "^3%n^1 canno't hear ^3%n^1 until he will remove his mute." : "^3%n^1 can hear ^3%n^1 now.", adminremember[ id ], player )
- }
- else if( !sortmenu[ id ] )
- {
- mutesystem[ adminremember[ id ] ][ player ][ CHAT ] = !mutesystem[ adminremember[ id ] ][ player ][ CHAT ]
- ColorChat( id, mutesystem[ adminremember[ id ] ][ player ][ CHAT ] ? "^3%n^1 canno't see what ^3%n^1 write until he will remove his mute." : "^3%n^1 can see what ^3%n^1 write now.", adminremember[ id ], player )
- }
- //-------- If there is even a single player he didnt mute on ( voice / chat ) turn the "Mute everyone" off ------------//
- for( new i = 1; i <= get_maxplayers(); i++ ) if( !mutesystem[ adminremember[ id ] ][ i ][ VOICE ] && !mutesystem[ adminremember[ id ] ][ i ][ VOICE ] ) muteall[ adminremember[ id ] ] = false
- //-------- If the player that you muted has asked you to remove his mute it will remove his block ------------//
- mutesystem[ adminremember[ id ] ][ player ][ ASKFOR ] = false
- return mutemenuforothers( id, page )
- }
- //-------------------- See who mute him --------------------//
- public whomutehim( id, page )
- {
- //-------------------- Access to the menu & to prevent heap low --------------------//
- if( ~get_user_flags( id ) & ACCESS_ADMIN || !is_user_connected( id ) ) return 0
- new item[ 256 ], data[ 6 ]
- formatex( item, charsmax( item ), "\r[\w %s \r]\w see who muted \r%n", Prefix, adminremember[ id ] )
- new menu = menu_create( item, "sub_whomutehim" )
- for( new i = 1; i <= get_maxplayers(); i++ )
- {
- //-------------------- If the player is not connected or not have mute on someone or bot or hltv --------------------//
- if( !is_user_connected( i ) || is_user_bot( i ) || is_user_hltv( i )
- || ( !mutesystem[ i ][ adminremember[ id ] ][ VOICE ] && !mutesystem[ i ][ adminremember[ id ] ][ CHAT ] ) ) continue
- num_to_str( i, data, charsmax( data ) )
- formatex( item, charsmax( item ), "%n \r[\w %s%s%s \r]", i, mutesystem[ i ][ adminremember[ id ] ][ VOICE ] ? "Voice" : "",
- mutesystem[ i ][ adminremember[ id ] ][ VOICE ] && mutesystem[ i ][ adminremember[ id ] ][ CHAT ] ? " \y&\w " : "",
- mutesystem[ i ][ adminremember[ id ] ][ CHAT ] ? "Chat" : "" )
- menu_additem( menu, item, data )
- }
- //-------------------- Previous / Next / Exit --------------------//
- menu_setprop( menu, MPROP_BACKNAME, "previous page" )
- menu_setprop( menu, MPROP_NEXTNAME, "next page" )
- menu_setprop( menu, MPROP_EXITNAME, "back" )
- menu_display( id, menu, page )
- return 1
- }
- public sub_whomutehim( id, menu, item )
- {
- if( item == MENU_EXIT ) return showplayermutesforothers( id )
- new data[ 6 ], page
- menu_item_getinfo( menu, item, _, data, charsmax( data ) )
- player_menu_info( id, menu, menu, page )
- new player = str_to_num( data )
- //-------------------- If the player is not connected --------------------//
- if( !is_user_connected( player ) ) return ColorChat( id, "^3%n^1 is no longer connected.", player ), showplayermutesforothers( id )
- mutesystem[ player ][ adminremember[ id ] ][ VOICE ] = false
- mutesystem[ player ][ adminremember[ id ] ][ CHAT ] = false
- mutesystem[ player ][ adminremember[ id ] ][ ASKFOR ] = false
- muteall[ player ] = false
- ColorChat( id, "You removed ^3%n's^1 mute from ^3%n^1.", adminremember[ id ], player )
- return whomutehim( id, page )
- }
- //-------------------- Stocks - ColorChat --------------------//
- stock ColorChat( id, const string[], any:... )
- {
- new msg[ 191 ], len = formatex( msg, charsmax( msg ), "^3[^1 %s ^3]^1 ", Prefix )
- vformat( msg[ len ], charsmax( msg ) - len, string, 3 )
- client_print_color( id, print_team_default, msg )
- return 1
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement