[CSGO] Individual Player Tags [v0.2]

Descărcări de pluginuri și discuții despre acestea.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

_()_
Membru, skill +1
Membru, skill +1
Posts: 159
Joined: 24 Jun 2017, 02:10
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

16 Aug 2017, 17:17

Descarcare:
Mega || Girlshare || FileShare
RichClientTags.sp | Afiseaza codul
#include <sourcemod>
#include <cstrike>
#include <clientprefs>
#include <chat-processor>

Handle: OnlyAdmins
Handle: CheckTags
Handle: PrintTagAssign

new Handle: ClientTag = INVALID_HANDLE
new Handle: ClientTagColor = INVALID_HANDLE
new Handle: RestrictedTags = INVALID_HANDLE

new String: RestrictedTagsFile[ PLATFORM_MAX_PATH ]

#define flag ADMFLAG_CUSTOM6

public Plugin:myinfo = {
	name = "Rich Client Tags",
	author = "tre3fla",
	description = "Jucatorii isi pot pune tag-uri in chat si scoreboard",
	version = "0.2",
	url = "http://extreamcs.com/forum"
}

public OnPluginStart( ) { 
	OnlyAdmins = CreateConVar( "sm_tag_access_only_admins", "1", "0=toti jucatorii au acces la tag-uri, 1=doar admini cu un anumit flag" )
	CheckTags = CreateConVar( "sm_tag_check", "1", "0=jucatorii isi pun ce tag vor, 1=nu isi pot pune tag-urile banate" )
	PrintTagAssign =  CreateConVar( "sm_print_on_tag_asssign", "1", "0=dezactivat, 1=jucatorului o sa-i apara un mesaj cand i se seteaza tag-ul, inclusiv la connectare" )
	
	ClientTag = RegClientCookie( "ClientTag", "Tag-ul ales de jucator", CookieAccess_Protected )
	ClientTagColor = RegClientCookie( "ClientTagColor", "Culoarea pentru tag", CookieAccess_Protected )
	
	RegConsoleCmd( "tag", Command_AssignTag )
	RegConsoleCmd( "tc", Command_AssignTagColor )
	RegConsoleCmd( "tagcolor", Command_AssignTagColor )
	RegConsoleCmd( "tagcolorsinfo", Command_ShowColorInfo )
	RegConsoleCmd( "tagdisable", Command_DisableTag )
	
	HookEvent( "player_spawn", Event_PlayerSpawn )
	
	HookEventEx( "player_connect_full", player_connect_full )
}

public OnMapStart( ) {
	ReadForbiddenTags( )
}

public player_connect_full( Event:event, const String:name[ ], bool:dontBroadcast ) { 
	new client = GetClientOfUserId( GetEventInt( event, "userid" ) )
	
	if( IsClientConnected( client ) && !IsFakeClient( client ) ) {
		CreateTimer( 0.5, TagTheClient, client )
	}
}

public Action: Event_PlayerSpawn( Event event, const char[ ] name, bool dontBroadcast ) {
	int ClientUserId = GetEventInt( event, "userid" ) 
	int client = GetClientOfUserId( ClientUserId )
	
	decl String: Tag[ 16 ]
	GetClientCookie( client, ClientTag, Tag, sizeof( Tag ) )
	
	if( strlen( Tag ) > 0 ) {
		CS_SetClientClanTag( client, Tag )
	}
}

public Action: Command_AssignTag( client, args ) {
	if( GetConVarInt( OnlyAdmins ) > 0 ) {
		if( !CheckCommandAccess( client, "sm_someoverride", flag ) ) {
			PrintToChat( client, "*\x02 You have no access to this command!" )
			return Plugin_Handled
		}
	}
	
	decl String: ChoosenTag[ 32 ]
	GetCmdArgString( ChoosenTag, sizeof( ChoosenTag ) )
	
	if( args < 1 ) {
		PrintToChat( client, "*\x04 Usage:\x02 !tag\x01 <you tag>" )
		return Plugin_Handled
	}
	
	if( strlen( ChoosenTag ) > 15 ) {
		PrintToChat( client, "*\x02 The tag you have choosen is too long. The tag can be 12 characters long!" )
		return Plugin_Handled
	}
	
	if( GetConVarInt( CheckTags ) > 0 ) {
		decl String: BannedTags[ 1024 ]
		
		for( new i = 0; i < GetArraySize( RestrictedTags ); i++ ) {
			GetArrayString( RestrictedTags, i, BannedTags, sizeof( BannedTags ) )
			
			if( StrContains( ChoosenTag, BannedTags ) != -1 ) {
				PrintToChat( client, "*\x02 Your tag or a part of it is forbidden, please choose another tag!" )
				return Plugin_Handled
			}
		}
	}
	
	CS_SetClientClanTag( client, ChoosenTag )
	SetClientCookie( client, ClientTag, ChoosenTag )
	
	if( GetConVarInt( PrintTagAssign ) > 0 ) {
		PrintToChat( client, "*\x09 Your tag has been succesifull modified!" )
		PrintToChat( client, "*\x09 Your new tag is\x04 %s", ChoosenTag )
	}
	
	return Plugin_Continue
}

