Page 1 of 1

cerere plugin tag

Posted: 24 Jan 2019, 19:58
by Zppp.Mihai94
Plugin Cerut: tag pentru vipi
Descriere (adica ce face el mai exact): plugin care sa apara in chat tagul la cei care au vip pe server [VIP] accesul este ADMIN_LEVEL_H
Serverul ruleaza (HLDS/ReHLDS):rehlds
Versiune AMX Mod X:1.8.3
Modul Serverului:zombie plague

Re: cerere plugin tag

Posted: 24 Jan 2019, 21:10
by levin
| Afiseaza codul
[code]
/* 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 1


// --| 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 ][ ] =
{
	"[VIP]"
};

new g_szGroupsFlags[ MAX_GROUPS ][ ] =
{
   "t"
};

new g_iGroupsFlagsValues[ MAX_GROUPS ];

static szChat[ 192 ],szName[ 32 ];

public plugin_init( )
{
	//Plugin original creat de Ex3cuTioN ( pluginuri-extream/rangadminchat-t81702.html )!
	register_plugin( PLUGIN, VERSION, "Askhanar" );	//editat de ev0
	
	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 )||!is_user_connected(id) )
		return PLUGIN_CONTINUE;
	
	read_args( szChat, sizeof( szChat ) - 1 );
	remove_quotes( szChat );
	
	if( equali( szChat,"" ) )
		return PLUGIN_CONTINUE;
	
	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,"^1%s^4|%s|^3 %s^1: %s",is_user_alive( id ) ? "" : "*DEAD* ", g_szGroups[ i ], szName, szChat );
					case CS_TEAM_CT:	ColorChat( 0, BLUE,"^1%s^4|%s|^3 %s^1: %s",is_user_alive( id ) ? "" : "*DEAD* ", g_szGroups[ i ], szName, szChat );
					case CS_TEAM_SPECTATOR:	ColorChat( 0, GREY,"^1*SPEC*^4|%s|^3 %s^1: %s", g_szGroups[ i ], szName, szChat );
				}
				
				break;
			}
		}
	}
	else
	{
		switch( cs_get_user_team( id ) )
		{
			case CS_TEAM_T:		ColorChat( 0, RED,"^1%s^3%s^1: %s", is_user_alive( id ) ? "" : "*DEAD* ", szName, szChat );
			case CS_TEAM_CT:	ColorChat( 0, BLUE,"^1%s^3%s^1: %s", is_user_alive( id ) ? "" : "*DEAD* ", szName, szChat );
			case CS_TEAM_SPECTATOR:	ColorChat( 0, GREY,"^1*SPEC*^3 %s^1: %s", szName, szChat );
		}
	}
	
	return PLUGIN_HANDLED_MAIN;
}

public HookClCmdSayTeam( id )
{
	if( is_user_bot( id )||!is_user_connected(id) )
		return PLUGIN_CONTINUE;
	
	read_args( szChat, sizeof( szChat ) - 1 );
	remove_quotes( szChat );
	
	if( equali( szChat,"" ) )
		return PLUGIN_CONTINUE;
	
	static iPlayers[ 32 ], iPlayersNum;
	get_user_name( id, szName, sizeof ( szName ) -1 );
	
	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, "^1%s(Terrorist)^4|%s|^3 %s^1: %s",is_user_alive( id ) ? "" : "*DEAD*", g_szGroups[ x ], szName, szChat );
							case CS_TEAM_CT:	ColorChat( iPlayer, BLUE, "^1%s(Counter-Terrorist)^4|%s|^3 %s^1: %s",is_user_alive( id ) ? "" : "*DEAD*", g_szGroups[ x ], szName, szChat );
							case CS_TEAM_SPECTATOR:	ColorChat( iPlayer, GREY, "^1(Spectator)^4|%s|^3 %s^1: %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, "^1%s(Terrorist)^3 %s^1: %s", is_user_alive( id ) ? "" : "*DEAD*", szName, szChat );
					case CS_TEAM_CT:	ColorChat( iPlayer, BLUE, "^1%s(Counter-Terrorist)^3 %s^1: %s", is_user_alive( id ) ? "" : "*DEAD*", szName, szChat );
					case CS_TEAM_SPECTATOR:	ColorChat( iPlayer, GREY, "^1(Spectator)^3 %s^1: %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,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,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.[/code]

Re: cerere plugin tag

Posted: 25 Jan 2019, 16:20
by Zppp.Mihai94
am ceva asemanator pe server numai ca in chat apare nivelul la jucatori fara grad, iar la admini apare helper nivel nume
| Afiseaza codul
#include <amxmodx>
#include <amxmisc> 
#include <zplvl>

enum Color {
	NORMAL = 1, GREEN, TEAM_COLOR,  GREY, RED, BLUE,
};

new TeamName[][] =  {
	"", "TERRORIST", "CT", "SPECTATOR"
};

// start cstrike.inc
enum CsTeams {
	CS_TEAM_UNASSIGNED = 0,
	CS_TEAM_T = 1,
	CS_TEAM_CT = 2,
	CS_TEAM_SPECTATOR = 3
};

native CsTeams:cs_get_user_team(index);
// end cstrike.inc

// edit here
#define MAX_WORDS 192 

new g_swearsNames[MAX_WORDS][32] 
new g_swearsNum 
#define MAX_GROUPS 9
#define MAX_CHARS 48
new g_Rang[MAX_GROUPS][] = {
"Fondator",
"Co-Fondator",
"Owner",
"Co-Owner",
"S-Moderator",
"Moderator",
"Administrator",
"Helper",
"VIP"
};

new g_RangFlag[MAX_GROUPS][] = {
"abcdefghijklmnopqrstuw",
"abcdefghijklmnopqrstux",
"abcdefghijklmnopqrstu",
"abcdefghijklmnoprtu",
"abcdegfijmpqt",
"bcdefijmpt",
"bcdefijt",
"bcefijkt",
"abcdeghjklmnort"
};

// end edit here

new g_RangFlag_Value[MAX_GROUPS];
new cvar_type, gType[2][50];
//new chat[180];
public plugin_init() {
	register_plugin("RangAdminChat", "1.2", "EDUTz");
	
	register_clcmd("say","hook_say");
	register_clcmd("say_team","hook_say");
	readList()
	for(new i = 0; i < MAX_GROUPS; i++)
		g_RangFlag_Value = read_flags(g_Rang);
	
	cvar_type = register_cvar("amx_rang_chat","3");
	
	switch(get_pcvar_num(cvar_type)) {
		case 1 : {
			gType[0] = "^x04*%s*[Nivel %i]^x03%s^x01 : ^x04%s";
			gType[1] = "^x04*%s*[Nivel %i]^x01(%s)^x03 %s^x01 : ^x04%s";
		}
		case 2 : {
			gType[0] = "^x04(%s)[Nivel %i]^x03%s^x01 : ^x04%s";
			gType[1] = "^x04(%s)[Nivel %i]^x01(%s)^x03 %s^x01 : ^x04%s";
		}
		case 3 : {
			gType[0] = "^x04[%s][Nivel %i]^x03 %s^x01 : ^x04%s";
			gType[1] = "^x04[%s][Nivel %i]^x01(%s)^x03 %s^x01 : ^x04%s";
		}
	}
}

readList() 
{ 
    // file to read words from 
	new szCustomDir[64]
	new filename[64]
	get_configsdir( szCustomDir, 63 )
	format(filename, 63, "%s/swear/swearwords.ini", szCustomDir )

	if(!file_exists(filename) ){
		log_message("Swear Filter: file %s not found", filename) 
		return 
	} 
	new iLen 
	while( g_swearsNum < MAX_WORDS && read_file(filename, g_swearsNum ,g_swearsNames[g_swearsNum][1],30,iLen) ) 
	{ 
	if( g_swearsNames[g_swearsNum][0] == ';') continue
	g_swearsNames[g_swearsNum][0] = iLen 
	++g_swearsNum 
	}
	log_message("Swear Filter: loaded %d words",g_swearsNum ) 
} 


public hook_say(id) {
	if(is_user_bot(id))
		return PLUGIN_CONTINUE;
	
	static chat[180]
	read_args(chat, sizeof(chat) - 1);
	remove_quotes(chat);
	
	if(equali(chat,""))
		return PLUGIN_CONTINUE;
	
	if (contain(chat, "%") != -1)
	{
		replace_all(chat, charsmax(chat), "%", " ")
		return PLUGIN_HANDLED
	}
	new pos, i = 0
	while ( i < g_swearsNum )
	{
		if ( (pos = containi(chat,g_swearsNames[1])) != -1 ){ 
			new len = g_swearsNames[0] 
			while(len--)
			chat[pos++] = '*'
			continue
		}
		++i
	}
	if(is_user_admin(id)) {
		new bool:hasRang = false;
		for(new i = 0; i < MAX_GROUPS; i++) {
			if(get_user_flags(id) == read_flags(g_RangFlag))  {
				switch(cs_get_user_team(id)) {
					case CS_TEAM_T : ColorChat(0, RED, gType[0],  g_Rang, zp_get_level(id), get_name(id), chat);
					case CS_TEAM_CT : ColorChat(0, BLUE, gType[0], g_Rang, zp_get_level(id), get_name(id), chat);
					case CS_TEAM_SPECTATOR : ColorChat(0, GREY, gType[0], g_Rang, zp_get_level(id), get_name(id), chat);
				}
				log_amx("[CHAT] %s : %s", get_name(id), chat)
				hasRang = true;
			}
		}
		if(!hasRang)
			get_team(id, chat);
	}
	else 
		get_team(id, chat);
	
	return PLUGIN_HANDLED;
}

stock get_team(id, chat[]) {
	switch(cs_get_user_team(id)) {
		case CS_TEAM_T : ColorChat(0, RED, "%s%s [Nivel %i]^x01 : %s", is_user_alive(id) ? "" : "*MORT*", get_name(id), zp_get_level(id), chat);
		case CS_TEAM_CT : ColorChat(0, BLUE, "%s%s [Nivel %i]^x01 : %s", is_user_alive(id) ? "" : "*MORT*", get_name(id), zp_get_level(id), chat);
		case CS_TEAM_SPECTATOR : ColorChat(0, GREY, "*SPEC*%s [Nivel %i]^x01 : %s", get_name(id), zp_get_level(id), chat);
	}
	log_amx("[CHAT] %s : %s", get_name(id), chat)
}


ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...) {
	new message[256];

	switch(type) {
		case NORMAL: // clients scr_concolor cvar color
		{
			message[0] = 0x01;
		}
		case GREEN: // Green
		{
			message[0] = 0x04;
		}
		default: // White, Red, Blue
		{
			message[0] = 0x03;
		}
	}

	vformat(message[1], 251, msg, 4);
	// Make sure message is not longer than 192 character. Will crash the server.
	message[180] = '^0';

	new team, ColorChange, index, MSG_Type;
	
	if(id) {
		MSG_Type = MSG_ONE;
		index = id;
	} else {
		index = FindPlayer();
		MSG_Type = MSG_ALL;
	}
	
	team = get_user_team(index);
	ColorChange = ColorSelection(index, MSG_Type, type);

	ShowColorMessage(index, MSG_Type, message);
		
	if(ColorChange) {
		Team_Info(index, MSG_Type, TeamName[team]);
	}
}

ShowColorMessage(id, type, message[]) {
	static bool:saytext_used;
	static get_user_msgid_saytext;
	if(!saytext_used)
	{
		get_user_msgid_saytext = get_user_msgid("SayText");
		saytext_used = true;
	}
	message_begin(type, get_user_msgid_saytext, _, id);
	write_byte(id);
	write_string(message);
	message_end();	
}

Team_Info(id, type, team[]) {
	static bool:teaminfo_used;
	static get_user_msgid_teaminfo;
	
	if(!teaminfo_used) {
		get_user_msgid_teaminfo = get_user_msgid("TeamInfo");
		teaminfo_used = true;
	}
	message_begin(type, get_user_msgid_teaminfo, _, id);
	write_byte(id);
	write_string(team);
	message_end();

	return 1;
}

ColorSelection(index, type, Color:Type) {
	switch(Type) {
		case RED:
		{
			return Team_Info(index, type, TeamName[1]);
		}
		case BLUE:
		{
			return Team_Info(index, type, TeamName[2]);
		}
		case GREY:
		{
			return Team_Info(index, type, TeamName[0]);
		}
	}

	return 0;
}

FindPlayer() {
	new i = -1;

	while(i <= get_maxplayers()) {
		if(is_user_connected(++i))
			return i;
	}

	return -1;
}

stock get_name (id) {
	new name[32];
	get_user_name(id, name, 31);
	return name;
}

asta e sursa am pus si tag pentru vip dar ca nu isi ia accesele din VIPS.ini practic de acolo bag eu vip la modul zombie plague.

Re: cerere plugin tag

Posted: 25 Jan 2019, 18:41
by levin
și cum sunt în vips.ini

Re: cerere plugin tag

Posted: 25 Jan 2019, 18:47
by Zppp.Mihai94
"nick" "parola" "abcdeghjklmnort" "ab"

iar daca trec in users.ini la ce-i cu vip le da si grad de admin si au si vip ... ar fi bine daca sar putea face sa citeasca cei care au admin bagat in user.ini si pentru vip sa le teci admin_level_h sa ii ia separat.

Re: cerere plugin tag

Posted: 25 Jan 2019, 20:41
by levin
"abcdeghjklmnort" > "t"

Re: cerere plugin tag

Posted: 25 Jan 2019, 21:09
by Zppp.Mihai94
sa trec asa in users.ini?

Re: cerere plugin tag

Posted: 25 Jan 2019, 21:18
by levin
păi n ai zis că vrei admin level h la vip? asta înseamnă flag t în users/plg

Re: cerere plugin tag

Posted: 25 Jan 2019, 21:57
by Zppp.Mihai94
am pus dar degeaba ... nu ia accesele.