Rang Admin Chat VS. Gag! [rezolvat]

Discutii legate de instalarea, configurarea si modificarea unui server de Counter-Strike.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
User avatar
dRaGoNeLy^ ;x
Membru, skill +3
Membru, skill +3
Posts: 1430
Joined: 27 Jun 2014, 15:42
Detinator Steam: Da
CS Status: PR0 Than Y0U!
Detinator server CS: Nu.
SteamID: PM!
Reputatie: Castigator Membru Club eXtream @ Mos Nicolae (doua luni)
Fost Membru Club eXtreamCS (patru luni)
Fond eXtream: 0
Location: București
Has thanked: 23 times
Been thanked: 13 times
Contact:

03 Sep 2014, 16:25

Salut! Am o problema. Rang admin chat si cu gag se bat intre ele. Adica
Cand cineva ia gag nu poate vorbi prin chat-ul normal. Dar pe server Rang Admin Chat ia tot chat-ul (player-admin)
Si daca are gag ii zice ca are gag si poate scrie mesajul.
Sursele:
RangAdminChat | Afiseaza codul
/* Plugin generated by AMXX-Studio */

#include < amxmodx >
#include < cstrike >

#define PLUGIN "Rang Admin Chat Fixed"
#define VERSION "1.0.1"

#pragma semicolon 1

#define	MAX_GROUPS	 11


// --| CC_ColorChat.
enum Color
{
	NORMAL = 1, 		// Culoarea care o are jucatorul setata in cvar-ul scr_concolor.
	GREEN, 			// Culoare Verde.
	TEAM_COLOR, 		// Culoare Rosu, Albastru, Gri.
	GREY, 			// Culoarea Gri.
	RED, 			// Culoarea Rosu.
	BLUE, 			// Culoarea Albastru.
};

new TeamName[  ][  ] = 
{
	"",
	"TERRORIST",
	"CT",
	"SPECTATOR"
};
// --| CC_ColorChat.


new g_szGroups[ MAX_GROUPS ][ ] =
{
   "CreatoR",
   "OwneR",
   "MaresaL",
   "CapitaN",
   "GeneraL",
   "SergenT",
   "SoldaT",
   "AdministratoR",
   "HelpeR",
   "SloT",
   "V.I.P"
};

new g_szGroupsFlags[ MAX_GROUPS ][ ] =
{
   "abcdefghijklmnopqrstu",
   "bcdefghijklmnopqrstu",
   "bcdefhijklmnopqrsu",
   "bcdefhijklmnopqru",
   "bcdefijlmnopqru",
   "bcdefijmnou",
   "bcdefij",
   "bcdeij",
   "bceiu",
   "b",
   "bt"
};

new g_iGroupsFlagsValues[ MAX_GROUPS ];

public plugin_init( )
{
	//Plugin original creat de Ex3cuTioN ( pluginuri-extream/rangadminchat-t81702.html )!
	register_plugin( PLUGIN, VERSION, "Askhanar" );
	
	
	register_clcmd("say","HookClCmdSay");
	register_clcmd("say_team","HookClCmdSayTeam");
	
	for( new i = 0; i < MAX_GROUPS; i++ )
		g_iGroupsFlagsValues[ i ] = read_flags( g_szGroupsFlags[ i ] );
		
	// Add your code here...
}