public Action: Command_AssignTagColor( client, args ) {
	if( args < 1 ) {
		PrintToChat( client, "*\x04 Usage:\x02 !tagcolor\x01 <color>\x04 - type\x02 !tagcolorsinfo\x01 for more info" )
		return Plugin_Handled
	}
	
	decl String: Color[ 32 ]
	GetCmdArg( 1, Color, sizeof( Color ) )
	
	if( StrEqual( Color, "team" ) ) {
		SetClientCookie( client, ClientTagColor, "" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now team color!" )
		}
	}
	else if( StrEqual( Color, "white" ) ) {
		SetClientCookie( client, ClientTagColor, "\x01" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now white!" )
		}
	}
	else if( StrEqual( Color, "red" ) ) {
		SetClientCookie( client, ClientTagColor, "\x07" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now\x07 red!" )
		}
	}
	else if( StrEqual( Color, "darkred" ) ) {
		SetClientCookie( client, ClientTagColor, "\x02" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now\x02 darkred!" )
		}
	}
	else if( StrEqual( Color, "lightred" ) ) {
		SetClientCookie( client, ClientTagColor, "\x0F" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now \x0Flightred!" )
		}
	}
	else if( StrEqual( Color, "green" ) ) {
		SetClientCookie( client, ClientTagColor, "\x04" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now \x04green!" )
		}
	}
	else if( StrEqual( Color, "lightgreen" ) ) {
		SetClientCookie( client, ClientTagColor, "\x05" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now \x05lightgreen!" )
		}
	}
	else if( StrEqual( Color, "lime" ) ) {
		SetClientCookie( client, ClientTagColor, "\x06" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now \x06lime!" )
		}
	}
	else if( StrEqual( Color, "purple" ) ) {
		SetClientCookie( client, ClientTagColor, "\x03" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now \x03purple!" )
		}
	}
	else if( StrEqual( Color, "grey" ) ) {
		SetClientCookie( client, ClientTagColor, "\x08" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now \x08grey!" )
		}
	}
	else if( StrEqual( Color, "grey2" ) ) {
		SetClientCookie( client, ClientTagColor, "\x0A" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now \x0Agrey2!" )
		}
	}
	else if( StrEqual( Color, "grey3" ) ) {
		SetClientCookie( client, ClientTagColor, "\x0D" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now \x0Dgrey3!" )
		}
	}
	else if( StrEqual( Color, "yellow" ) ) {
		SetClientCookie( client, ClientTagColor, "\x09" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now \x09yellow!" )
		}
	}
	else if( StrEqual( Color, "blue" ) ) {
		SetClientCookie( client, ClientTagColor, "\x0C" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now \x0Cblue!" )
		}
	}
	else if( StrEqual( Color, "lightblue" ) ) {
		SetClientCookie( client, ClientTagColor, "\x0B" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now \x0Blightblue!" )
		}
	}
	else if( StrEqual( Color, "pink" ) ) {
		SetClientCookie( client, ClientTagColor, "\x0E" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now \x0Epink!" )
		}
	}
	else if( StrEqual( Color, "orange" ) ) {
		SetClientCookie( client, ClientTagColor, "\x10" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now \x10orange!" )
		}
	}
	else {
		PrintToChat( client, "*\x02 Given color is invalid!" )
		return Plugin_Handled
	}
	
	return Plugin_Continue
}

public Action: Command_ShowColorInfo( client, args ) {
	PrintToChat( client, "*\x01 Available colors are:" )
	PrintToChat( client, "white, \x07red \x02darkred, \x0Flightred \x03purple, \x04green, \x05lightgreen, \x06lime, \x08grey, \x0Agrey2, \x0Dgrey3 \x09yellow, \x0Blightblue, \x0Cblue, \x0Epink, \x10orange, \x01team" )
}

public Action: CP_OnChatMessage( int& client, ArrayList recipients, char[] flagstring, char[] name, char[] message, bool& processcolors, bool& removecolors ) {
	if( GetConVarInt( OnlyAdmins ) > 0 ) {
		if( !CheckCommandAccess( client, "sm_someoverride", flag ) ) {
			return Plugin_Continue
		}
	}
	
	decl String: Tag[ 32 ]
	GetClientCookie( client, ClientTag, Tag, sizeof( Tag ) )
	
	decl String: Color[ 32 ]
	GetClientCookie( client, ClientTagColor, Color, sizeof( Color ) )
	
	if( StrEqual( Tag, "" ) ) {
		return Plugin_Continue
	}
	
	if( strlen( Color ) > 0 ) {
		switch( GetClientTeam( client ) ) {
			case CS_TEAM_NONE: {
				Format( name, MAXLENGTH_NAME, " %s%s\x01 %s", Color, Tag, name )
			}
			case CS_TEAM_SPECTATOR: {
				Format( name, MAXLENGTH_NAME, " %s%s\x01 %s", Color, Tag, name )
			}
			case CS_TEAM_T: {
				Format( name, MAXLENGTH_NAME, " %s%s\x09 %s", Color, Tag, name )
			}
			case CS_TEAM_CT: {
				Format( name, MAXLENGTH_NAME, " %s%s\x0B %s", Color, Tag, name )
			}
		}
	}
	else {
		Format( name, MAXLENGTH_NAME, "%s %s", Tag, name )
	}
	
	Format( message, MAXLENGTH_MESSAGE, "%s", message )
	
	return Plugin_Continue
}

public Action: Command_DisableTag( client, args ) {
	if( IsClientInGame( client ) && client > 0 && client <= MaxClients ) {
		SetClientCookie( client, ClientTag, "" )
		CS_SetClientClanTag( client, "" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "*\x02 Your tag has been disabled!" )
		}
	}
}

public Action: TagTheClient( Handle: timer, any: client ) {
	if( IsClientInGame( client ) && client > 0 && client <= MaxClients ) {
		decl String: Tag[ 32 ]
		GetClientCookie( client, ClientTag, Tag, sizeof( Tag ) )
		
		if( strlen( Tag ) > 0 ) {
			if( GetConVarInt( CheckTags ) > 0 ) {
				decl String: TagsFromFile[ 1024 ]
				
				for( new i = 0; i < GetArraySize( RestrictedTags ); i++ ) {
					GetArrayString( RestrictedTags, i, TagsFromFile, sizeof( TagsFromFile ) )
					
					if( StrContains( Tag, TagsFromFile ) != -1 ) {
						SetClientCookie( client, ClientTag, "" )
						
						if( GetConVarInt( PrintTagAssign ) > 0 ) {
							PrintToChat( client, "*\x02 Your tag is forbidden and it has been deleted!" )
						}
					}
					else {
						CS_SetClientClanTag( client, Tag )
					}
				}
			}
			else {
				CS_SetClientClanTag( client, Tag )
			}
		}
	}
}

public ReadForbiddenTags( ) {
	RestrictedTags = CreateArray( 1024 )
	
	BuildPath( Path_SM, RestrictedTagsFile, sizeof( RestrictedTagsFile ), "configs/RestrictedTags.txt" )
	new Handle: RestrictedTagsHolder = OpenFile( RestrictedTagsFile, "r" )
	
	new String: ResultsBuffer[ 1024 ]
	
	while( !IsEndOfFile( RestrictedTagsHolder ) && ReadFileLine( RestrictedTagsHolder, ResultsBuffer, sizeof( ResultsBuffer ) ) ) {
		ReplaceString( ResultsBuffer, sizeof( ResultsBuffer ), "\n", "", false )
		PushArrayString( RestrictedTags, ResultsBuffer )
	}
}
Nume: Individual Player Tags
Autor: tre3fla
Versiune: 0.2

Descriere:
Cu ajutorul acestui plugin adminii (si playerii) isi pot seta ce taguri doresc ei sa aiba. Vor avea tag-urile alea atat in chat cat si in scoreboard. De asemenea isi pot colora tag-urile din chat, au de ales din mai multe culori (in jur 15). Tag-urile sunt salvate instant si sunt puse automat la connectarea pe server. De asemenea jucatorii isi pot dezactiva tag-urile daca nu mai vor sa aibe asa ceva. Ownerii pot bana anumite tag-uri, cum ar fi cele cu reclame, daca le scriu in fisierul RestrictedTags.txt.

Convar-uri (se adauga in autoexec.cfg)
  • sm_tag_access_only_admins - Daca este setat pe 1 doar adminii vor avea acces la tag-uri, daca este setat pe 0 toti jucatorii vor avea acces la tag-uri.
  • sm_tag_check - Daca este setat pe 1 pluginul va verifica tag-ul setat de jucator si il va bloca daca tag-ul respectiv sau o parte din el se gaseste in RestrictedTags.txt
  • sm_print_on_tag_asssign - Daca este setat pe 1 pluginul le va arata jucatorilor mesaje in chat atunci cand isi schimba tag-ul, culoarea, etc (va vedea doar jucatorul respectiv, nu toti de pe server)
Comenzi:
  • !tag <tag-ul dorit> - seteaza tag-ul respectiv (poate contine si space)
  • !tagcolor <nume culoare> - culoarea tag-ului din chat (exemplu: !tagcolor red)
    !tc - aceeasi comanda ca si !tagcolor doar ca este prescurtata
  • !tagcolorsinfo - arata lista cu numele culorilor disponibile
  • !tagdisable - sterge tag-ul jucatorului care o foloseste
Versiunea 0.3 va contine, printre altele, si urmatoarele imbunatatiri
- Daca convar-ul sm_tag_access_only_admins este setat pe 1 si un jucator care a avut deja tag dar nu mai este admin sa ii fie sters tag-ul respectiv
- Jucatorii vor putea dezactiva tag-urile ( adica sa nu mai vada tag-uri in chat )

Module / extensii / librarii necesare:
- Pentru ca acest plugin sa functioneze aveti nevoie de Chat Processor pe care il puteti descarca de aici

Instalare:
1. Fisierul RichClientTags.sp se adauga in addons/sourcemod/scripting
2. Fisierul RichClientTags.smx se adauga in addons/sourcemod/plugins
3. Fisierul RestrictedTags.txt se adauga in addons/sourcemod/configs

Conflicte cu alte plugine:
- Acest plugin va intra in conflict cu orice plugin care proceseaza chat-ul ( nu ma refer la plugine care arata mesaje in chat )
- Aveti grija sa nu aveti instalat Simple Chat Processor sau Simple Chat Processor (redux), daca aveti asa ceva nu aveti decat sa convertiti pluginele care depind de cele de sus sa foloseasca Chat Processor-ul de care v-am zis.
- Nu folositi alte pluginuri care modifica tag-urile din SCOREBOARD!

Atentie:
Pluginul nu a fost testat decat foarte superficial, deci este predispus la buguri. Orice bug sau eroare pe care le intampinati postati aici si vor fi rezolvate. Cine nu are bunul simt sa aprecieze ceva gratis, open-source si vine cu tot felul de pretentii a gresit topicul si probabil si site-ul.

Nu se ofera modificari private, prin pm. Orice modificare se cere si se ofera in topicul asta!
Last edited by _()_ on 16 Aug 2017, 18:59, edited 1 time in total.
User avatar
FREAK
Membru, skill +4
Membru, skill +4
Posts: 1844
Joined: 13 Aug 2016, 20:46
Detinator Steam: Da
CS Status: Ma joc CS:GO
Detinator server CS: ARENA.1TAP.RO
SteamID: freakav
Reputatie: Fost Scripter eXtreamCS
Fost Membru Club eXtreamCS (6 luni)
Nume anterior: FREAK OFFICIAL TV
Fond eXtream: 0
Location: England
Contact:

16 Aug 2017, 17:26

Misto .. o sa il incerc dar folosit pe flag .. eu zic ca e mai ok .. sau daca ai la nume serverul sa ai acces decat toti adminii ...
_()_
Membru, skill +1
Membru, skill +1
Posts: 159
Joined: 24 Jun 2017, 02:10
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

16 Aug 2017, 17:31

FREAK wrote:Misto .. o sa il incerc dar folosit pe flag .. eu zic ca e mai ok .. sau daca ai la nume serverul sa ai acces decat toti adminii ...
Am uitat sa precizez ca flag-ul default pentru admini este flag-ul T. Pentru cei ce vor sa modifice cautati in sursa linia

Code: Select all

#define flag ADMFLAG_CUSTOM6
si modificati ADMFLAG_CUSTOM6 cu flag-ul pe care il doriti.

Lista cu flag-urile CUSTOM si pe ce litera sunt ele:
ADMFLAG_CUSTOM1 = litera de acces "o"
ADMFLAG_CUSTOM2 = litera de acces "p"
ADMFLAG_CUSTOM3 = litera de acces "q"
ADMFLAG_CUSTOM4 = litera de acces "r"
ADMFLAG_CUSTOM5 = litera de acces "s"
ADMFLAG_CUSTOM6 = litera de acces "t"

Puteti pune ce flag vreti voi nu trebuie sa fie din flagurile custom
t3d
Utilizator neserios (tepar)
Utilizator neserios (tepar)
Posts: 1695
Joined: 16 Mar 2016, 11:22
Detinator Steam: Da
Reputatie: Restrictie moderator!
Restrictie mesaje private
Fost Membru Club eXtreamCS (6 luni)
Nume anterior : T3ED
Utilizator neserios (tepar)
Fond eXtream: 0

16 Aug 2017, 22:03

Arată chiar bine, o să-l testez și eu de asemenea.
Lista tranzactii extreamcs: | Afiseaza codul
LISTA TRANZACTII EXTREAMCS.COM:
anunturi/dau-105eur-paypal-transferbancar-moneygram-t346743.html
anunturi/dau-125-lei-paysafecard-paypal-t336275.html
anunturi/dau-100-lei-paysafe-19euro-paypal-t332637.html
anunturi/dau-lei-paysafecard-euro-paypal-t332553.html
anunturi/dau-lei-paysafecard-paypal-t332463.html
anunturi/lei-paysafecard-t332130-12.html
anunturi/vand-skins-t331811.html
anunturi/dau-paysafe-paypal-t331631.html
anunturi/dau-paysafecard-paypal-t330515.html
anunturi/caut-designer-photoshop-t327564.html
anunturi/cumpar-cont-lol-t316133.html
anunturi/vand-cont-lol-euw-gold-platin-gold-t339823.html
anunturi/dau-lei-psc-paypal-t341899.html
anunturi/vand-lei-paysafecard-anglia-eur-paypal-t342092.html
anunturi/dau-lei-psc-paypal-t342080.html
anunturi/vand-lei-paysafecard-paypal-t342454.html
anunturi/vand-addons-uri-t342421.html
post2624864.html#p2624864
anunturi/vand-cont-steam-iteme-t342799.html
anunturi/dau-100-lei-psc-paypal-t344372.html
anunturi/dau-lei-psf-eur-t354998.html
User avatar
OXYD
Membru, skill +1
Membru, skill +1
Posts: 463
Joined: 27 May 2017, 22:38
Detinator Steam: Da
CS Status: Playing CS:GO
Detinator server CS: Go.HellHounds.Ro
Reputatie: Fost Membru Club eXtreamCS (doua luni)
Fond eXtream: 0
Been thanked: 1 time
Contact:

16 Aug 2017, 22:49

Poti sa faci si o versiune care sa mearga doar tag in chat? Vreau sa il pun la vip , si vipul are deja taguri in tab.
Oricum Ai facut o treaba foarte buna cu pluginul.
_()_
Membru, skill +1
Membru, skill +1
Posts: 159
Joined: 24 Jun 2017, 02:10
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

17 Aug 2017, 17:43

O sa-ti adaug diseara un cvar cu care poti dezactiva tag-urile din chat sau cele din scoreboard daca zici ca te ajuta.
mxtrike
Membru, skill 0
Membru, skill 0
Posts: 32
Joined: 06 Jan 2017, 23:23
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

03 Oct 2017, 01:46

il poti face sa foloseasca playerii cu un anume nume ? gen "mXtrike extreamcs.com" ?
User avatar
tre3fla
Membru eXtream
Membru eXtream
Posts: 5317
Joined: 27 May 2012, 11:15
Detinator Steam: Da
CS Status: Allah Akbar !
Detinator server CS: Nu
SteamID: /id/tre3fla_xxx
Has thanked: 14 times
Been thanked: 129 times

03 Oct 2017, 02:38

RichChatTags.sp | Afiseaza codul
#include <sourcemod>
#include <cstrike>
#include <clientprefs>
#include <chat-processor>

Handle: OnlyAdmins
Handle: CheckTags
Handle: PrintTagAssign
Handle: OnlyNamed
Handle: NameStr

new Handle: ClientTag = INVALID_HANDLE
new Handle: ClientTagColor = INVALID_HANDLE
new Handle: RestrictedTags = INVALID_HANDLE

new String: RestrictedTagsFile[ PLATFORM_MAX_PATH ]

#define flag ADMFLAG_CUSTOM6

public Plugin:myinfo = {
	name = "Rich Client Tags",
	author = "tre3fla",
	description = "Jucatorii isi pot pune tag-uri in chat si scoreboard",
	version = "0.2",
	url = "http://extreamcs.com/forum"
}

public OnPluginStart( ) { 
	OnlyAdmins = CreateConVar( "sm_tag_access_only_admins", "1", "0=toti jucatorii au acces la tag-uri, 1=doar admini cu un anumit flag" )
	CheckTags = CreateConVar( "sm_tag_check", "1", "0=jucatorii isi pun ce tag vor, 1=nu isi pot pune tag-urile banate" )
	PrintTagAssign =  CreateConVar( "sm_print_on_tag_asssign", "1", "0=dezactivat, 1=jucatorului o sa-i apara un mesaj cand i se seteaza tag-ul, inclusiv la connectare" )
	OnlyNamed = CreateConVar( "sm_tag_only_advertisers", "1", "0=dezactiva, 1=jucatorii trebuie sa poarte ceva la nume pentru a-l folosi" )
	NameStr = CreateConVar( "sm_needed_name", "csgo.ro", "Cuvantul care trebuie sa fie in componenta numelui pentru a folosi comanda !tag" )


	ClientTag = RegClientCookie( "ClientTag", "Tag-ul ales de jucator", CookieAccess_Protected )
	ClientTagColor = RegClientCookie( "ClientTagColor", "Culoarea pentru tag", CookieAccess_Protected )
	
	RegConsoleCmd( "tag", Command_AssignTag )
	RegConsoleCmd( "tc", Command_AssignTagColor )
	RegConsoleCmd( "tagcolor", Command_AssignTagColor )
	RegConsoleCmd( "tagcolorsinfo", Command_ShowColorInfo )
	RegConsoleCmd( "tagdisable", Command_DisableTag )
	
	HookEvent( "player_spawn", Event_PlayerSpawn )
	
	HookEventEx( "player_connect_full", player_connect_full )
}

public OnMapStart( ) {
	ReadForbiddenTags( )
}

public player_connect_full( Event:event, const String:name[ ], bool:dontBroadcast ) { 
	new client = GetClientOfUserId( GetEventInt( event, "userid" ) )
	
	if( IsClientConnected( client ) && !IsFakeClient( client ) ) {
		CreateTimer( 0.5, TagTheClient, client )
	}
}

public Action: Event_PlayerSpawn( Event event, const char[ ] name, bool dontBroadcast ) {
	int ClientUserId = GetEventInt( event, "userid" ) 
	int client = GetClientOfUserId( ClientUserId )
	
	decl String: Tag[ 16 ]
	GetClientCookie( client, ClientTag, Tag, sizeof( Tag ) )
	
	if( strlen( Tag ) > 0 ) {
		CS_SetClientClanTag( client, Tag )
	}
}

public Action: Command_AssignTag( client, args ) {
	if( GetConVarInt( OnlyAdmins ) > 0 ) {
		if( !CheckCommandAccess( client, "sm_someoverride", flag ) ) {
			PrintToChat( client, "*\x02 You have no access to this command!" )
			return Plugin_Handled
		}
	}

	if( GetConVarInt( OnlyNamed ) > 0 ) {
		decl String: SuperName[ 32 ]
		GetClientName( client, SuperName, sizeof( SuperName ) )

		decl String: SuperWord[ 32 ]
		GetConVarString( NameStr, SuperWord, sizeof( SuperWord ) )

		if( StrContains( SuperName, SuperWord ) == -1 || StrContains( SuperName, SuperWord, true ) == -1 ) {
			PrintToChat( client, " \x02You have to wear\x04 %s\x01 on your name to use this command!", SuperWord )
			return Plugin_Handled
		}
	}
	
	decl String: ChoosenTag[ 32 ]
	GetCmdArgString( ChoosenTag, sizeof( ChoosenTag ) )
	
	if( args < 1 ) {
		PrintToChat( client, "*\x04 Usage:\x02 !tag\x01 <you tag>" )
		return Plugin_Handled
	}
	
	if( strlen( ChoosenTag ) > 15 ) {
		PrintToChat( client, "*\x02 The tag you have choosen is too long. The tag can be 12 characters long!" )
		return Plugin_Handled
	}
	
	if( GetConVarInt( CheckTags ) > 0 ) {
		decl String: BannedTags[ 1024 ]
		
		for( new i = 0; i < GetArraySize( RestrictedTags ); i++ ) {
			GetArrayString( RestrictedTags, i, BannedTags, sizeof( BannedTags ) )
			
			if( StrContains( ChoosenTag, BannedTags ) != -1 ) {
				PrintToChat( client, "*\x02 Your tag or a part of it is forbidden, please choose another tag!" )
				return Plugin_Handled
			}
		}
	}
	
	CS_SetClientClanTag( client, ChoosenTag )
	SetClientCookie( client, ClientTag, ChoosenTag )
	
	if( GetConVarInt( PrintTagAssign ) > 0 ) {
		PrintToChat( client, "*\x09 Your tag has been succesifull modified!" )
		PrintToChat( client, "*\x09 Your new tag is\x04 %s", ChoosenTag )
	}
	
	return Plugin_Continue
}

public Action: Command_AssignTagColor( client, args ) {
	if( args < 1 ) {
		PrintToChat( client, "*\x04 Usage:\x02 !tagcolor\x01 <color>\x04 - type\x02 !tagcolorsinfo\x01 for more info" )
		return Plugin_Handled
	}
	
	decl String: Color[ 32 ]
	GetCmdArg( 1, Color, sizeof( Color ) )
	
	if( StrEqual( Color, "team" ) ) {
		SetClientCookie( client, ClientTagColor, "" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now team color!" )
		}
	}
	else if( StrEqual( Color, "white" ) ) {
		SetClientCookie( client, ClientTagColor, "\x01" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now white!" )
		}
	}
	else if( StrEqual( Color, "red" ) ) {
		SetClientCookie( client, ClientTagColor, "\x07" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now\x07 red!" )
		}
	}
	else if( StrEqual( Color, "darkred" ) ) {
		SetClientCookie( client, ClientTagColor, "\x02" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now\x02 darkred!" )
		}
	}
	else if( StrEqual( Color, "lightred" ) ) {
		SetClientCookie( client, ClientTagColor, "\x0F" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now \x0Flightred!" )
		}
	}
	else if( StrEqual( Color, "green" ) ) {
		SetClientCookie( client, ClientTagColor, "\x04" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now \x04green!" )
		}
	}
	else if( StrEqual( Color, "lightgreen" ) ) {
		SetClientCookie( client, ClientTagColor, "\x05" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now \x05lightgreen!" )
		}
	}
	else if( StrEqual( Color, "lime" ) ) {
		SetClientCookie( client, ClientTagColor, "\x06" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now \x06lime!" )
		}
	}
	else if( StrEqual( Color, "purple" ) ) {
		SetClientCookie( client, ClientTagColor, "\x03" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now \x03purple!" )
		}
	}
	else if( StrEqual( Color, "grey" ) ) {
		SetClientCookie( client, ClientTagColor, "\x08" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now \x08grey!" )
		}
	}
	else if( StrEqual( Color, "grey2" ) ) {
		SetClientCookie( client, ClientTagColor, "\x0A" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now \x0Agrey2!" )
		}
	}
	else if( StrEqual( Color, "grey3" ) ) {
		SetClientCookie( client, ClientTagColor, "\x0D" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now \x0Dgrey3!" )
		}
	}
	else if( StrEqual( Color, "yellow" ) ) {
		SetClientCookie( client, ClientTagColor, "\x09" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now \x09yellow!" )
		}
	}
	else if( StrEqual( Color, "blue" ) ) {
		SetClientCookie( client, ClientTagColor, "\x0C" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now \x0Cblue!" )
		}
	}
	else if( StrEqual( Color, "lightblue" ) ) {
		SetClientCookie( client, ClientTagColor, "\x0B" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now \x0Blightblue!" )
		}
	}
	else if( StrEqual( Color, "pink" ) ) {
		SetClientCookie( client, ClientTagColor, "\x0E" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now \x0Epink!" )
		}
	}
	else if( StrEqual( Color, "orange" ) ) {
		SetClientCookie( client, ClientTagColor, "\x10" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "* Your tag color is now \x10orange!" )
		}
	}
	else {
		PrintToChat( client, "*\x02 Given color is invalid!" )
		return Plugin_Handled
	}
	
	return Plugin_Continue
}

public Action: Command_ShowColorInfo( client, args ) {
	PrintToChat( client, "*\x01 Available colors are:" )
	PrintToChat( client, "white, \x07red \x02darkred, \x0Flightred \x03purple, \x04green, \x05lightgreen, \x06lime, \x08grey, \x0Agrey2, \x0Dgrey3 \x09yellow, \x0Blightblue, \x0Cblue, \x0Epink, \x10orange, \x01team" )
}

public Action: CP_OnChatMessage( int& client, ArrayList recipients, char[] flagstring, char[] name, char[] message, bool& processcolors, bool& removecolors ) {
	if( GetConVarInt( OnlyAdmins ) > 0 ) {
		if( !CheckCommandAccess( client, "sm_someoverride", flag ) ) {
			return Plugin_Continue
		}
	}
	
	decl String: Tag[ 32 ]
	GetClientCookie( client, ClientTag, Tag, sizeof( Tag ) )
	
	decl String: Color[ 32 ]
	GetClientCookie( client, ClientTagColor, Color, sizeof( Color ) )
	
	if( StrEqual( Tag, "" ) ) {
		return Plugin_Continue
	}
	
	if( strlen( Color ) > 0 ) {
		switch( GetClientTeam( client ) ) {
			case CS_TEAM_NONE: {
				Format( name, MAXLENGTH_NAME, " %s%s\x01 %s", Color, Tag, name )
			}
			case CS_TEAM_SPECTATOR: {
				Format( name, MAXLENGTH_NAME, " %s%s\x01 %s", Color, Tag, name )
			}
			case CS_TEAM_T: {
				Format( name, MAXLENGTH_NAME, " %s%s\x09 %s", Color, Tag, name )
			}
			case CS_TEAM_CT: {
				Format( name, MAXLENGTH_NAME, " %s%s\x0B %s", Color, Tag, name )
			}
		}
	}
	else {
		Format( name, MAXLENGTH_NAME, "%s %s", Tag, name )
	}
	
	Format( message, MAXLENGTH_MESSAGE, "%s", message )
	
	return Plugin_Continue
}

public Action: Command_DisableTag( client, args ) {
	if( IsClientInGame( client ) && client > 0 && client <= MaxClients ) {
		SetClientCookie( client, ClientTag, "" )
		CS_SetClientClanTag( client, "" )
		
		if( GetConVarInt( PrintTagAssign ) > 0 ) {
			PrintToChat( client, "*\x02 Your tag has been disabled!" )
		}
	}
}

public Action: TagTheClient( Handle: timer, any: client ) {
	if( IsClientInGame( client ) && client > 0 && client <= MaxClients ) {
		decl String: Tag[ 32 ]
		GetClientCookie( client, ClientTag, Tag, sizeof( Tag ) )
		
		if( strlen( Tag ) > 0 ) {
			if( GetConVarInt( CheckTags ) > 0 ) {
				decl String: TagsFromFile[ 1024 ]
				
				for( new i = 0; i < GetArraySize( RestrictedTags ); i++ ) {
					GetArrayString( RestrictedTags, i, TagsFromFile, sizeof( TagsFromFile ) )
					
					if( StrContains( Tag, TagsFromFile ) != -1 ) {
						SetClientCookie( client, ClientTag, "" )
						
						if( GetConVarInt( PrintTagAssign ) > 0 ) {
							PrintToChat( client, "*\x02 Your tag is forbidden and it has been deleted!" )
						}
					}
					else {
						CS_SetClientClanTag( client, Tag )
					}
				}
			}
			else {
				CS_SetClientClanTag( client, Tag )
			}
		}
	}
}

public ReadForbiddenTags( ) {
	RestrictedTags = CreateArray( 1024 )
	
	BuildPath( Path_SM, RestrictedTagsFile, sizeof( RestrictedTagsFile ), "configs/RestrictedTags.txt" )
	new Handle: RestrictedTagsHolder = OpenFile( RestrictedTagsFile, "r" )
	
	new String: ResultsBuffer[ 1024 ]
	
	while( !IsEndOfFile( RestrictedTagsHolder ) && ReadFileLine( RestrictedTagsHolder, ResultsBuffer, sizeof( ResultsBuffer ) ) ) {
		ReplaceString( ResultsBuffer, sizeof( ResultsBuffer ), "\n", "", false )
		PushArrayString( RestrictedTags, ResultsBuffer )
	}
}
Netestat!

Ti-am adaugat 2 convar-uri noi si anume:
  • sm_tag_only_advertisers - daca este pe 1 doar jucatorii care au un anumit cuvant sau ce pui tu in componenta numelui vor putea folosi comanda !tag
  • sm_needed_name cuvantul sau ce pui care sa fie in componenta numelui jucatorului
Ai grija sa pui valorile convar-urilor intre ghilimele, cel putin la al doilea convar. Retine ca numele poate avea maxim 32 de caractere (si space se ia in considerare) si daca pui un cuvant prea lung jucatorii nu o sa poata sa-l poarte.
Are si suport pentru caractere case-sensitive (adica litere de tipar), in cazul in care jucatorii isi pun la nume cuvantul cu litere mari.

Vezi daca merge.
User avatar
mixatu
Membru, skill +2
Membru, skill +2
Posts: 680
Joined: 26 Apr 2012, 15:47
Detinator Steam: Da
SteamID: kzu1337
Reputatie: Membru Club eXtreamCS (1 luna)
Location: cstrike
Has thanked: 59 times
Been thanked: 29 times
Contact:

05 Mar 2020, 17:49

Trebuie definit altfel mesajul si nu gasesc. Ceva idei?

Code: Select all

// RichClientTags.sp(292) : error 017: undefined symbol "MAXLENGTH_MESSAGE"
User avatar
xSaG
Membru, skill +1
Membru, skill +1
Posts: 225
Joined: 11 Aug 2017, 00:21
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Has thanked: 1 time
Been thanked: 5 times
Contact:

09 Mar 2020, 20:04

mixatu wrote:
05 Mar 2020, 17:49
Trebuie definit altfel mesajul si nu gasesc. Ceva idei?

Code: Select all

// RichClientTags.sp(292) : error 017: undefined symbol "MAXLENGTH_MESSAGE"
descarca chat-processor.inc si pune-l in include...
www.sourcemod.ro - Tot ce ai nevoie pentru serverul tău
User avatar
mixatu
Membru, skill +2
Membru, skill +2
Posts: 680
Joined: 26 Apr 2012, 15:47
Detinator Steam: Da
SteamID: kzu1337
Reputatie: Membru Club eXtreamCS (1 luna)
Location: cstrike
Has thanked: 59 times
Been thanked: 29 times
Contact:

10 Mar 2020, 16:14

xSaG wrote:
09 Mar 2020, 20:04
mixatu wrote:
05 Mar 2020, 17:49
Trebuie definit altfel mesajul si nu gasesc. Ceva idei?

Code: Select all

// RichClientTags.sp(292) : error 017: undefined symbol "MAXLENGTH_MESSAGE"
descarca chat-processor.inc si pune-l in include...
Il am, si degeaba, face la fel. Aceiasi eroare
User avatar
xSaG
Membru, skill +1
Membru, skill +1
Posts: 225
Joined: 11 Aug 2017, 00:21
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Has thanked: 1 time
Been thanked: 5 times
Contact:

10 Mar 2020, 21:52

nu are cum :)
www.sourcemod.ro - Tot ce ai nevoie pentru serverul tău
Post Reply

Return to “Pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest