Cerere plugin tag

Cereri de resurse: addons-uri, modele, sunete, etc.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
User avatar
funny.cstrike2018
Membru, skill 0
Membru, skill 0
Posts: 26
Joined: 28 Nov 2017, 16:31
Detinator Steam: Da
CS Status: Christmas loading
Detinator server CS: zm.star-play.ro
SteamID: DonciuJunior
Fond eXtream: 0

01 Dec 2017, 02:46

Salut , doresc un plugin pentru TAG

Nu vreau sa fie neaparat pentru admini si si pentru jucator
Vreau sa am un tag.ini
si in acel tag.ini sa scriu de ex. Stefan "Good" sau altceva..

Multumesc anticipat !
Trage un ochi
| Afiseaza codul
Adresa: Cs.Star-Play.Ro / 93.119.26.122
Port: 27015
Jucatori: 24
Tip: CS:GO
Mod: Zombie
Anticheat: Protejat
Tara: Ro  :flag_ro:
RoyalServer 2
skaraosky69
Membru, skill 0
Membru, skill 0
Posts: 31
Joined: 18 Oct 2015, 12:23
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Detinator server CS: Blue.Ecila.Ro
SteamID: cipryan69
Fond eXtream: 0
Location: La Deea !
Contact:

02 Dec 2017, 18:26

Connect Blue.Evils.Ro
Site personal
Image
User avatar
DevilBoy.eXe
Super moderator
Super moderator
Posts: 1679
Joined: 05 Jun 2016, 23:04
Detinator Steam: Da
Detinator server CS: GO.WARED.RO
SteamID: DevilBoy_eXe
Reputatie: Super Moderator
Fond eXtream: 0
Location: beyond the time
Discord: zeux.
Has thanked: 15 times
Been thanked: 72 times
Contact:

02 Dec 2017, 18:36

User avatar
iNdio
Membru, skill +4
Membru, skill +4
Posts: 1512
Joined: 28 Jan 2015, 17:42
Detinator Steam: Da
SteamID: iNdioPGL
Reputatie: Fost Membru Club eXtreamCS (6 luni)
Castigator Membru Club eXtream @ Ganduri de sub dus (25 OCT - 25 FEB)
Fond eXtream: 0
Been thanked: 3 times

02 Dec 2017, 19:13

iNdio wrote:Cand schimbi harta o sa-ti apara fisieru' ce contine tag-urile. addons/amxmodx/configs/tags.ini
Ex:

Code: Select all

"iNdio" "eXtreamCS"
tag.sma | Afiseaza codul
[code]
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Tags"
#define VERSION "1.0"
#define AUTHOR "Khalid"

#define MAX_TAG_CHARACTERS	20

//#define USE_STEAMID

new Trie:gTrie

new g_szTag[33][MAX_TAG_CHARACTERS + 1]

new const FILE[] = "addons/amxmodx/configs/tags.ini"

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_clcmd("say", "hook_say")
	
	gTrie = TrieCreate()
	
	ReadFile()
	
	register_concmd("amx_reload_tags", "AdminReloadTags", ADMIN_RCON)
	register_concmd("amx_add_tag", "AdminAddTag", ADMIN_RCON, "<name> <tag> - Adds a tag for a player")
}

public client_putinserver(id)
{
	new szAccessCode[35]; 
	
	#if defined USE_STEAMID
	get_user_authid(id, szAccessCode, charsmax(szAccessCode))
	#else
	get_user_name(id, szAccessCode, charsmax(szAccessCode))
	#endif
	
	if(TrieKeyExists(gTrie, szAccessCode))
		TrieGetString(gTrie, szAccessCode, g_szTag[id], charsmax(g_szTag[]))
}

public client_disconnect(id)
	g_szTag[id][0] = '^0'

public AdminAddTag(id, level, cid)
{
	if(!cmd_access(id, level, cid, 3))
		return PLUGIN_HANDLED
		
	new szName[32], iPlayer
	read_argv(1, szName, 31); read_argv(2, g_szTag[iPlayer], charsmax(g_szTag[]))
	
	if( !( iPlayer = cmd_target(id, szName, CMDTARGET_ALLOW_SELF) ) )
	{
		console_print(id, "Player must be connected")
		return PLUGIN_HANDLED
	}
	
	if(g_szTag[id][0])
	{
		console_print(id, "Player already have a tag")
		return PLUGIN_HANDLED
	}
	
	#if defined USE_STEAMID
	new szAuthId[35]
	get_user_authid(iPlayer, szAuthId, charsmax(szAuthId))
	#endif
	
	get_user_name(iPlayer, szName, charsmax(szName))
	
	new f = fopen(FILE, "w")
	fseek(f, 0, SEEK_END)
	
	#if defined USE_STEAMID
	fprintf(f, "^"%s^" ^"%s^"", szAuthId, g_szTag[iPlayer])
	#else
	fprintf(f, "^"%s^" ^"%s^"", szName, g_szTag[iPlayer])
	#endif
	fclose(f)
	
	#if defined USE_STEAMID
	TrieSetString(gTrie, szAuthId, g_szTag[iPlayer])
	#else
	TrieSetString(gTrie, szName, g_szTag[iPlayer])
	#endif
	
	console_print(id, "Successfully added tag %s for player %s", g_szTag[iPlayer], szName)
	return PLUGIN_HANDLED
}

