hlmod.hu
https://hlmod.hu/

Hang Ban
https://hlmod.hu/viewtopic.php?f=29&t=23103
Oldal: 1 / 1

Szerző:  lada xp [ 2015.12.20. 21:38 ]
Hozzászólás témája:  Hang Ban

Létezik olyan hang ban szoval némito plugin ahova tudok irni okot is?

Szerző:  Anonymous1337 [ 2015.12.20. 21:41 ]
Hozzászólás témája:  Re: Hang Ban

lada xp írta:
Létezik olyan hang ban szoval némito plugin ahova tudok irni okot is?

Igen.

AMX Némítás, okkal:

  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <engine>
  4.  
  5. #define DEFAULT_TIME 600.0 // In Seconds
  6.  
  7. enum ( <<= 1 ) {
  8.     GAG_CHAT = 1,
  9.     GAG_TEAMSAY,
  10.     GAG_VOICE
  11. };
  12.  
  13. enum _:GagData {
  14.     GAG_AUTHID[ 20 ],
  15.     GAG_TIME,
  16.     GAG_START,
  17.     GAG_FLAGS,
  18.     GAG_REASON[ 32 ]
  19. };
  20.  
  21. new g_szAuthid[ 33 ][ 20 ];
  22. new g_iThinker, g_iGagged;
  23. new Trie:g_tArrayPos, Array:g_aGagData;
  24.  
  25. public plugin_init( ) {
  26.     register_plugin( "AMXX Gag", "1.1", "xPaw & Exolent" );
  27.      
  28.     register_clcmd( "say",        "CmdSay" );
  29.     register_clcmd( "say_team",   "CmdTeamSay" );
  30.      
  31.     register_concmd( "amx_gag",   "CmdGagPlayer",   ADMIN_KICK, "<nick or #userid> <time> <a|b|c>" );
  32.     register_concmd( "amx_ungag", "CmdUnGagPlayer", ADMIN_KICK, "<nick or #userid>" );
  33.      
  34.     register_message( get_user_msgid( "SayText" ), "MessageSayText" );
  35.      
  36.     new szClassname[ ] = "gag_thinker";
  37.      
  38.     register_think( szClassname, "FwdThink" );
  39.      
  40.     g_tArrayPos = TrieCreate( );
  41.     g_aGagData  = ArrayCreate( GagData );
  42.      
  43.     g_iThinker  = create_entity( "info_target" );
  44.     entity_set_string( g_iThinker, EV_SZ_classname, szClassname );
  45. }
  46.  
  47. public plugin_end( ) {
  48.     TrieDestroy( g_tArrayPos );
  49.     ArrayDestroy( g_aGagData );
  50. }
  51.  
  52. public client_authorized( id ) {
  53.     get_user_authid( id, g_szAuthid[ id ], 19 );
  54.      
  55.     if( CheckGagFlag( id, GAG_VOICE ) )
  56.         set_speak( id, SPEAK_MUTED );
  57. }
  58.  
  59. public client_disconnect( id ) {
  60.     if( TrieKeyExists( g_tArrayPos, g_szAuthid[ id ] ) ) {
  61.         static szName[ 32 ];
  62.         get_user_name( id, szName, 31 );
  63.          
  64.         static iPlayers[ 32 ], iNum, id;
  65.         get_players( iPlayers, iNum, "ch" );
  66.          
  67.         for( new i; i < iNum; i++ ) {
  68.             id = iPlayers[ i ];
  69.              
  70.             if( get_user_flags( id ) & ADMIN_KICK )
  71.                 client_print( id, print_chat, "[AMXX] Gagged player ^"%s<%s>^" has disconnected!", szName, g_szAuthid[ id ] );
  72.         }
  73.     }
  74.      
  75.     g_szAuthid[ id ][ 0 ] = '^0';
  76. }
  77.  
  78. public client_infochanged( id ) {
  79.     if( !CheckGagFlag( id, ( GAG_CHAT | GAG_TEAMSAY ) ) )
  80.         return;
  81.      
  82.     static const name[ ] = "name";
  83.      
  84.     static szNewName[ 32 ], szOldName[ 32 ];
  85.     get_user_info( id, name, szNewName, 31 );
  86.     get_user_name( id, szOldName, 31 );
  87.      
  88.     if( !equal( szNewName, szOldName ) ) {
  89.         client_print( id, print_chat, "[AMXX] Gagged players cannot change their names!" );
  90.          
  91.         set_user_info( id, name, szOldName );
  92.     }
  93. }
  94.  
  95. public MessageSayText( iMsgId, iDest, iReceiver ) {
  96.     static const Cstrike_Name_Change[ ] = "#Cstrike_Name_Change";
  97.      
  98.     static szMessage[ sizeof( Cstrike_Name_Change ) + 1 ];
  99.     get_msg_arg_string( 2, szMessage, sizeof( szMessage ) - 1 );
  100.      
  101.     if( equal( szMessage, Cstrike_Name_Change ) ) {
  102.         static szName[ 32 ], id;
  103.         for( new i = 3; i <= 4; i++ ) {
  104.             get_msg_arg_string( i, szName, 31 );
  105.              
  106.             id = get_user_index( szName );
  107.              
  108.             if( is_user_connected( id ) ) {
  109.                 if( CheckGagFlag( id, ( GAG_CHAT | GAG_TEAMSAY ) ) )
  110.                     return PLUGIN_HANDLED;
  111.                  
  112.                 break;
  113.             }
  114.         }
  115.     }
  116.      
  117.     return PLUGIN_CONTINUE;
  118. }
  119.  
  120. public FwdThink( iEntity ) {
  121.     if( !g_iGagged )
  122.         return;
  123.      
  124.     new Float:fGametime;
  125.     fGametime = get_gametime( );
  126.      
  127.     new data[ GagData ], id, szName[ 32 ];
  128.     for( new i = 0; i < g_iGagged; i++ ) {
  129.         ArrayGetArray( g_aGagData, i, data );
  130.          
  131.         if( ( Float:data[ GAG_START ] + Float:data[ GAG_TIME ] - 0.5 ) <= fGametime ) {
  132.             id = find_player( "c", data[ GAG_AUTHID ] );
  133.              
  134.             if( is_user_connected( id ) ) {
  135.                 get_user_name( id, szName, 31 );
  136.                  
  137.                 client_print( 0, print_chat, "[AMXX] Player ^"%s^" is no longer gagged.", szName );
  138.             }
  139.              
  140.             DeleteGag( i );
  141.              
  142.             i--;
  143.         }
  144.     }
  145.      
  146.     if( !g_iGagged )
  147.         return;
  148.      
  149.     new Float:flNextTime = 999999.9;
  150.     for( new i = 0; i < g_iGagged; i++ ) {
  151.         ArrayGetArray( g_aGagData, i, data );
  152.          
  153.         flNextTime = floatmin( flNextTime, Float:data[ GAG_START ] + Float:data[ GAG_TIME ] );
  154.     }
  155.      
  156.     entity_set_float( iEntity, EV_FL_nextthink, flNextTime );
  157. }
  158.  
  159. public CmdSay( id )  
  160.     return CheckSay( id, 0 );
  161.  
  162. public CmdTeamSay( id )  
  163.     return CheckSay( id, 1 );
  164.  
  165. CheckSay( id, bTeam ) {
  166.     static iArrayPos;
  167.     if( TrieGetCell( g_tArrayPos, g_szAuthid[ id ], iArrayPos ) ) {
  168.         static data[ GagData ];
  169.         ArrayGetArray( g_aGagData, iArrayPos, data );
  170.          
  171.         static const iFlags[ ] = { GAG_CHAT, GAG_TEAMSAY };
  172.          
  173.         if( data[ GAG_FLAGS ] & iFlags[ bTeam ] ) {
  174.             static const szTeam[ ][ ] = { "", " team" };
  175.             client_print( id, print_center, "** You are gagged from%s chat! Reason: %s **", szTeam[ bTeam ], data[ GAG_REASON ] );
  176.              
  177.             PrintLeftTime( id, Float:data[ GAG_TIME ], Float:data[ GAG_START ] );
  178.              
  179.             return PLUGIN_HANDLED;
  180.         }
  181.     }
  182.      
  183.     return PLUGIN_CONTINUE;
  184. }
  185.  
  186. PrintLeftTime( id, Float:flGagTime, Float:flGaggedAt ) {
  187.     new szInfo[ 32 ], iLen, iTime = floatround( ( flGaggedAt + flGagTime ) - get_gametime( ) ), iMinutes = iTime / 60, iSeconds = iTime % 60;
  188.      
  189.     if( iMinutes > 0 )
  190.         iLen = formatex( szInfo, 31, "%i minute%s", iMinutes, iMinutes == 1 ? "" : "s" );
  191.     if( iSeconds > 0 )
  192.         formatex( szInfo[ iLen ], 31 - iLen, "%s%i second%s", iLen ? " and " : "", iSeconds, iSeconds == 1 ? "" : "s" );
  193.      
  194.     client_print( id, print_chat, "[AMXX] %s left before your ungag!", szInfo );
  195. }
  196.  
  197. public CmdGagPlayer( id, iLevel, iCid ) {
  198.     if( !cmd_access( id, iLevel, iCid, 2 ) ) {
  199.         console_print( id, "Flags: a - Chat | b - Team Chat | c - Voice communications" );
  200.          
  201.         return PLUGIN_HANDLED;
  202.     }
  203.      
  204.     new szArg[ 32 ];
  205.     read_argv( 1, szArg, 31 );
  206.      
  207.     new iPlayer = cmd_target( id, szArg, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_NO_BOTS );
  208.      
  209.     if( !iPlayer )
  210.         return PLUGIN_HANDLED;
  211.      
  212.     new szName[ 20 ];
  213.     get_user_name( iPlayer, szName, 19 );
  214.      
  215.     if( TrieKeyExists( g_tArrayPos, g_szAuthid[ iPlayer ] ) ) {
  216.         console_print( id, "User ^"%s^" is already gagged!", szName );
  217.          
  218.         return PLUGIN_HANDLED;
  219.     }
  220.      
  221.     new szFlags[ 4 ], Float:flGagTime;
  222.     read_argv( 2, szArg, 31 );
  223.      
  224.     if( !szArg[ 0 ] ) { // No time entered
  225.         flGagTime = DEFAULT_TIME;
  226.          
  227.         formatex( szFlags, 3, "abc" );
  228.     } else {
  229.         if( is_str_num( szArg ) ) { // Seconds entered
  230.             flGagTime = floatstr( szArg );
  231.              
  232.             if( flGagTime > 86400.0 )
  233.                 flGagTime = 86400.0;
  234.         } else {
  235.             console_print( id, "The value must be in seconds!" );
  236.              
  237.             return PLUGIN_HANDLED;
  238.         }
  239.          
  240.         read_argv( 3, szArg, 31 );
  241.          
  242.         if( !szArg[ 0 ] ) // No flag entered
  243.             formatex( szFlags, 3, "abc" );
  244.         else
  245.             formatex( szFlags, 3, szArg );
  246.          
  247.         read_argv( 4, szArg, 31 );
  248.     }
  249.      
  250.     new iFlags = read_flags( szFlags );
  251.      
  252.     new data[ GagData ];
  253.     data[ GAG_START ] = _:get_gametime( );
  254.     data[ GAG_TIME ] = _:flGagTime;
  255.     data[ GAG_FLAGS ] = iFlags;
  256.     copy( data[ GAG_AUTHID ], 19, g_szAuthid[ iPlayer ] );
  257.     copy( data[ GAG_REASON ], 31, szArg );
  258.      
  259.     TrieSetCell( g_tArrayPos, g_szAuthid[ iPlayer ], g_iGagged );
  260.     ArrayPushArray( g_aGagData, data );
  261.      
  262.     new szFrom[ 64 ];
  263.      
  264.     if( iFlags & GAG_CHAT )
  265.         formatex( szFrom, 63, "say" );
  266.      
  267.     if( iFlags & GAG_TEAMSAY ) {
  268.         if( !szFrom[ 0 ] )
  269.             formatex( szFrom, 63, "say_team" );
  270.         else
  271.             format( szFrom, 63, "%s / say_team", szFrom );
  272.     }
  273.      
  274.     if( iFlags & GAG_VOICE ) {
  275.         set_speak( iPlayer, SPEAK_MUTED );
  276.          
  277.         if( !szFrom[ 0 ] )
  278.             formatex( szFrom, 63, "voicecomm" );
  279.         else
  280.             format( szFrom, 63, "%s / voicecomm", szFrom );
  281.     }
  282.      
  283.     g_iGagged++;
  284.      
  285.     new Float:flGametime = get_gametime( ), Float:flNextThink;
  286.     flNextThink = entity_get_float( g_iThinker, EV_FL_nextthink );
  287.      
  288.     if( !flNextThink || flNextThink > ( flGametime + flGagTime ) )
  289.         entity_set_float( g_iThinker, EV_FL_nextthink, flGametime + flGagTime );
  290.      
  291.     new szInfo[ 32 ], szAdmin[ 20 ], iTime = floatround( flGagTime ), iMinutes = iTime / 60, iSeconds = iTime % 60;
  292.     get_user_name( id, szAdmin, 19 );
  293.      
  294.     if( !iMinutes )
  295.         formatex( szInfo, 31, "%i second%s", iSeconds, iSeconds == 1 ? "" : "s" );
  296.     else
  297.         formatex( szInfo, 31, "%i minute%s", iMinutes, iMinutes == 1 ? "" : "s" );
  298.      
  299.     show_activity( id, szAdmin, "Has gagged %s from speaking for %s! (%s) Reason: %s", szName, szInfo, szFrom, szArg );
  300.      
  301.     console_print( id, "You have gagged ^"%s^" (%s) !", szName, szFrom );
  302.      
  303.     log_amx( "Gag: ^"%s<%s>^" has gagged ^"%s<%s>^" for %i minutes. (%s) Reason: %s", szAdmin, g_szAuthid[ id ], szName, g_szAuthid[ iPlayer ], floatround( flGagTime / 60 ), szFrom, szArg );
  304.      
  305.     return PLUGIN_HANDLED;
  306. }
  307.  
  308. public CmdUnGagPlayer( id, iLevel, iCid ) {
  309.     if( !cmd_access( id, iLevel, iCid, 2 ) )
  310.         return PLUGIN_HANDLED;
  311.      
  312.     new szArg[ 32 ];
  313.     read_argv( 1, szArg, 31 );
  314.      
  315.     if( equali( szArg, "@all" ) ) {
  316.         if( !g_iGagged ) {
  317.             console_print( id, "No gagged players!" );
  318.              
  319.             return PLUGIN_HANDLED;
  320.         }
  321.          
  322.         while( g_iGagged ) DeleteGag( 0 ); // Excellent by Exolent
  323.          
  324.         if( entity_get_float( g_iThinker, EV_FL_nextthink ) > 0.0 )
  325.             entity_set_float( g_iThinker, EV_FL_nextthink, 0.0 );
  326.          
  327.         console_print( id, "You have ungagged all players!" );
  328.          
  329.         new szAdmin[ 32 ];
  330.         get_user_name( id, szAdmin, 31 );
  331.          
  332.         show_activity( id, szAdmin, "Has ungagged all players." );
  333.          
  334.         log_amx( "UnGag: ^"%s<%s>^" has ungagged all players.", szAdmin, g_szAuthid[ id ] );
  335.          
  336.         return PLUGIN_HANDLED;
  337.     }
  338.      
  339.     new iPlayer = cmd_target( id, szArg, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_NO_BOTS );
  340.      
  341.     if( !iPlayer )
  342.         return PLUGIN_HANDLED;
  343.      
  344.     new szName[ 32 ];
  345.     get_user_name( iPlayer, szName, 31 );
  346.      
  347.     new iArrayPos;
  348.     if( !TrieGetCell( g_tArrayPos, g_szAuthid[ iPlayer ], iArrayPos ) ) {
  349.         console_print( id, "User ^"%s^" is not gagged!", szName );
  350.          
  351.         return PLUGIN_HANDLED;
  352.     }
  353.      
  354.     DeleteGag( iArrayPos );
  355.      
  356.     new szAdmin[ 32 ];
  357.     get_user_name( id, szAdmin, 31 );
  358.      
  359.     show_activity( id, szAdmin, "Has ungagged %s.", szName );
  360.      
  361.     console_print( id, "You have ungagged ^"%s^" !", szName );
  362.      
  363.     log_amx( "UnGag: ^"%s<%s>^" has ungagged ^"%s<%s>^"", szAdmin, g_szAuthid[ id ], szName, g_szAuthid[ iPlayer ] );
  364.      
  365.     return PLUGIN_HANDLED;
  366. }
  367.  
  368. CheckGagFlag( const id, const iFlag ) {
  369.     static iArrayPos;
  370.     if( TrieGetCell( g_tArrayPos, g_szAuthid[ id ], iArrayPos ) ) {
  371.         static data[ GagData ];
  372.         ArrayGetArray( g_aGagData, iArrayPos, data );
  373.          
  374.         return ( data[ GAG_FLAGS ] & iFlag );
  375.     }
  376.      
  377.     return 0;
  378. }
  379.  
  380. DeleteGag( iArrayPos ) {
  381.     static data[ GagData ];
  382.     ArrayGetArray( g_aGagData, iArrayPos, data );
  383.      
  384.     if( data[ GAG_FLAGS ] & GAG_VOICE ) {
  385.         new iPlayer = find_player( "c", data[ GAG_AUTHID ] );
  386.         if( is_user_connected( iPlayer ) )
  387.             set_speak( iPlayer, SPEAK_NORMAL );
  388.     }
  389.      
  390.     TrieDeleteKey( g_tArrayPos, data[ GAG_AUTHID ] );
  391.     ArrayDeleteItem( g_aGagData, iArrayPos );
  392.     g_iGagged--;
  393.      
  394.     for( new i = iArrayPos; i < g_iGagged; i++ ) {
  395.         ArrayGetArray( g_aGagData, i, data );
  396.         TrieSetCell( g_tArrayPos, data[ GAG_AUTHID ], i );
  397.     }
  398. }

