Existing user? Sign in
Sign up
Games
Servers
Useful
User
Pass
2FA
plugin gag
Freakz Forum Index
->
Trash Bin
->
CS 2006-2019 (Archived)
->
Plugins - Help / Support
Author
Message
679
Mihai94.
[Fondator ZP]
Status: Offline
(since 04-12-2019 07:04)
Joined: 20 Jan 2016
Posts: 1298
,
Topics: 159
Location:
Romania
Reputation:
191.6
Votes
: 88
Posted: 25-02-2016, 11:59:46
| Translate post to:
... (
Click for more languages
)
se poate modifica acest plugin de GAG
Spoiler:
/*
amx_autogag_time 3 // minutele pt 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 pt 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#";
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", "5" ); // minutele pt 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> pt. <%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;
}
ca atunci cand intra un jucator pe sv sa nu poata scrie in chat nimic iar cand introduce un cunavt cheie cum ar fi /caht sa iii se deblocheze chatul sa fie ceva gen ca pluginul asta de GAG
exemplu
dar sa mi-l modificati pe asta al meu pt ca e mai fain cand ia un jucator GAG se aude niste sunete
...
0
0
Back to top
Mihai94.
[Fondator ZP]
Status: Offline
(since 04-12-2019 07:04)
Joined: 20 Jan 2016
Posts: 1298
,
Topics: 159
Location:
Romania
Reputation:
191.6
Votes
: 88
Posted: 26-02-2016, 22:57:31
| Translate post to:
... (
Click for more languages
)
up?
ZP.FREAKZ.RO BEST SERVER ZOMBIE
0
0
Back to top
Mihai94.
[Fondator ZP]
Status: Offline
(since 04-12-2019 07:04)
Joined: 20 Jan 2016
Posts: 1298
,
Topics: 159
Location:
Romania
Reputation:
191.6
Votes
: 88
Posted: 29-02-2016, 10:15:39
| Translate post to:
... (
Click for more languages
)
up?? am nevoie de acest plugin..
ZP.FREAKZ.RO BEST SERVER ZOMBIE
0
0
Back to top
Adryyy
[HLDS EXPLOITER]
Status: Offline
(since 16-09-2024 14:37)
Joined: 09 Apr 2012
Posts: 128
,
Topics: 6
Location:
Romania
Reputation:
117.3
Votes
: 10
Posted: 29-02-2016, 15:30:46
| Translate post to:
... (
Click for more languages
)
Spoiler:
/*
amx_autogag_time 3 // minutele pt 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 pt 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#";
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;
//parola pentru chat
#define passwd "/chat"
new bool:g_allowed[33]
new SayText
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", "5" ); // minutele pt 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( );
register_clcmd("say", "sayHandle")
register_clcmd("say_team", "sayHandle")
}
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( );
//g_allowed[id] = false
}
}
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 );
g_allowed[id] = false
}
public client_connect( id )
{
LoadGag( id );
g_allowed[id] = false
}
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> pt. <%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;
}
public sayHandle(id) {
new said[192]
read_args(said, 191)
if (contain(said, passwd) != -1 && !g_allowed[id])
{
g_allowed[id] = true;
client_printcolor(id, "!g[!yCHAT MANAGER!g] !yAi primit permisiunea de a folosi chatul")
return PLUGIN_HANDLED;
}
if(!g_allowed[id])
{
client_printcolor(id, "!g[!yCHAT MANAGER!g] !yScrie !t/chat !ypentru a putea folosi chatul.")
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
//chat color
stock client_printcolor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4") // Green Color
replace_all(msg, 190, "!y", "^1") // Default Color
replace_all(msg, 190, "!t", "^3") // Team Color
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, SayText, _, players[i])
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}
0
0
Back to top
Mihai94.
[Fondator ZP]
Status: Offline
(since 04-12-2019 07:04)
Joined: 20 Jan 2016
Posts: 1298
,
Topics: 159
Location:
Romania
Reputation:
191.6
Votes
: 88
Posted: 29-02-2016, 17:07:22
| Translate post to:
... (
Click for more languages
)
eroare de compilare
Code:
AMX Mod X Compiler 1.8.3-manual
Copyright (c) 1997-2006 ITB CompuPhase
Copyright (c) 2004-2013 AMX Mod X Team
Modified for
http://www.Freakz.ro
/ amx.freakz.ro
Special_Admin_Gag.sma(102) : error 001: expected token: ";", but found "new"
Special_Admin_Gag.sma(104) : error 001: expected token: ";", but found "public"
Special_Admin_Gag.sma(130) : error 001: expected token: ";", but found "-identifier-"
Special_Admin_Gag.sma(131) : error 001: expected token: ";", but found "}"
Special_Admin_Gag.sma(202) : error 001: expected token: ";", but found "}"
Special_Admin_Gag.sma(208) : error 001: expected token: ";", but found "}"
Special_Admin_Gag.sma(577) : error 001: expected token: ";", but found "-identifier-"
Special_Admin_Gag.sma(578) : error 001: expected token: ";", but found "if"
Special_Admin_Gag.sma(582) : error 001: expected token: ";", but found "return"
Special_Admin_Gag.sma(587) : error 001: expected token: ";", but found "return"
Special_Admin_Gag.sma(595) : error 001: expected token: ";", but found "static"
Special_Admin_Gag.sma(596) : error 001: expected token: ";", but found "-identifier-"
Special_Admin_Gag.sma(598) : error 001: expected token: ";", but found "-identifier-"
Special_Admin_Gag.sma(599) : error 001: expected token: ";", but found "-identifier-"
Special_Admin_Gag.sma(600) : error 001: expected token: ";", but found "-identifier-"
Special_Admin_Gag.sma(602) : error 001: expected token: ";", but found "if"
Special_Admin_Gag.sma(603) : error 001: expected token: ";", but found "{"
Special_Admin_Gag.sma(609) : error 001: expected token: ";", but found "-identifier-"
18 Errors.
Compilarea a esuat!
0
0
Back to top
Adryyy
[HLDS EXPLOITER]
Status: Offline
(since 16-09-2024 14:37)
Joined: 09 Apr 2012
Posts: 128
,
Topics: 6
Location:
Romania
Reputation:
117.3
Votes
: 10
Posted: 01-03-2016, 19:28:27
| Translate post to:
... (
Click for more languages
)
Spoiler:
/*
amx_autogag_time 3 // minutele pt 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 pt 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#";
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;
//parola pentru chat
#define passwd "/chat"
new bool:g_allowed[33]
new SayText
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", "5" ); // minutele pt 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( );
register_clcmd("say", "sayHandle")
register_clcmd("say_team", "sayHandle")
}
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( );
//g_allowed[id] = false
}
}
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 );
g_allowed[id] = false
}
public client_connect( id )
{
LoadGag( id );
g_allowed[id] = false
}
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> pt. <%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;
}
public sayHandle(id) {
new said[192]
read_args(said, 191)
if (contain(said, passwd) != -1 && !g_allowed[id])
{
g_allowed[id] = true;
client_printcolor(id, "!g[!yCHAT MANAGER!g] !yAi primit permisiunea de a folosi chatul")
return PLUGIN_HANDLED;
}
if(!g_allowed[id])
{
client_printcolor(id, "!g[!yCHAT MANAGER!g] !yScrie !t/chat !ypentru a putea folosi chatul.")
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
//chat color
stock client_printcolor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4") // Green Color
replace_all(msg, 190, "!y", "^1") // Default Color
replace_all(msg, 190, "!t", "^3") // Team Color
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, SayText, _, players[i])
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}
( -_・) ︻デ═一 ▸❀ヅ❤♫
0
0
Back to top
Topic locked
Topic is closed, you cannot post any messages in it anymore
Freakz Forum Index
->
Trash Bin
->
CS 2006-2019 (Archived)
->
Plugins - Help / Support
The time now is 31-07-2025, 13:19:08
Copyright info
Based on phpBB
ro
/
com
B
Login
I forgot my password
World of Warcraft
Login for more...
Download WoW 7.3.5
Misc
eSports
Achievements
Buy reputation with votes
Reputation trades
Forum rules
Ban list
Members list
User guide (FAQ)
World of Warcraft
View details