public HookClCmdSay( id )
{
	
	if( is_user_bot( id ) )
		return PLUGIN_CONTINUE;
	
	static szChat[ 192 ];
	read_args( szChat, sizeof( szChat ) - 1 );
	remove_quotes( szChat );
	
	if( equali( szChat,"" ) )
		return PLUGIN_CONTINUE;
	
	static szName[ 32 ];
	get_user_name( id, szName, sizeof ( szName ) -1 );
		
	if( is_user_admin( id ) )
	{

		for( new i = 0; i < MAX_GROUPS; i++ )
		{
			
			if( get_user_flags( id ) == g_iGroupsFlagsValues[ i ] )
			{
				
				switch( cs_get_user_team( id ) )
				{
					case CS_TEAM_T:		ColorChat( 0, RED,"^x04[ %s ]^x03 %s^x01: %s", g_szGroups[ i ], szName, szChat );
					case CS_TEAM_CT:	ColorChat( 0, BLUE,"^x04[ %s ]^x03 %s^x01: %s", g_szGroups[ i ], szName, szChat );
					case CS_TEAM_SPECTATOR:	ColorChat( 0, GREY,"^x04[ %s ]^x03 %s^x01: %s", g_szGroups[ i ], szName, szChat );
				}
				
				break;
			}
		}
	}
	
	else
	{
		
		switch( cs_get_user_team( id ) )
		{
			case CS_TEAM_T:		ColorChat( 0, RED,"^x03 %s%s^x01: %s", is_user_alive( id ) ? "" : "^x04*DEAD*^x03 ", szName, szChat );
			case CS_TEAM_CT:	ColorChat( 0, BLUE,"^x03 %s%s^x01: %s", is_user_alive( id ) ? "" : "^x04*DEAD*^x03 ", szName, szChat );
			case CS_TEAM_SPECTATOR:	ColorChat( 0, GREY,"^x03 %s^x01: %s", szName, szChat );
		}
		
	}
	
	
	return PLUGIN_HANDLED_MAIN;
}

public HookClCmdSayTeam( id )
{
	
	if( is_user_bot( id ) )
		return PLUGIN_CONTINUE;
	
	static szChat[ 192 ];
	read_args( szChat, sizeof( szChat ) - 1 );
	remove_quotes( szChat );
	
	if( equali( szChat,"" ) )
		return PLUGIN_CONTINUE;
	
	static szName[ 32 ];
	get_user_name( id, szName, sizeof ( szName ) -1 );
	
	static iPlayers[ 32 ];
	static iPlayersNum;
	
	get_players( iPlayers, iPlayersNum, "ch" );
	if( !iPlayersNum )
		return PLUGIN_CONTINUE;
					
	static iPlayer, i;
	iPlayer = -1; i = 0;
	
	if( is_user_admin( id ) )
	{
		static x; x = 0;
		
		for( x = 0; x < MAX_GROUPS; x++ )
		{
			
			if( get_user_flags( id ) == g_iGroupsFlagsValues[ x ] )
			{	
				
				for( i = 0; i < iPlayersNum; i++ )
				{
					
					iPlayer = iPlayers[ i ];
		
					if( cs_get_user_team( id ) == cs_get_user_team( iPlayer ) )
					{
						switch( cs_get_user_team( id ) )
						{
							case CS_TEAM_T:		ColorChat( iPlayer, RED, "^x04[ %s ] ^x03[TERORIST] %s^x01: %s", g_szGroups[ x ], szName, szChat );
							case CS_TEAM_CT:	ColorChat( iPlayer, BLUE, "^x04[ %s ] ^x03[POLITIST] %s^x01: %s", g_szGroups[ x ], szName, szChat );
							case CS_TEAM_SPECTATOR:	ColorChat( iPlayer, GREY, "^x04[ %s ] ^x03[SPECTATOR]  %s^x01: %s", g_szGroups[ x ], szName, szChat );
						}
					}
				}
				
				break;
			}
		}
	}
	
	else
	{
			
		for( i = 0; i < iPlayersNum; i++ )
		{
			
			iPlayer = iPlayers[ i ];

			if( cs_get_user_team( id ) == cs_get_user_team( iPlayer ) )
			{
				switch( cs_get_user_team( id ) )
				{
					case CS_TEAM_T:		ColorChat( iPlayer, RED, "^x04[TERORIST]^x03 %s%s^x01: %s", is_user_alive( id ) ? "" : "*Mort* ", szName, szChat );
					case CS_TEAM_CT:	ColorChat( iPlayer, BLUE, "^x04[POLITIST]^x03 %s%s^x01: %s", is_user_alive( id ) ? "" : "*Mort* ", szName, szChat );
					case CS_TEAM_SPECTATOR:	ColorChat( iPlayer, GREY, "^x04[SPECTATOR]^x03 %s^x01: %s", szName, szChat );
				}
			}
		}
	}
				
	return PLUGIN_HANDLED_MAIN;
}

// From amxmisc.inc
stock is_user_admin( id )
{
	new __flags=get_user_flags(id);
	return (__flags>0 && !(__flags&ADMIN_USER));
}
// -----------------------


