- | Afiseaza codul
/* amx_autogag_time 3 // minutele pentru gag cand ia autogag amx_gag_minute_limit 300 // limita maxima pentru gag minute amx_gag_minute_in_seconds 60 // minute in secunde amx_gag_tagname 1 // pune taguri la gag amx_admingag 0 // poti da si la admini gag daca e egal cu 1, daca e 0 nu poti amx_maxwords 200 // lista maxima de cuvinte in gag_words.ini amx_gagtag * // tag-ul din chat amx_gag < nume > < timp in minute > - dai gag unui jucator pentru x minute amx_ungag < nume > ii scoti gag-ul unui jucator /gag < nume > < timp in minute > - dai gag unui jucator pentru x minute /ungag < nume > ii scoti gag-ul unui jucator Cand un jucator cu gag iese de pe server va fi salvat intr-un fisier Atunci cand se va conecta pe server va avea gag exact cate minute mai avea cand a iesit de pe server Autor: Cristi. C */ #include < amxmodx > #include < amxmisc > #include < fakemeta > #include < engine > #include < nvault > #include < CC_ColorChat > #pragma semicolon 1 #define PLUGIN "Special Admin Gag" #define VERSION "1.0" #define COMMAND_ACCESS ADMIN_KICK // accesu adminilor pentru comanda #define MAX_PLAYERS 32 + 1 enum { INFO_NAME, INFO_IP, INFO_AUTHID }; new const bars[ ] = "/"; new command[ ] [ ] = { "/gag", "/ungag" }; new Caccess[ ] = { COMMAND_ACCESS, COMMAND_ACCESS }; new const gGagTag[ ] = "[GAG-CS1]"; new const gGagFileName[ ] = "gag_words.ini"; new const gLogFileName[ ] = "GagLog.log"; new const gGagThinkerClassname[ ] = "GagThinker_"; new const gGagVaultName[ ] = "GaggedPlayers"; new const gGaggedSound[ ] = "misc/gag_dat.wav"; new const gUnGaggedSound[ ] = "misc/gag_scos.wav"; new const gHalfLifeGaggedSounds[ ][ ] = { "barney/youtalkmuch.wav", "scientist/stopasking.wav", "scientist/shutup.wav", "scientist/shutup2.wav", "hgrunt/silence!.wav" }; new PlayerGagged[ MAX_PLAYERS ]; new PlayerGagTime[ MAX_PLAYERS ]; new JoinTime[ MAX_PLAYERS ]; new szName[ 33 ]; new g_Words[ 562 ] [ 32 ], g_Count; new szOldName[ MAX_PLAYERS ] [ 40 ]; new gCvarSwearGagTime; new gCvarGagMinuteLimit; new gCvarGagMinuteInSeconds; new gCvarAdminGag; new gCvarTagName; new gCvarWords; new gCvarTag; new gMaxPlayers; new gVault; public plugin_init( ) { register_plugin( PLUGIN, PLUGIN, "Cristi .C" ); register_concmd( "amx_gag", "CommandGag" ); register_concmd( "amx_ungag", "CommandUngag" ); register_clcmd( "say", "CheckGag" ); register_clcmd( "say_team", "CheckGag" ); register_clcmd( "say", "command_chat" ); GagThinker( ); register_think( gGagThinkerClassname, "Forward_GagThinker" ); gCvarSwearGagTime = register_cvar( "amx_autogag_time", "3" ); // minutele pentru gag cand ia autogag gCvarGagMinuteLimit = register_cvar( "amx_gag_minute_limit", "300" ); // limita maxima pentru gag minute gCvarGagMinuteInSeconds = register_cvar( "amx_gag_minute_in_seconds", "60" ); // minute in secunde gCvarTagName = register_cvar( "amx_gag_tagname", "1" ); // pune taguri la gag gCvarAdminGag = register_cvar( "amx_admingag", "0" ); // poti da si la admini gag daca e egal cu 1, daca e 0 nu poti gCvarWords = register_cvar( "amx_maxwords", "200" ); // lista maxima de cuvinte in gag_words.ini gCvarTag = register_cvar( "amx_gagtag", "*" ); // tag-ul din chat gMaxPlayers = get_maxplayers( ); } public plugin_precache( ) { new i; for( i = 0; i < sizeof gHalfLifeGaggedSounds; i++ ) { precache_sound( gHalfLifeGaggedSounds[ i ] ); } precache_sound( gGaggedSound ); precache_sound( gUnGaggedSound ); } public plugin_cfg( ) { static szConfigDir[ 64 ], iFile[ 64 ]; get_localinfo ( "amxx_configsdir", szConfigDir, 63 ); formatex ( iFile , charsmax( iFile ) , "%s/%s" , szConfigDir, gGagFileName ); if( !file_exists( iFile ) ) { write_file( iFile, "# Pune aici cuvintele jignitoare sau reclamele", -1 ); log_to_file( gLogFileName, "Fisierul <%s> nu exista! Creez unul nou acum...", iFile ); } new szBuffer[ 128 ]; new szFile = fopen( iFile, "rt" ); while( !feof( szFile ) ) { fgets( szFile, szBuffer, charsmax( szBuffer ) ); if( szBuffer[ 0 ] == '#' ) { continue; } parse( szBuffer, g_Words[ g_Count ], sizeof g_Words[ ] - 1 ); g_Count++; if( g_Count >= get_pcvar_num ( gCvarWords ) ) { break; } } fclose( szFile ); } public client_putinserver( id ) { if ( is_user_connected( id ) ) { JoinTime[ id ] = get_systime( ); } } public client_disconnect( id ) { if ( PlayerGagged[ id ] == 1 ) { ColorChat( 0, RED, "^4%s^1 Jucatorul cu gag^4 %s^1(^3%s^1|^3%s^1), s-a deconectat!", get_tag( ), GetInfo( id, INFO_NAME ), GetInfo( id, INFO_IP ), GetInfo( id, INFO_AUTHID ) ); log_to_file( gLogFileName, "[EXIT]Jucatorul cu gag <%s><%s><%s>, s-a deconectat!", GetInfo( id, INFO_NAME ), GetInfo( id, INFO_IP ), GetInfo( id, INFO_AUTHID ) ); } JoinTime[ id ] = 0 ; SaveGag( id ); } public client_connect( id ) { LoadGag( id ); } public command_chat( index ) { static szArg[ 192 ], command2[ 192 ]; read_args( szArg, charsmax ( szArg ) ); if( ! szArg [ 0 ] ) return PLUGIN_CONTINUE; remove_quotes( szArg[0] ); for( new x; x < sizeof command; x++ ) { if ( equal ( szArg, command [ x ], strlen ( command [ x ] ) ) ) { if ( get_user_flags ( index ) & Caccess [ x ] ) { replace( szArg, charsmax ( szArg ), bars, "" ); formatex( command2, charsmax(command2), "amx_%s", szArg ); client_cmd( index, command2 ); } break; } } return PLUGIN_CONTINUE; } public CheckGag( id ) { new szSaid[ 300 ]; read_args( szSaid, charsmax( szSaid ) ); remove_quotes( szSaid ); if( !UTIL_IsValidMessage( szSaid ) ) { return PLUGIN_HANDLED; } if ( PlayerGagged[ id ] == 1 ) { PlayerGagged[ id ] = 1; ColorChat( id, RED, "^4%s^1 Ai primit Gag pentru limbaj vulgar, asteapta^4 %d^1 minute!", get_tag( ), PlayerGagTime[ id ] ); client_cmd( id, "speak ^"%s^"", gHalfLifeGaggedSounds[ random_num( 0, charsmax( gHalfLifeGaggedSounds ) ) ] ); return PLUGIN_HANDLED; } else { new i; for( i = 0; i < get_pcvar_num ( gCvarWords ); i++ ) { if( containi( szSaid, g_Words[ i ] ) != -1 ) { if( get_pcvar_num( gCvarAdminGag ) == 0 ) { if ( is_user_admin ( id ) ) { return 1; } } get_user_name( id, szName, sizeof ( szName ) -1 ); if ( get_pcvar_num( gCvarTagName ) == 1 ) { client_cmd( id, "name ^"%s %s^"", gGagTag, szName ); } szOldName[ id ] = szName; PlayerGagged[ id ] = 1; PlayerGagTime[ id ] = get_pcvar_num ( gCvarSwearGagTime ); set_speak( id, SPEAK_MUTED ); ColorChat( 0, RED, "^3%s^4 %s^1 (^3%s^1)^1 a primit AutoGag pentru limbaj sau reclama!", get_tag( ), GetInfo( id, INFO_NAME ), GetInfo( id, INFO_IP ) ); ColorChat( id, RED, "^4%s^1 Ai primit AutoGag pentru injuratura sau reclama! Timpul expira in:^4 %d^1 minute!", get_tag( ), PlayerGagTime[ id ] ); ColorChat( id, RED, "^4%s^1 Nu mai poti folosi urmatoarele comenzi:^4 say^1,^4 say_team^1,^4 voice speak", get_tag( ) ); log_to_file( gLogFileName, "[AUTOGAG]<%s><%s><%s> a luat AutoGag pentru ca a injurat sau a facut reclama!", GetInfo( id, INFO_NAME ), GetInfo( id, INFO_IP ), GetInfo( id, INFO_AUTHID ) ); client_cmd( id, "speak ^"%s^"", gGaggedSound ); return PLUGIN_HANDLED; } } } return PLUGIN_CONTINUE; } public CommandGag( id ) { if( !(get_user_flags( id ) & COMMAND_ACCESS ) ) { client_cmd( id, "echo %s Nu ai acces la aceasta comanda!", get_tag( ) ); return 1; } new szArg[ 32 ], szMinutes[ 32 ]; read_argv( 1, szArg, charsmax ( szArg ) ); if( equal( szArg, "" ) ) { client_cmd( id, "echo amx_gag < nume > < minute > < motiv >!" ); return 1; } new iPlayer = cmd_target( id, szArg, CMDTARGET_ALLOW_SELF ); if( !iPlayer ) { client_cmd( id, "echo %s Jucatorul specificat nu a fost gasit!", get_tag( ) ); return 1; } if ( get_pcvar_num( gCvarAdminGag ) == 0 ) { if ( is_user_admin( iPlayer ) ) { client_cmd( id, "echo %s Nu poti da gag la Admini!", get_tag( ) ); return 1; } } read_argv( 2, szMinutes, charsmax ( szMinutes ) ); new iMinutes = str_to_num( szMinutes ); if ( iMinutes > get_pcvar_num ( gCvarGagMinuteLimit ) ) { console_print( id, "%s Ai setat %d minute, iar limita maxima de minute este %d! Setare automata pe %d.", get_tag( ), iMinutes, get_pcvar_float ( gCvarGagMinuteLimit ), get_pcvar_float ( gCvarGagMinuteLimit ) ); iMinutes = get_pcvar_num( gCvarGagMinuteLimit ) ; } get_user_name( iPlayer, szName, sizeof ( szName ) -1 ); szOldName[ iPlayer ] = szName; if( PlayerGagged[ iPlayer ] == 1 ) { client_cmd( id, "echo %s Jucatorul %s are deja Gag!", get_tag( ), GetInfo( iPlayer, INFO_NAME ) ); return 1; } if ( get_pcvar_num( gCvarTagName ) == 1 ) { client_cmd( iPlayer, "name ^"%s %s^"", gGagTag, szName ); } PlayerGagged[ iPlayer ] = 1; PlayerGagTime[ iPlayer ] = iMinutes; set_speak( iPlayer, SPEAK_MUTED ); ColorChat( 0, RED, "^4%s^1 ADMIN^4 %s:^1 Gag^3 %s^1(^3%s^1) pentru^4 %d^1 minute", get_tag( ), GetInfo( id, INFO_NAME ), GetInfo( iPlayer, INFO_NAME ), GetInfo( iPlayer, INFO_IP ), iMinutes ); ColorChat( iPlayer, RED, "^4%s^1 Ai primit Gag pentru ca ai injurat sau ai facut reclama!", get_tag( ) ); ColorChat( iPlayer, RED, "^4%s^1 Nu mai poti folosi urmatoarele comenzi:^4 say^1,^4 say_team^1,^4 voice speak", get_tag( ) ); log_to_file( gLogFileName, "[GAG]%s i-a dat gag lui <%s><%s><%s> pentru <%d> minute", GetInfo( id, INFO_NAME ), GetInfo( iPlayer, INFO_NAME ), GetInfo( iPlayer, INFO_IP ), GetInfo( iPlayer, INFO_AUTHID ), iMinutes ); client_cmd( iPlayer, "speak ^"%s^"", gGaggedSound ); return PLUGIN_HANDLED; } public CommandUngag( id ) { if( !(get_user_flags( id ) & COMMAND_ACCESS ) ) { client_cmd( id, "echo %s Nu ai acces la aceasta comanda!", get_tag( ) ); return 1; } new szArg[ 32 ]; read_argv( 1, szArg, charsmax( szArg ) ); if( equal( szArg, "" ) ) { client_cmd( id, "echo amx_ungag < nume > !" ); return 1; } new iPlayer = cmd_target ( id, szArg, CMDTARGET_ALLOW_SELF ); if( !iPlayer ) { client_cmd( id, "echo %s Jucatorul specificat nu a fost gasit!", get_tag( ) ); return 1; } if( PlayerGagged[ iPlayer ] == 0 ) { console_print( id, "%s Jucatorul %s nu are Gag!", get_tag( ), GetInfo( iPlayer, INFO_NAME ) ); return 1; } if ( get_pcvar_num ( gCvarTagName ) == 1 ) { client_cmd( iPlayer, "name ^"%s^"", szOldName[ iPlayer ] ); } PlayerGagged[ iPlayer ] = 0; PlayerGagTime[ iPlayer ] = 0; set_speak( iPlayer, SPEAK_NORMAL ); ColorChat( 0, RED, "^4%s^1 ADMIN^4 %s:^1 Ungag^3 %s^1(^3%s^1|^3%s^1)", get_tag( ), GetInfo( id, INFO_NAME ), GetInfo( iPlayer, INFO_NAME ), GetInfo( iPlayer, INFO_IP ), GetInfo( iPlayer, INFO_AUTHID ) ); ColorChat( iPlayer, RED, "^4%s^1 Ai primit Ungag de la adminul: ^4%s^1, ai grija la limbaj data viitoare!", get_tag( ), GetInfo( id, INFO_NAME ) ); log_to_file( gLogFileName, "[UNGAG]<%s> i-a dat ungag lui <%s><%s><%s>", GetInfo( id, INFO_NAME ), GetInfo( iPlayer, INFO_NAME ), GetInfo( iPlayer, INFO_IP ), GetInfo( iPlayer, INFO_AUTHID ) ); client_cmd( iPlayer, "speak ^"%s^"", gUnGaggedSound ); return PLUGIN_HANDLED; } public Forward_GagThinker( iEntity ) { if ( pev_valid( iEntity ) ) { set_pev( iEntity, pev_nextthink, get_gametime( ) + 1.0 ) ; new id; for ( id = 1; id <= gMaxPlayers; id++ ) { if ( is_user_connected ( id ) && ! is_user_bot( id ) && PlayerGagged[ id ] == 1 && PlayerGagTime[ id ] > 0 && ( ( get_systime( ) - JoinTime[ id ] ) >= get_pcvar_num ( gCvarGagMinuteInSeconds ) ) ) { JoinTime[ id ] = get_systime( ); PlayerGagTime[ id ] -= 1; if ( PlayerGagTime[ id ] <= 0 ) { PlayerGagTime[ id ] = 0; PlayerGagged[ id ] = 0; set_speak( id, SPEAK_NORMAL ); ColorChat( id, RED, "^4%s^3 Ai primit UnGag, ai grija la limbaj data viitoare!", get_tag( ) ); log_to_file( gLogFileName, "[AUTOUNGAG]<%s> a primit AutoUnGag!", GetInfo( id, INFO_NAME ) ); client_cmd( id, "speak ^"%s^"", gUnGaggedSound ); client_cmd( id, "name ^"%s^"", szOldName[ id ] ); } } } } } stock SaveGag( id ) { gVault = nvault_open( gGagVaultName ); new szIp[ 40 ], szVaultKey[ 64 ], szVaultData[ 64 ]; get_user_ip( id, szIp, charsmax( szIp ) ); formatex( szVaultKey, charsmax( szVaultKey ), "%s-Gag", szIp ); formatex( szVaultData, charsmax( szVaultData ), "%i#%i", PlayerGagged[ id ], PlayerGagTime[ id ] ); nvault_set( gVault, szVaultKey, szVaultData ); nvault_close( gVault ); } stock LoadGag( id ) { gVault = nvault_open( gGagVaultName ); new szIp[ 40 ], szVaultKey[ 64 ], szVaultData[ 64 ]; get_user_ip( id, szIp, charsmax ( szIp ) ); formatex( szVaultKey, charsmax( szVaultKey ), "%s-Gag", szIp ); formatex( szVaultData, charsmax( szVaultData ), "%i#%i", PlayerGagged[ id ], PlayerGagTime[ id ] ); nvault_get( gVault, szVaultKey, szVaultData, charsmax ( szVaultData ) ); replace_all( szVaultData, charsmax( szVaultData ), "#", " " ); new iGagOn[ 32 ], iGagTime [ 32 ]; parse( szVaultData, iGagOn, charsmax ( iGagOn ), iGagTime, charsmax ( iGagTime ) ); PlayerGagged[ id ] = str_to_num ( iGagOn ); PlayerGagTime[ id ] = clamp ( str_to_num ( iGagTime ), 0, get_pcvar_num ( gCvarGagMinuteLimit ) ); nvault_close( gVault ); } stock GagThinker( ) { new iEntity = create_entity ( "info_target" ); if( ! pev_valid ( iEntity ) ) { return PLUGIN_HANDLED; } set_pev ( iEntity, pev_classname, gGagThinkerClassname ); set_pev ( iEntity, pev_nextthink, get_gametime( ) + 1.0 ); return PLUGIN_HANDLED; } stock get_tag( ) { new szTag [ 32 ]; get_pcvar_string( gCvarTag, szTag, sizeof ( szTag ) -1 ); return szTag; } stock GetInfo( id, const iInfo ) { new szInfoToReturn[ 64 ]; switch( iInfo ) { case INFO_NAME: { new szName[ 32 ]; get_user_name( id, szName, sizeof ( szName ) -1 ); copy( szInfoToReturn, sizeof ( szInfoToReturn ) -1, szName ); } case INFO_IP: { new szIp[ 32 ]; get_user_ip( id, szIp, sizeof ( szIp ) -1, 1 ); copy( szInfoToReturn, sizeof ( szInfoToReturn ) -1, szIp ); } case INFO_AUTHID: { new szAuthId[ 35 ]; get_user_authid( id, szAuthId, sizeof ( szAuthId ) -1 ); copy( szInfoToReturn, sizeof ( szInfoToReturn ) -1, szAuthId ); } } return szInfoToReturn; } stock bool:UTIL_IsValidMessage( const szSaid[ ] ) { new iLen = strlen( szSaid ); if( !iLen ) { return false; } for( new i = 0; i < iLen; i++ ) { if( szSaid[ i ] != ' ' ) { return true; } } return false; }
[Rezolvat] Gag
Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com
- NuRoFeN [;x]
- Membru, skill +2
- Posts: 828
- Joined: 21 Aug 2012, 15:47
- Detinator Steam: Da
- CS Status: Inactiv !
- Detinator server CS: DR.CS1.RO
- SteamID: eualexandru
- Reputatie: Fost moderator
- Location: Rm.Valcea
- Has thanked: 66 times
- Been thanked: 61 times
- Contact:
Puteti scoate sunetele din acest plugin ? ,puteti modifica sa numai creeze log la cei cu gag care ies si imi puteti scoate colorchatu din el ?
- NuRoFeN [;x]
- Membru, skill +2
- Posts: 828
- Joined: 21 Aug 2012, 15:47
- Detinator Steam: Da
- CS Status: Inactiv !
- Detinator server CS: DR.CS1.RO
- SteamID: eualexandru
- Reputatie: Fost moderator
- Location: Rm.Valcea
- Has thanked: 66 times
- Been thanked: 61 times
- Contact:
Scuzele mele :))) , am si uitat ! Multumesc frumos.