Szerző:  lada xp [ 2015.12.20. 21:49 ]
Hozzászólás témája:  Re: Hang Ban

Köszönöm!

Szerző:  kengurumancs [ 2015.12.21. 03:43 ]
Hozzászólás témája:  Re: Hang Ban

Szia!
Ez kicsit egyértelműbb.:
[kozep]http://www.hlmod.hu/viewtopic.php?f=101&t=18705&hilit=gag+men%C3%BC[/kozep]

Szerző:  Anonymous1337 [ 2015.12.21. 04:16 ]
Hozzászólás témája:  Re: Hang Ban

kengurumancs írta:
Szia!
Ez kicsit egyértelműbb.:
[kozep]http://www.hlmod.hu/viewtopic.php?f=101&t=18705&hilit=gag+men%C3%BC[/kozep]


Azért mert magyar, és 3x annyi sor? :D Nem kell ennyi funkció, teljesen jó amit én posztoltam. Hamarabb lefut, és nem eszik annyit.

Szerző:  mforce [ 2015.12.21. 20:52 ]
Hozzászólás témája:  Re: Hang Ban

Meg hát ugye viszonyítási alapnak elég az author:
xPaw & Exolent[jNr]

xPaw és Exolent is moderátor allieden,
xPaw csinálta az amxmodx api-t, steamDB-t meg még elég sok mindent,
Exolent csinálta az advanced banst, meg még vagy millió plugint, includet, apit, régen volt zárt forráskódú anticheat rendszere is.

Szerző:  lada xp [ 2015.12.21. 21:46 ]
Hozzászólás témája:  Re: Hang Ban

Értem, köszönöm au utbaigazitást! :D

Oldal: 1 / 1 Minden időpont UTC+01:00 időzóna szerinti
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/