Plugin gag modificat!

Categoria cu cereri de pluginuri si nu numai.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Forum rules
Accesează link-ul pentru a putea vedea regulile forumului

Daca doriti sa vi se modifice un plugin, va rugam postati aici .
Post Reply
Spank
Membru, skill +2
Membru, skill +2
Posts: 656
Joined: 14 Apr 2010, 14:30
Detinator Steam: Da
Detinator server CS: Clasic.Promns.Ro
SteamID: Danyel11
Location: Sibiu
Has thanked: 62 times
Been thanked: 4 times

15 Jul 2013, 18:53

Dupa cum spune si titlul doresc un plugin de gag fara erori cu urmatoarele mesaje:
Cand un admin da gag unui jucator sa apara asa in chat:
Image
Cand adminul da ungag sa apara asa:
Image
Cand expira gagul sa apara asa:
Image
Cand jucatorul are gag si scrie in chat sa ii apara un mesaj de genul:
Image
RoyalServer 2
User avatar
CsN^ ;x
Membru eXtream
Membru eXtream
Posts: 3560
Joined: 02 Apr 2012, 16:58
Detinator Steam: Nu
CS Status: Retras din domeniul Counter-Strike
Reputatie: Fost moderator
Location: Bucuresti
Has thanked: 797 times
Been thanked: 607 times

15 Jul 2013, 18:55

| Afiseaza codul
#include <amxmodx>
#include <amxmisc>

#define ACCESS 			ADMIN_KICK
#define WORDS			256
#define SWEAR_GAGMINUTES	3
#define SHOW

new const tag[] = "[LegendCS.Com]";
new const g_FileName[] = "gag_words.ini";

new 
bool:g_Gaged[ 33 ], g_GagTime[ 33 ],
bool:g_SwearGag[ 33 ], bool:g_CmdGag[ 33 ],
bool:g_NameChanged[33];

new g_reason[ 32 ], g_admin[ 32 ], g_name[ 33 ][ 32 ];

new g_WordsFile[ 128 ];
new g_Words[ WORDS ][ 32 ], g_Count, g_Len;

new point, g_msgsaytext;
new toggle_tag

public plugin_init() 
{
	register_plugin("Advance Gag", "2.2", "anakin_cstrike/ update -B1ng0-")
	
	register_concmd( "amx_gag", "gag_cmd", ACCESS,"- <nume> <minute> <motiv> - Da gag jucatorului" );
	register_concmd( "amx_ungag", "ungag_cmd", ACCESS, "- <nume> - Scoate gagul" );
	register_clcmd( "say", "check" );
	register_clcmd( "say_team", "check" );
	
	toggle_tag = register_cvar( "gag_tag", "0" );
	point = get_cvar_pointer( "amx_show_activity" );
	g_msgsaytext = get_user_msgid( "SayText" );
	
}

public plugin_cfg()
{
	static dir[ 64 ];
	get_localinfo( "amxx_configsdir", dir, 63 );
	formatex( g_WordsFile , 127 , "%s/%s" , dir, g_FileName );
	
	if( !file_exists( g_WordsFile ) )
		write_file( g_WordsFile, "[Gag Words]", -1 );
	
	new Len;
	
	while( g_Count < WORDS && read_file( g_WordsFile, g_Count ,g_Words[ g_Count ][ 1 ], 30, Len ) )
	{
		g_Words[ g_Count ][ 0 ] = Len;
		g_Count++;
	}
}

public client_putinserver(id)
{  	
	g_Gaged[ id ] = false;
	g_SwearGag[ id ] = false;	
}

public gag_cmd( id )
{
	if( !( get_user_flags( id ) & ADMIN_SLAY ) )
	{
		return PLUGIN_HANDLED; 
	}
	else
	{
		
		new arg[ 32 ], arg2[ 6 ], reason[ 32 ];
		new name[ 32 ], namet[ 32 ];
		new minutes;
		
		read_argv(1, arg, 31)
		
		new player = cmd_target(id, arg, 9)
		
		if (!player) 
			return PLUGIN_HANDLED
		
		read_argv( 1, arg, sizeof arg - 1 );
		read_argv( 2, arg2, sizeof arg2 - 1 );
		read_argv( 3, reason, sizeof reason - 1 );
		
		get_user_name( id, name, 31 );
		
		copy( g_admin, 31, name );
		copy( g_reason, 31, reason );
		remove_quotes( reason );
		
		minutes = str_to_num( arg2 );
		
		new target = cmd_target( id, arg, 10 );
		if( !target)
			
		target = cmd_target( id, arg, CMDTARGET_OBEY_IMMUNITY );
		
		if( g_Gaged[ target ] )
		{
			console_print( id, "Jucatorul are deja gag!" );
			return PLUGIN_HANDLED;
		}
		
		get_user_name( target, namet, 31 );
		copy( g_name[ target ], 31, namet );
		
		g_CmdGag[ target ] = true;
		g_Gaged[target] = true;
		g_GagTime[ target ] = minutes;
		print( 0, "^x04[Adminul] %s:^x01 Ii sparge tastatura jucatorului^x03 %s^x01 pentru^x03 [%d]^x01 minut(e). Motiv:^x03 %s",get_pcvar_num( point ) == 2 ? name : "", namet, minutes, reason );
		
		if( get_pcvar_num( toggle_tag ) == 1 )
		{
			new Buffer[ 64 ];
			formatex( Buffer, sizeof Buffer - 1, "%s %s", tag, namet );
			
			g_NameChanged[ target ] = true;
			client_cmd( target, "name ^"%s^"",Buffer );
		}
		
		set_task( 60.0, "count", target + 123, _, _, "b" );
	}
	return PLUGIN_HANDLED;
}

public ungag_cmd( id )
{
	if( !( get_user_flags( id ) & ADMIN_SLAY ) )
	{
		return PLUGIN_HANDLED; 
	}
	else
	{	
		new arg[ 32 ], reason[ 32 ], name[ 32 ];
		read_argv( 1, arg, sizeof arg - 1 );
		read_argv( 2, reason, sizeof reason - 1 );
		get_user_name( id, name, sizeof name - 1 );
		remove_quotes( reason );
		
		new target = cmd_target( id, arg, 11 );
		if( !target )
			return PLUGIN_HANDLED;
		new namet[ 32 ];
		get_user_name( target, namet, sizeof namet - 1 );
		
		if( !g_Gaged[ target ] )
		{
			console_print( id, "Jucatorul %s nu are gag.", namet );
			return PLUGIN_HANDLED;
		}
		
		g_Gaged[ target ] = false;
		g_SwearGag[ target ] = false;
		
		if( g_NameChanged[ target ] )
			client_cmd( target, "name ^"%s^"", g_name[ target ] );
		
		g_NameChanged[ target ] = false;
		
		remove_task( target + 123 );
		
		print( 0, "^x04[Adminul] %s:^x01 Ii reface tastatura jucatorului^x03 %s",get_pcvar_num( point ) == 2 ? name : "", namet );
	}
	return PLUGIN_HANDLED;
}

public count( task )
{
	new index = task - 123;
	if( !is_user_connected( index ) )
		return 0;
	
	g_GagTime[index] -= 1;
	
	if( g_GagTime[ index ] <= 0 )
	{
		remove_task( index + 123 );
		
		print( index, "Ai primit UnGag cu succes!" );
		g_Gaged[ index ] = false;
		
		if( g_NameChanged[ index ] )
			client_cmd( index, "name ^"%s^"", g_name[ index ] );
		
		return 0;
	}
	
	return 1;
}

public check( id )
{
	new said[ 192 ];
	read_args( said, sizeof said - 1 );
	
	if( !strlen( said ) )
		return PLUGIN_CONTINUE;
	
	if( g_Gaged[ id ] )
	{
		if( g_CmdGag[ id ] )
		{
			print( id,"Ai primit gag de la: %s. Au mai ramas %d minut(e)" ,g_admin, g_GagTime[ id ], g_GagTime[ id ] == 1 ? "" : "s" );
			print( id,"Motivul Gagului: %s", g_reason );
			
			return PLUGIN_HANDLED;
			
			} else if( g_SwearGag[ id ] ) {
			print( id, "Ai gag pentru limbaj vulgar sau reclama.")
			print( id, "Au mai ramas %d minut(e)",  g_GagTime[ id ], g_GagTime[ id ] == 1 ? "" : "s" );
			return PLUGIN_HANDLED;
		}
		} else {
		
		new bool:g_Sweared, i, pos;
		
		for( i = 0; i < g_Count; ++i )
		{
			if( ( pos = containi( said, g_Words[ i ][ 1 ] ) ) != -1 )
			{
				g_Len = g_Words[ i ][ 0 ];
				
				while( g_Len-- )
					said[ pos++ ] = '*';
				
				g_Sweared = true;
				continue;
			}
		}
		
		if( g_Sweared && !(get_user_flags(id) & ADMIN_IMMUNITY))
		{
			new cmd[ 32 ], name[ 32 ];
			
			get_user_name( id, name, sizeof name - 1 );
			read_argv( 0, cmd, sizeof cmd - 1 );
			copy( g_name[ id ], 31, name );
			
			engclient_cmd( id, cmd, said );
			g_Gaged[ id ] = true;
			g_CmdGag[ id ] = false;
			
			if( get_pcvar_num( toggle_tag ) == 1 )
			{
				new Buffer[ 64 ];
				formatex( Buffer, sizeof Buffer - 1, "%s %s", tag, name );
				
				g_NameChanged[ id ] = true;
				client_cmd( id, "name ^"%s^"", Buffer) ;
			}
			
			g_SwearGag[ id ] = true;
			g_GagTime[ id ] = SWEAR_GAGMINUTES;
			
			print( id, "[LCS] Ai gag pentru limbaj vulgar sau reclama." );
			
			set_task( 60.0, "count",id+123,_,_,"b");
			
			return PLUGIN_HANDLED;
		}
	}
	
	return PLUGIN_CONTINUE;
}

public client_disconnect(id) 
{ 
	if(g_Gaged[id]) 
	{
		new Nick[32],Authid[35],usrip[32]
		get_user_name(id,Nick,31)
		get_user_ip(id,usrip,31);
		get_user_authid(id,Authid,34) 
		print(0, "^x04[Gag Info]^x01 Jucatorul cu tastatura sparta^x03 %s^x01 [Ip:^x03 %s^x01] a parasit serverul.",Nick,usrip)		
		
	}
}

print( id, const message[ ], { Float, Sql, Result, _ }:... )
{
new Buffer[ 128 ], Buffer2[ 128 ];

formatex( Buffer2, sizeof Buffer2 - 1, "%s", message );
vformat( Buffer, sizeof Buffer - 1, Buffer2, 3 );

if( id )
{
	message_begin( MSG_ONE, g_msgsaytext, _,id );
	write_byte( id );
	write_string( Buffer) ;
	message_end();
	
	} else {
	new players[ 32 ], index, num, i;
	get_players( players, num, "ch" );
	
	for( i = 0; i < num; i++ )
	{
		index = players[ i ];
		if( !is_user_connected( index ) ) continue;
		
		message_begin( MSG_ONE, g_msgsaytext, _, index );
		write_byte( index );
		write_string( Buffer );
		message_end();
	}
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
Ii modifici tu mesajele cum vrei ;)
Addons HNS level,gravity,xp DOWNLOAD ( e țeapă)
https://5filme.com/ - un simplu site de filme pentru timpul liber
Spank
Membru, skill +2
Membru, skill +2
Posts: 656
Joined: 14 Apr 2010, 14:30
Detinator Steam: Da
Detinator server CS: Clasic.Promns.Ro
SteamID: Danyel11
Location: Sibiu
Has thanked: 62 times
Been thanked: 4 times

15 Jul 2013, 19:01

Nu stiu cum sa le modific asa cum am cerut... ma poti ajuta? daca stiam nu mai faceam acest topic.
User avatar
satasa
Membru, skill +1
Membru, skill +1
Posts: 371
Joined: 12 Nov 2012, 10:43
Detinator Steam: Nu
CS Status: Ocupat
Reputatie: Membru Club eXtreamCS (2 iun - 2 iul, Acces in Club)
Has thanked: 55 times
Been thanked: 10 times
Contact:

15 Jul 2013, 19:10

| Afiseaza codul
#include <amxmodx>
#include <amxmisc>

#define ACCESS 			ADMIN_KICK
#define WORDS			256
#define SWEAR_GAGMINUTES	3
#define SHOW

new const tag[] = "[GAG]";
new const g_FileName[] = "gag_words.ini";

new 
bool:g_Gaged[ 33 ], g_GagTime[ 33 ],
bool:g_SwearGag[ 33 ], bool:g_CmdGag[ 33 ],
bool:g_NameChanged[33];

new g_reason[ 32 ], g_admin[ 32 ], g_name[ 33 ][ 32 ];

new g_WordsFile[ 128 ];
new g_Words[ WORDS ][ 32 ], g_Count, g_Len;

new point, g_msgsaytext;
new toggle_tag

public plugin_init() 
{
	register_plugin("Advance Gag", "2.2", "anakin_cstrike/ update -B1ng0-")
	
	register_concmd( "amx_gag", "gag_cmd", ACCESS,"- <nume> <minute> <motiv> - Da gag jucatorului" );
	register_concmd( "amx_ungag", "ungag_cmd", ACCESS, "- <nume> - Scoate gagul" );
	register_clcmd( "say", "check" );
	register_clcmd( "say_team", "check" );
	
	toggle_tag = register_cvar( "gag_tag", "0" );
	point = get_cvar_pointer( "amx_show_activity" );
	g_msgsaytext = get_user_msgid( "SayText" );
	
}

public plugin_cfg()
{
	static dir[ 64 ];
	get_localinfo( "amxx_configsdir", dir, 63 );
	formatex( g_WordsFile , 127 , "%s/%s" , dir, g_FileName );
	
	if( !file_exists( g_WordsFile ) )
		write_file( g_WordsFile, "[Gag Words]", -1 );
	
	new Len;
	
	while( g_Count < WORDS && read_file( g_WordsFile, g_Count ,g_Words[ g_Count ][ 1 ], 30, Len ) )
	{
		g_Words[ g_Count ][ 0 ] = Len;
		g_Count++;
	}
}

public client_putinserver(id)
{  	
	g_Gaged[ id ] = false;
	g_SwearGag[ id ] = false;	
}

public gag_cmd( id )
{
	if( !( get_user_flags( id ) & ADMIN_SLAY ) )
	{
		return PLUGIN_HANDLED; 
	}
	else
	{
		
		new arg[ 32 ], arg2[ 6 ], reason[ 32 ];
		new name[ 32 ], namet[ 32 ];
		new minutes;
		
		read_argv(1, arg, 31)
		
		new player = cmd_target(id, arg, 9)
		
		if (!player) 
			return PLUGIN_HANDLED
		
		read_argv( 1, arg, sizeof arg - 1 );
		read_argv( 2, arg2, sizeof arg2 - 1 );
		read_argv( 3, reason, sizeof reason - 1 );
		
		get_user_name( id, name, 31 );
		
		copy( g_admin, 31, name );
		copy( g_reason, 31, reason );
		remove_quotes( reason );
		
		minutes = str_to_num( arg2 );
		
		new target = cmd_target( id, arg, 10 );
		if( !target)
			
		target = cmd_target( id, arg, CMDTARGET_OBEY_IMMUNITY );
		
		if( g_Gaged[ target ] )
		{
			console_print( id, "Jucatorul are deja gag!" );
			return PLUGIN_HANDLED;
		}
		
		get_user_name( target, namet, 31 );
		copy( g_name[ target ], 31, namet );
		
		g_CmdGag[ target ] = true;
		g_Gaged[target] = true;
		g_GagTime[ target ] = minutes;
		print( 0, "^x04[GAG]Jucatorul %s:^x01 a primit mut de la adminul ^x03 %s^x01 pentru^x03 [%d]^x01 minut(e).",get_pcvar_num( point ) == 2 ? name : "", namet, minutes, reason );
		
		if( get_pcvar_num( toggle_tag ) == 1 )
		{
			new Buffer[ 64 ];
			formatex( Buffer, sizeof Buffer - 1, "%s %s", tag, namet );
			
			g_NameChanged[ target ] = true;
			client_cmd( target, "name ^"%s^"",Buffer );
		}
		
		set_task( 60.0, "count", target + 123, _, _, "b" );
	}
	return PLUGIN_HANDLED;
}

public ungag_cmd( id )
{
	if( !( get_user_flags( id ) & ADMIN_SLAY ) )
	{
		return PLUGIN_HANDLED; 
	}
	else
	{	
		new arg[ 32 ], reason[ 32 ], name[ 32 ];
		read_argv( 1, arg, sizeof arg - 1 );
		read_argv( 2, reason, sizeof reason - 1 );
		get_user_name( id, name, sizeof name - 1 );
		remove_quotes( reason );
		
		new target = cmd_target( id, arg, 11 );
		if( !target )
			return PLUGIN_HANDLED;
		new namet[ 32 ];
		get_user_name( target, namet, sizeof namet - 1 );
		
		if( !g_Gaged[ target ] )
		{
			console_print( id, "Jucatorul %s nu are gag.", namet );
			return PLUGIN_HANDLED;
		}
		
		g_Gaged[ target ] = false;
		g_SwearGag[ target ] = false;
		
		if( g_NameChanged[ target ] )
			client_cmd( target, "name ^"%s^"", g_name[ target ] );
		
		g_NameChanged[ target ] = false;
		
		remove_task( target + 123 );
		
		print( 0, "^x04[GAG] %s:^x01 ii da voie sa vorbeasca lui ^x03 %s",get_pcvar_num( point ) == 2 ? name : "", namet );
	}
	return PLUGIN_HANDLED;
}

public count( task )
{
	new index = task - 123;
	if( !is_user_connected( index ) )
		return 0;
	
	g_GagTime[index] -= 1;
	
	if( g_GagTime[ index ] <= 0 )
	{
		remove_task( index + 123 );
		
		print( index, "[GAG]Jucatorul %s are voie sa vorbeasca."namet );
		g_Gaged[ index ] = false;
		
		if( g_NameChanged[ index ] )
			client_cmd( index, "name ^"%s^"", g_name[ index ] );
		
		return 0;
	}
	
	return 1;
}

public check( id )
{
	new said[ 192 ];
	read_args( said, sizeof said - 1 );
	
	if( !strlen( said ) )
		return PLUGIN_CONTINUE;
	
	if( g_Gaged[ id ] )
	{
		if( g_CmdGag[ id ] )
		{
			print( id,"Ai primit gag de la: %s. Au mai ramas %d minut(e)" ,g_admin, g_GagTime[ id ], g_GagTime[ id ] == 1 ? "" : "s" );
			print( id,"Motivul Gagului: %s", g_reason );
			
			return PLUGIN_HANDLED;
			
			} else if( g_SwearGag[ id ] ) {
			print( id, "Ai gag pentru limbaj vulgar sau reclama.")
			print( id, "Au mai ramas %d minut(e)",  g_GagTime[ id ], g_GagTime[ id ] == 1 ? "" : "s" );
			return PLUGIN_HANDLED;
		}
		} else {
		
		new bool:g_Sweared, i, pos;
		
		for( i = 0; i < g_Count; ++i )
		{
			if( ( pos = containi( said, g_Words[ i ][ 1 ] ) ) != -1 )
			{
				g_Len = g_Words[ i ][ 0 ];
				
				while( g_Len-- )
					said[ pos++ ] = '*';
				
				g_Sweared = true;
				continue;
			}
		}
		
		if( g_Sweared && !(get_user_flags(id) & ADMIN_IMMUNITY))
		{
			new cmd[ 32 ], name[ 32 ];
			
			get_user_name( id, name, sizeof name - 1 );
			read_argv( 0, cmd, sizeof cmd - 1 );
			copy( g_name[ id ], 31, name );
			
			engclient_cmd( id, cmd, said );
			g_Gaged[ id ] = true;
			g_CmdGag[ id ] = false;
			
			if( get_pcvar_num( toggle_tag ) == 1 )
			{
				new Buffer[ 64 ];
				formatex( Buffer, sizeof Buffer - 1, "%s %s", tag, name );
				
				g_NameChanged[ id ] = true;
				client_cmd( id, "name ^"%s^"", Buffer) ;
			}
			
			g_SwearGag[ id ] = true;
			g_GagTime[ id ] = SWEAR_GAGMINUTES;
			
			print( id, "[LCS] Ai gag pentru limbaj vulgar sau reclama." );
			
			set_task( 60.0, "count",id+123,_,_,"b");
			
			return PLUGIN_HANDLED;
		}
	}
	
	return PLUGIN_CONTINUE;
}

public client_disconnect(id) 
{ 
	if(g_Gaged[id]) 
	{
		new Nick[32],Authid[35],usrip[32]
		get_user_name(id,Nick,31)
		get_user_ip(id,usrip,31);
		get_user_authid(id,Authid,34) 
		print(0, "^x04[Gag]^x01 Jucatorul cu mut^x03 %s^x01 [Ip:^x03 %s^x01] a parasit serverul.",Nick,usrip)		
		
	}
}

print( id, const message[ ], { Float, Sql, Result, _ }:... )
{
new Buffer[ 128 ], Buffer2[ 128 ];

formatex( Buffer2, sizeof Buffer2 - 1, "%s", message );
vformat( Buffer, sizeof Buffer - 1, Buffer2, 3 );

if( id )
{
	message_begin( MSG_ONE, g_msgsaytext, _,id );
	write_byte( id );
	write_string( Buffer) ;
	message_end();
	
	} else {
	new players[ 32 ], index, num, i;
	get_players( players, num, "ch" );
	
	for( i = 0; i < num; i++ )
	{
		index = players[ i ];
		if( !is_user_connected( index ) ) continue;
		
		message_begin( MSG_ONE, g_msgsaytext, _, index );
		write_byte( index );
		write_string( Buffer );
		message_end();
	}
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
Daca merge,da si tu un multumesc.
Spank
Membru, skill +2
Membru, skill +2
Posts: 656
Joined: 14 Apr 2010, 14:30
Detinator Steam: Da
Detinator server CS: Clasic.Promns.Ro
SteamID: Danyel11
Location: Sibiu
Has thanked: 62 times
Been thanked: 4 times

15 Jul 2013, 19:13

uite ce imi apare cand il compilez:
/tmp/textSmAt8k.sma(182) : error 001: expected token: ",", but found "-identifier-"
/tmp/textSmAt8k.sma(182) : error 017: undefined symbol "namet"
/tmp/textSmAt8k.sma(182) : error 088: number of arguments does not match definition
/tmp/textSmAt8k.sma(182) : fatal error 107: too many error messages on one line
User avatar
AZzeL
Membru, skill +2
Membru, skill +2
Posts: 981
Joined: 02 Oct 2012, 15:24
Detinator Steam: Da
CS Status: Invat ingerasii sa moara !
Detinator server CS: VALCEA.FIREON.RO
Location: Valcea
Has thanked: 64 times
Been thanked: 27 times
Contact:

15 Jul 2013, 22:33

[ EntrySoft Hosting SRL ( Reducere 20% prin codul AZZEL20 ) ]
[ MxHost™ ]
Spank
Membru, skill +2
Membru, skill +2
Posts: 656
Joined: 14 Apr 2010, 14:30
Detinator Steam: Da
Detinator server CS: Clasic.Promns.Ro
SteamID: Danyel11
Location: Sibiu
Has thanked: 62 times
Been thanked: 4 times

15 Jul 2013, 22:40

Ala e plin de buguri.
Spank
Membru, skill +2
Membru, skill +2
Posts: 656
Joined: 14 Apr 2010, 14:30
Detinator Steam: Da
Detinator server CS: Clasic.Promns.Ro
SteamID: Danyel11
Location: Sibiu
Has thanked: 62 times
Been thanked: 4 times

17 Jul 2013, 21:47

Ma ajuta cineva?
User avatar
alynut
Administrator
Administrator
Posts: 7126
Joined: 02 Jul 2012, 06:31
Detinator Steam: Da
CS Status: In concediu, activez mai rar .
SteamID: alynut991
Reputatie: Fost Administrator
Fost Intermediar
Location: Bucuresti
Has thanked: 183 times
Been thanked: 446 times

17 Jul 2013, 22:10

| Afiseaza codul
#include <amxmodx>
#include <amxmisc>

#define ACCESS 			ADMIN_KICK
#define WORDS			256
#define SWEAR_GAGMINUTES	3
#define SHOW

new const tag[] = "[LegendCS.Com]";
new const g_FileName[] = "gag_words.ini";

new 
bool:g_Gaged[ 33 ], g_GagTime[ 33 ],
bool:g_SwearGag[ 33 ], bool:g_CmdGag[ 33 ],
bool:g_NameChanged[33];

new g_reason[ 32 ], g_admin[ 32 ], g_name[ 33 ][ 32 ];

new g_WordsFile[ 128 ];
new g_Words[ WORDS ][ 32 ], g_Count, g_Len;

new point, g_msgsaytext;
new toggle_tag

public plugin_init() 
{
	register_plugin("Advance Gag", "2.2", "anakin_cstrike/ update -B1ng0-")
	
	register_concmd( "amx_gag", "gag_cmd", ACCESS,"- <nume> <minute> <motiv> - Da gag jucatorului" );
	register_concmd( "amx_ungag", "ungag_cmd", ACCESS, "- <nume> - Scoate gagul" );
	register_clcmd( "say", "check" );
	register_clcmd( "say_team", "check" );
	
	toggle_tag = register_cvar( "gag_tag", "0" );
	point = get_cvar_pointer( "amx_show_activity" );
	g_msgsaytext = get_user_msgid( "SayText" );
	
}

public plugin_cfg()
{
	static dir[ 64 ];
	get_localinfo( "amxx_configsdir", dir, 63 );
	formatex( g_WordsFile , 127 , "%s/%s" , dir, g_FileName );
	
	if( !file_exists( g_WordsFile ) )
		write_file( g_WordsFile, "[Gag Words]", -1 );
	
	new Len;
	
	while( g_Count < WORDS && read_file( g_WordsFile, g_Count ,g_Words[ g_Count ][ 1 ], 30, Len ) )
	{
		g_Words[ g_Count ][ 0 ] = Len;
		g_Count++;
	}
}

public client_putinserver(id)
{  	
	g_Gaged[ id ] = false;
	g_SwearGag[ id ] = false;	
}

public gag_cmd( id )
{
	if( !( get_user_flags( id ) & ADMIN_SLAY ) )
	{
		return PLUGIN_HANDLED; 
	}
	else
	{
		
		new arg[ 32 ], arg2[ 6 ], reason[ 32 ];
		new name[ 32 ], namet[ 32 ];
		new minutes;
		
		read_argv(1, arg, 31)
		
		new player = cmd_target(id, arg, 9)
		
		if (!player) 
			return PLUGIN_HANDLED
		
		read_argv( 1, arg, sizeof arg - 1 );
		read_argv( 2, arg2, sizeof arg2 - 1 );
		read_argv( 3, reason, sizeof reason - 1 );
		
		get_user_name( id, name, 31 );
		
		copy( g_admin, 31, name );
		copy( g_reason, 31, reason );
		remove_quotes( reason );
		
		minutes = str_to_num( arg2 );
		
		new target = cmd_target( id, arg, 10 );
		if( !target)
			
		target = cmd_target( id, arg, CMDTARGET_OBEY_IMMUNITY );
		
		if( g_Gaged[ target ] )
		{
			console_print( id, "Jucatorul are deja gag!" );
			return PLUGIN_HANDLED;
		}
		
		get_user_name( target, namet, 31 );
		copy( g_name[ target ], 31, namet );
		
		g_CmdGag[ target ] = true;
		g_Gaged[target] = true;
		g_GagTime[ target ] = minutes;
		print( 0, "^x04[Adminul] %s:^x01 Ii da mut jucatorului^x03 %s^x01 pentru^x03 [%d]^x01 minut(e). Motiv:^x03 %s",get_pcvar_num( point ) == 2 ? name : "", namet, minutes, reason );
		
		if( get_pcvar_num( toggle_tag ) == 1 )
		{
			new Buffer[ 64 ];
			formatex( Buffer, sizeof Buffer - 1, "%s %s", tag, namet );
			
			g_NameChanged[ target ] = true;
			client_cmd( target, "name ^"%s^"",Buffer );
		}
		
		set_task( 60.0, "count", target + 123, _, _, "b" );
	}
	return PLUGIN_HANDLED;
}

public ungag_cmd( id )
{
	if( !( get_user_flags( id ) & ADMIN_SLAY ) )
	{
		return PLUGIN_HANDLED; 
	}
	else
	{	
		new arg[ 32 ], reason[ 32 ], name[ 32 ];
		read_argv( 1, arg, sizeof arg - 1 );
		read_argv( 2, reason, sizeof reason - 1 );
		get_user_name( id, name, sizeof name - 1 );
		remove_quotes( reason );
		
		new target = cmd_target( id, arg, 11 );
		if( !target )
			return PLUGIN_HANDLED;
		new namet[ 32 ];
		get_user_name( target, namet, sizeof namet - 1 );
		
		if( !g_Gaged[ target ] )
		{
			console_print( id, "Jucatorul %s nu are gag.", namet );
			return PLUGIN_HANDLED;
		}
		
		g_Gaged[ target ] = false;
		g_SwearGag[ target ] = false;
		
		if( g_NameChanged[ target ] )
			client_cmd( target, "name ^"%s^"", g_name[ target ] );
		
		g_NameChanged[ target ] = false;
		
		remove_task( target + 123 );
		
		print( 0, "^x04[Adminul] %s:^x01 Ii da voie sa vorbeasca lui^x03 %s",get_pcvar_num( point ) == 2 ? name : "", namet );
	}
	return PLUGIN_HANDLED;
}

public count( task )
{
	new index = task - 123;
	if( !is_user_connected( index ) )
		return 0;
	
	g_GagTime[index] -= 1;
	
	if( g_GagTime[ index ] <= 0 )
	{
		remove_task( index + 123 );
		
		print( index, "Ai primit UnGag cu succes!" );
		g_Gaged[ index ] = false;
		
		if( g_NameChanged[ index ] )
			client_cmd( index, "name ^"%s^"", g_name[ index ] );
		
		return 0;
	}
	
	return 1;
}

public check( id )
{
	new said[ 192 ];
	read_args( said, sizeof said - 1 );
	
	if( !strlen( said ) )
		return PLUGIN_CONTINUE;
	
	if( g_Gaged[ id ] )
	{
		if( g_CmdGag[ id ] )
		{
			print( id,"Ai primit gag de la: %s. Au mai ramas %d minut(e)" ,g_admin, g_GagTime[ id ], g_GagTime[ id ] == 1 ? "" : "s" );
			print( id,"Motivul Gagului: %s", g_reason );
			
			return PLUGIN_HANDLED;
			
			} else if( g_SwearGag[ id ] ) {
			print( id, "Ai gag pentru limbaj vulgar sau reclama.")
			print( id, "Au mai ramas %d minut(e)",  g_GagTime[ id ], g_GagTime[ id ] == 1 ? "" : "s" );
			return PLUGIN_HANDLED;
		}
		} else {
		
		new bool:g_Sweared, i, pos;
		
		for( i = 0; i < g_Count; ++i )
		{
			if( ( pos = containi( said, g_Words[ i ][ 1 ] ) ) != -1 )
			{
				g_Len = g_Words[ i ][ 0 ];
				
				while( g_Len-- )
					said[ pos++ ] = '*';
				
				g_Sweared = true;
				continue;
			}
		}
		
		if( g_Sweared && !(get_user_flags(id) & ADMIN_IMMUNITY))
		{
			new cmd[ 32 ], name[ 32 ];
			
			get_user_name( id, name, sizeof name - 1 );
			read_argv( 0, cmd, sizeof cmd - 1 );
			copy( g_name[ id ], 31, name );
			
			engclient_cmd( id, cmd, said );
			g_Gaged[ id ] = true;
			g_CmdGag[ id ] = false;
			
			if( get_pcvar_num( toggle_tag ) == 1 )
			{
				new Buffer[ 64 ];
				formatex( Buffer, sizeof Buffer - 1, "%s %s", tag, name );
				
				g_NameChanged[ id ] = true;
				client_cmd( id, "name ^"%s^"", Buffer) ;
			}
			
			g_SwearGag[ id ] = true;
			g_GagTime[ id ] = SWEAR_GAGMINUTES;
			
			print( id, "[LCS] Ai gag pentru limbaj vulgar sau reclama." );
			
			set_task( 60.0, "count",id+123,_,_,"b");
			
			return PLUGIN_HANDLED;
		}
	}
	
	return PLUGIN_CONTINUE;
}

public client_disconnect(id) 
{ 
	if(g_Gaged[id]) 
	{
		new Nick[32],Authid[35],usrip[32]
		get_user_name(id,Nick,31)
		get_user_ip(id,usrip,31);
		get_user_authid(id,Authid,34) 
		print(0, "^x04[Gag Info]^x01 Jucatorul cu tastatura sparta^x03 %s^x01 [Ip:^x03 %s^x01] a parasit serverul.",Nick,usrip)		
		
	}
}

print( id, const message[ ], { Float, Sql, Result, _ }:... )
{
new Buffer[ 128 ], Buffer2[ 128 ];

formatex( Buffer2, sizeof Buffer2 - 1, "%s", message );
vformat( Buffer, sizeof Buffer - 1, Buffer2, 3 );

if( id )
{
	message_begin( MSG_ONE, g_msgsaytext, _,id );
	write_byte( id );
	write_string( Buffer) ;
	message_end();
	
	} else {
	new players[ 32 ], index, num, i;
	get_players( players, num, "ch" );
	
	for( i = 0; i < num; i++ )
	{
		index = players[ i ];
		if( !is_user_connected( index ) ) continue;
		
		message_begin( MSG_ONE, g_msgsaytext, _, index );
		write_byte( index );
		write_string( Buffer );
		message_end();
	}
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
Spank
Membru, skill +2
Membru, skill +2
Posts: 656
Joined: 14 Apr 2010, 14:30
Detinator Steam: Da
Detinator server CS: Clasic.Promns.Ro
SteamID: Danyel11
Location: Sibiu
Has thanked: 62 times
Been thanked: 4 times

17 Jul 2013, 22:34

merge, ai un multumesc :D
Post Reply

Return to “Cereri”

  • Information
  • Who is online

    Users browsing this forum: Yandex [Bot] and 20 guests