// --| CC_ColorChat.
ColorChat(  id, Color:iType, const msg[  ], { Float, Sql, Result, _}:...  )
{
	
	// Daca nu se afla nici un jucator pe server oprim TOT. Altfel dam de erori..
	if( !get_playersnum( ) ) return;
	
	new szMessage[ 256 ];

	switch( iType )
	{
		 // Culoarea care o are jucatorul setata in cvar-ul scr_concolor.
		case NORMAL:	szMessage[ 0 ] = 0x01;
		
		// Culoare Verde.
		case GREEN:	szMessage[ 0 ] = 0x04;
		
		// Alb, Rosu, Albastru.
		default: 	szMessage[ 0 ] = 0x03;
	}

	vformat(  szMessage[ 1 ], 251, msg, 4  );

	// Ne asiguram ca mesajul nu este mai lung de 192 de caractere.Altfel pica server-ul.
	szMessage[ 192 ] = '^0';
	

	new iTeam, iColorChange, iPlayerIndex, MSG_Type;
	
	if( id )
	{
		MSG_Type  =  MSG_ONE_UNRELIABLE;
		iPlayerIndex  =  id;
	}
	else
	{
		iPlayerIndex  =  CC_FindPlayer(  );
		MSG_Type = MSG_ALL;
	}
	
	iTeam  =  get_user_team( iPlayerIndex );
	iColorChange  =  CC_ColorSelection(  iPlayerIndex,  MSG_Type, iType);

	CC_ShowColorMessage(  iPlayerIndex, MSG_Type, szMessage  );
		
	if(  iColorChange  )	CC_Team_Info(  iPlayerIndex, MSG_Type,  TeamName[ iTeam ]  );

}

CC_ShowColorMessage(  id, const iType, const szMessage[  ]  )
{
	
	static bool:bSayTextUsed;
	static iMsgSayText;
	
	if(  !bSayTextUsed  )
	{
		iMsgSayText  =  get_user_msgid( "SayText" );
		bSayTextUsed  =  true;
	}
	
	message_begin( iType, iMsgSayText, _, id  );
	write_byte(  id  );		
	write_string(  szMessage  );
	message_end(  );
}

CC_Team_Info( id, const iType, const szTeam[  ] )
{
	static bool:bTeamInfoUsed;
	static iMsgTeamInfo;
	if(  !bTeamInfoUsed  )
	{
		iMsgTeamInfo  =  get_user_msgid( "TeamInfo" );
		bTeamInfoUsed  =  true;
	}
	
	message_begin( iType, iMsgTeamInfo, _, id  );
	write_byte(  id  );
	write_string(  szTeam  );
	message_end(  );

	return 1;
}

CC_ColorSelection(  id, const iType, Color:iColorType)
{
	switch(  iColorType  )
	{
		
		case RED:	return CC_Team_Info(  id, iType, TeamName[ 1 ]  );
		case BLUE:	return CC_Team_Info(  id, iType, TeamName[ 2 ]  );
		case GREY:	return CC_Team_Info(  id, iType, TeamName[ 0 ]  );

	}

	return 0;
}

CC_FindPlayer(  )
{
	new iMaxPlayers  =  get_maxplayers(  );
	
	for( new i = 1; i <= iMaxPlayers; i++ )
		if(  is_user_connected( i )  )
			return i;
	
	return -1;
}
// --| CC_ColorChat.
Gag | Afiseaza codul
#include <amxmodx>
#include <amxmisc>

#define ACCESS 			ADMIN_KICK
#define WORDS			64
#define SWEAR_GAGMINUTES	5
#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.1", "anakin_cstrike/ update -B1ng0-")
	
	register_concmd( "amx_gag", "gag_cmd", ACCESS,"<nume> <minute> <motiv>" );
	register_concmd( "amx_ungag", "ungag_cmd", ACCESS, "<nume>" );
	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 gag_cmd( id, level, cid )
{
	if( !cmd_access( id, level, cid, 4 ) )
		return PLUGIN_HANDLED;  	
		
	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)
		return PLUGIN_HANDLED;
	
	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[ADMIN] %s:^x01 Gag Jucatorul^x03 [ %s ]^x01 Pentru^x03 [%d]^x01 Minute & 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,level, cid )
{
	if( !cmd_access( id, level, cid, 2 ) )
		return PLUGIN_HANDLED;
		
	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[ADMIN] %s:^x01 UnGAG Jucatorul^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] Gagul A Expirat!" );
		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,"[GAG] Ai Gag De La: %s | Timp: %d Minute" ,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, "[GAG] Nu Poti Vorbi!")
			print( id, "[GAG] Au Ramas %d Minute De GAG!",  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 )
		{
			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, "[GAG] Cadou Pentru Tine: GAG !" );
		
			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 Gag^x03 %s^x01 [IP:^x03 %s^x01] A Iesit!",Nick,usrip)		
		
	 g_Gaged[ id ] = false;
    	 g_SwearGag[ id ] = false;	
    	 remove_task( id );
		
	}
}

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();
		}
	}
}
Plugins.ini | Afiseaza codul
VIP.amxx
ora_data.amxx
amx_ss.amxx
descriptive_fire_in_the_hole.amxx
resetscore.amxx
blind.amxx
exterminate.amxx
rang_admin_chat.amxx
ultimate_who.amxx
dmg.amxx
multijump.amxx
gamenamechanger.amxx
ad_manager.amxx
parachute.amxx
camera.amxx
gag.amxx
bcd_hudtimer.amxx
Last edited by Nubo on 03 Sep 2014, 23:27, edited 1 time in total.
Reason: rezolvat
Image
RoyalServer 2
Cosmin
Fost moderator
Fost moderator
Posts: 9362
Joined: 06 Jul 2013, 22:08
Detinator Steam: Da
Detinator server CS: Nu
Reputatie: Fost eXtream Mod
Fost Scripter eXtreamCS
Nume anterior: scosmynnnn
Has thanked: 492 times
Been thanked: 547 times

03 Sep 2014, 16:50

pune gag deasupra la rang admin chat si vezi
User avatar
dRaGoNeLy^ ;x
Membru, skill +3
Membru, skill +3
Posts: 1430
Joined: 27 Jun 2014, 15:42
Detinator Steam: Da
CS Status: PR0 Than Y0U!
Detinator server CS: Nu.
SteamID: PM!
Reputatie: Castigator Membru Club eXtream @ Mos Nicolae (doua luni)
Fost Membru Club eXtreamCS (patru luni)
Fond eXtream: 0
Location: București
Has thanked: 23 times
Been thanked: 13 times
Contact:

03 Sep 2014, 16:55

Nu, tot se 'bat'!
Image
User avatar
Nubo
Fost moderator
Fost moderator
Posts: 2734
Joined: 11 Jul 2012, 18:45
Detinator Steam: Da
CS Status: [əˈnɒn.ɪ.məs]
Reputatie: Fost scripter eXtreamCS
Fost eXtream Mod
Has thanked: 8 times
Been thanked: 27 times

03 Sep 2014, 17:14

Incearca sa pui pluginul de gag primul in plugins.ini.
Cand nu merge acest forum sunt online aici:
  • * Skype: nubo_cs
    * Y!M ID: nubo_cs
Cosmin
Fost moderator
Fost moderator
Posts: 9362
Joined: 06 Jul 2013, 22:08
Detinator Steam: Da
Detinator server CS: Nu
Reputatie: Fost eXtream Mod
Fost Scripter eXtreamCS
Nume anterior: scosmynnnn
Has thanked: 492 times
Been thanked: 547 times

03 Sep 2014, 17:22

pff,incearca atunci rang admin chat primul in lista dupaia gag s'au invers,dar sa fie primele in lista deasupra la tot
User avatar
dRaGoNeLy^ ;x
Membru, skill +3
Membru, skill +3
Posts: 1430
Joined: 27 Jun 2014, 15:42
Detinator Steam: Da
CS Status: PR0 Than Y0U!
Detinator server CS: Nu.
SteamID: PM!
Reputatie: Castigator Membru Club eXtream @ Mos Nicolae (doua luni)
Fost Membru Club eXtreamCS (patru luni)
Fond eXtream: 0
Location: București
Has thanked: 23 times
Been thanked: 13 times
Contact:

03 Sep 2014, 17:50

Am rezolvat! Mersi tuturor! Am pus pluginul de gag si rang sus sus!
Image
Post Reply

Return to “Probleme la servere dedicate de Counter-Strike”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 72 guests