public AdminReloadTags(id, level, cid)
{
	if(!cmd_access(id, level, cid, 1))
		return PLUGIN_HANDLED
	
	TrieClear(gTrie)
	
	for(new i; i < sizeof(g_szTag); i++)
	{
		g_szTag[0] = '^0'
	}
	
	console_print(id, "Successfully reloaded file")
	ReadFile()
	
	new iPlayers[32], iNum, iPlayer
	
	new szAccessCode[35]
	
	get_players(iPlayers, iNum, "ch")
	
	for(new i; i < iNum; i++)
	{
		iPlayer = iPlayers
		
		#if defined USE_STEAMID
		get_user_authid(iPlayer, szAccessCode, charsmax(szAccessCode))
		#else
		get_user_name(iPlayer, szAccessCode, charsmax(szAccessCode))
		#endif
		
		if(TrieKeyExists(gTrie, szAccessCode))
		{
			TrieGetString(gTrie, szAccessCode, g_szTag[iPlayer], charsmax(g_szTag[]))
		}
	}
	
	return PLUGIN_HANDLED
}

ReadFile()
{
	new szLine[100]
	if(!file_exists(FILE))
	{
		write_file(FILE, "; Tags File -> By Khalid :)")
		write_file(FILE, "; Any line starting with ; is a comment")
		write_file(FILE, "; How to put tags?")
		
		#if defined USE_STEAMID
		write_file(FILE, "; ^"SteamID^"	^"Tag^"")
		#else
		write_file(FILE, "; ^"Name^"	^"Tag^"")
		#endif
		
		formatex(szLine, charsmax(szLine), "; Tags cannot exceed more than %d characters.", MAX_TAG_CHARACTERS)
		formatex(szLine, charsmax(szLine), "; If you want more, edit the sma at line 8")
		write_file(FILE, szLine)
		
		return;
	}
	
	new f = fopen(FILE, "r")
	new szAccessCode[35], szTag[MAX_TAG_CHARACTERS + 1]
	
	while(!feof(f))
	{
		fgets(f, szLine, 99)
		
		replace(szLine, charsmax(szLine), "^n", "")
		
		if(!szLine[0] || szLine[0] == ';')
			continue;
		
		strbreak(szLine, szAccessCode, charsmax(szAccessCode), szTag, charsmax(szTag))
		
		remove_quotes(szAccessCode)
		remove_quotes(szTag)
		
		if(TrieKeyExists(gTrie, szAccessCode))
		{
			#if defined USE_STEAMID
			log_amx("Failed to add Tag for player with SteamID: '%s' as he already has a tag.", szAccessCode)
			#else
			log_amx("Failed to add tag for player with the name '%s' as he already has a tag.", szAccessCode)
			#endif
			continue;
		}
		
		TrieSetString(gTrie, szAccessCode, szTag)
	}
	
	fclose(f)
}

public hook_say(id)
{
	if(!g_szTag[id][0])
		return PLUGIN_CONTINUE
	
	static szMessage[191], szLastFormat[200], szName[32]
	new iAlive
	
	read_argv(1, szMessage, charsmax(szMessage))
	
	if(!szMessage[0])
		return PLUGIN_CONTINUE
	
	get_user_name(id, szName, 31)
	formatex(szLastFormat, charsmax(szLastFormat), "%s^4%s ^3%s ^1: %s", ( ( iAlive = is_user_alive(id) ) ? "" : ( get_user_team(id) == 3 ? "^1*SPEC* " : "^1*DEAD* ") ), g_szTag[id], szName, szMessage)

	server_print("get_user_team(id) = %d", get_user_team(id))
	Print(id, szLastFormat, iAlive)
	
	return PLUGIN_HANDLED_MAIN
}

Print(id, Message[], iAlive)
{
	static SayText
	
	if(!SayText)
		SayText = get_user_msgid("SayText")
		
	new players[32], iNum
	
	get_players(players, iNum, iAlive ? "ach" /* Skip Dead */ : "bch" /* Skip Alive */)

	for(new i; i < iNum; i++)
	{
		message_begin(MSG_ONE, SayText,_, players)
		write_byte(id)
		write_string(Message)
		message_end()
	}
}[/code]
Where Cs had no value, amxx, sometimes, had its price...
steam | Afiseaza codul
Image
Image
User avatar
WHOAMI?
eXtream Mod
eXtream Mod
Posts: 999
Joined: 17 Dec 2013, 19:51
Detinator Steam: Da
Reputatie: eXtream Mod
Fost Membru Club eXtreamCS (o luna)
Location: US
Has thanked: 30 times
Been thanked: 20 times

01 Feb 2018, 21:44

Search :
cereri-pluginuri/cerere-plugin-t186026.html#p1476536
Post Reply

Return to “Cereri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests