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[ 256 ], bool: blocksee = true
- //----- 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
- formatex( item, charsmax( item ), "\r[\w %s \r]\w mute menu", Prefix )
- new menu = menu_create( item, "sub_mainmenu" )
- 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 ] = !muteall[ id ]
- 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 item[ 256 ], data[ 6 ]
- formatex( item, charsmax( item ), "\r[\w %s \r]\w mute %s", Prefix, sortmenu[ id ] ? "voice" : "chat" )
- new menu = menu_create( item, "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 ) )
- formatex( item, charsmax( item ), "%n \d%s", i, ( sortmenu[ id ] && mutesystem[ id ][ i ][ VOICE ] )
- || ( !sortmenu[ id ] && mutesystem[ id ][ i ][ CHAT ] ) ? "- [\r muted \d]" : "" )
- 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_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( 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 ]
- formatex( item, charsmax( item ), "\r[\w %s \r]\w see who muted you", Prefix )
- new menu = menu_create( item, "sub_whomenu" )
- for( new i = 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" : "" )
- menu_additem( menu, item, data, mutesystem[ id ][ i ][ ASKFOR ] ? ( 1 << 31 ) : 0 )
- }
- //-------------------- 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 item[ 256 ]
- formatex( item, charsmax( item ), "\r[\w %s \r] \r%n\w ask you to remove his mute", Prefix, whoaskme[ id ] )
- new menu = menu_create( item, "sub_acceptionmenu" )
- menu_additem( menu, "accept" )
- menu_additem( menu, "ignore" )
- menu_setprop( menu, MPROP_EXIT, MEXIT_NEVER )
- menu_display( id, menu )
- return 1
- }
- public sub_acceptionmenu( id, menu, item )
- {
- //-------------------- 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 item[ 256 ], bool: blockwhosee = true, bool: blocksee = true
- //-------------------- 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
- formatex( item, charsmax( item ), "\r[\w %s \r]\w admin menu", Prefix )
- new menu = menu_create( item, "sub_adminmenu" )
- 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" )
- formatex( item, charsmax( item ), "%smute someone for someone else", get_playersnum() > 1 ? "" : "\r4. \d" )
- get_playersnum() > 1 ? menu_additem( menu, item ) : menu_addtext2( menu, item )
- 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 item[ 256 ], data[ 6 ]
- formatex( item, charsmax( item ), "\r[\w %s \r]\w show players that mute someone", Prefix )
- new menu = menu_create( item, "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, GetName( 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 ) )
- adminremember[ id ] = str_to_num( data ) // Get the name of the player
- return 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 item[ 256 ], data[ 6 ]
- formatex( item, charsmax( item ), "\r[\w %s \r]\w show \r%n\w mutes", Prefix, adminremember[ id ] )
- new menu = menu_create( item, "sub_showplayermutes" )
- formatex( item, charsmax( item ), "remove \r%n's\w mutes", adminremember[ id ] )
- menu_additem( menu, item )
- 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[ adminremember[ id ] ][ i ][ VOICE ] && !mutesystem[ adminremember[ id ] ][ i ][ CHAT ] ) ) continue
- num_to_str( i, data, charsmax( data ) )
- formatex( item, charsmax( item ), "%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" : "" )
- 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_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 )
- //-------------------- Remove all his mutes --------------------//
- if( item == 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 item[ 256 ], data[ 6 ]
- formatex( item, charsmax( item ), "\r[\w %s \r]\w show players to mute someone for them", Prefix )
- new menu = menu_create( item, "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, GetName( 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 ) )
- adminremember[ id ] = str_to_num( data ) // Get the name of the player
- return 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 item[ 256 ], bool: blockseeothers = true
- //-------------------- 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
- formatex( item, charsmax( item ), "\r[\w %s \r]\w mute profile of: \r%n", Prefix, adminremember[ id ] )
- new menu = menu_create( item, "sub_showplayermutesforothers" )
- menu_additem( menu, "voice" )
- menu_additem( menu, "chat^n" )
- formatex( item, charsmax( item ), "%smute everyone^n", muteall[ adminremember[ id ] ] ? "un" : "" )
- menu_additem( menu, item )
- 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 ] ] = !muteall[ adminremember[ id ] ]
- 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 item[ 256 ], data[ 6 ]
- formatex( item, charsmax( item ), "\r[\w %s \r]\w mute %s for \r%n", Prefix, sortmenu[ id ] ? "voice" : "chat", adminremember[ id ] )
- new menu = menu_create( item, "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 ) )
- formatex( item, charsmax( item ), "%n \d%s", i, ( sortmenu[ id ] && mutesystem[ adminremember[ id ] ][ i ][ VOICE ] )
- || ( !sortmenu[ id ] && mutesystem[ adminremember[ id ] ][ i ][ CHAT ] ) ? "- [\r muted \d]" : "" )
- 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_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( 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 )
- //-------------------- 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 )
- }
- new player = str_to_num( data )
- 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 - name --------------------//
- stock GetName( id )
- {
- new name[ 32 ]
- get_user_name( id, name, charsmax( name ) )
- return name
- }
- //-------------------- Stocks - ColorChat --------------------//
- stock ColorChat( id, const string[], any:... )
- {
- new msg[ 191 ], players[ 32 ], count = 1
- new len = formatex( msg, charsmax( msg ), "^3[^1 %s ^3]^1 ", Prefix )
- vformat( msg[ len ], charsmax( msg ) - len, string, 3 )
- if( id )
- players[ 0 ] = id
- else
- get_players( players, count, "ch" )
- for( new i = 0; i < count; i++ )
- {
- if( is_user_connected( players[ i ] ) )
- {
- message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, players[ i ] )
- write_byte( players[ i ] )
- write_string( msg )
- message_end()
- }
- }
- return 1
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement