Заявка за Преработка на плъгин

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Аватар
SorryMateYoureDead
Извън линия
Потребител
Потребител
Мнения: 203
Регистриран на: 21 Май 2017, 17:40
Местоположение: Sliven
Се отблагодари: 3 пъти
Получена благодарност: 1 път
Обратна връзка:

Заявка за Преработка на плъгин

Мнение от SorryMateYoureDead » 31 Окт 2018, 10:48

този е плъгина

Код за потвърждение: Избери целия код

/***************************************************************************\
		    =====================================
		     * || [ZP] Classes In Chat v1.1 || *
		    =====================================

	-------------------
	 *||DESCRIPTION||*
	-------------------

	This plugins adds classes in chat for eg:
	If a person is survivor and he says something then this is what it
	would look like
	[Survivor] Player: Hi I am a survivor
	To make the chat more interesting, the chat is in colors

	Original Plugin thread is located here:
	http://forums.alliedmods.net/showthread.php?t=120557

	---------------
	 *||CREDITS||*
	---------------

	- MeRcyLeZZ ----> For some of the natives
	- My Sister ----> For taking the some screen shots

	------------------
	 *||CHANGE LOG||*
	------------------
	
	v1.0 ====> - Initial Release
	v1.0 ====> - Re-wrote the whole plugin
		   - Removed the color chat include and added a new color chat
		      system.
		   - Fixed almost, all the bugs which were reported

\***************************************************************************/

#include <amxmodx>
#include <cstrike>
#include <zombieplague>

// Variables
new g_msg_saytext, g_msg_teaminfo, g_new_round

// Team names used by the team info message
new const team_names[][] =
{
	"UNASSIGNED",
	"TERRORIST",
	"CT",
	"SPECTATOR"
}

// Color indexes for color chat message
enum
{
	RED = 1,
	BLUE,
	GREY
}

public plugin_init()
{
	// Register the plugin
	register_plugin("[ZP] Classes In Chat", "1.1", "@bdul!")
	
	// Client say commands
	register_clcmd("say", "hook_say")
	register_clcmd("say_team", "hook_team_say")
	
	// Round start event
	register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
	
	// Message IDs'
	g_msg_saytext = get_user_msgid("SayText")
	g_msg_teaminfo = get_user_msgid("TeamInfo")
	
	// This var should be set true to prevent a bug
	g_new_round = true
}

// Check for new round and update the var accordingly
public event_round_start() g_new_round = true
public zp_round_started() g_new_round = false

// Player's chat hook
public hook_say(id)
{
	// Retrieve the player's chat
	static chat[192], name[32], users_team
	read_args(chat, 191)
	remove_quotes(chat)
	
	// Trying to fool us ?
	if(!chat[0])
		return PLUGIN_CONTINUE
	
	// Retrieve player's name
	get_user_name(id, name, charsmax(name))
	
	// Retrieve player's team
	users_team = _:cs_get_user_team(id)
	
	// Alive user chat
	if (is_user_alive(id))
	{
		if (zp_get_user_zombie(id))
			color_chat(0, id, users_team, RED,  "^3[%s]^4 %s:^1 %s", zp_get_user_nemesis(id) ? "Nemesis" : "Zombie", name, chat)
		else
			color_chat(0, id, users_team, BLUE, "^3[%s]^4 %s:^1 %s", zp_get_user_survivor(id) ? "Survivor" : "Human", name, chat)
	}
	
	// Dead user's chat
	else color_chat(0, id, users_team, users_team, "^3[%s]^4 %s:^1 %s", users_team == _:CS_TEAM_SPECTATOR ? "SPEC" : "DEAD", name, chat)
	
	return PLUGIN_HANDLED
}

// Player's team say hook
public hook_team_say(id)
{
	// Retrieve the player's chat
	static chat[192], name[32], users_team
	read_args(chat, 191)
	remove_quotes(chat)
	
	// Trying to fool us ?
	if(!chat[0])
		return PLUGIN_CONTINUE
	
	// Retrieve player's name
	get_user_name(id, name, charsmax(name))
	
	// Retrieve player's team
	users_team = _:cs_get_user_team(id)
	
	// Alive user
	if (is_user_alive(id))
	{
		if (zp_get_user_zombie(id))
			color_chat(1, id, users_team, RED,  "^3[%s](Team Message)^4 %s:^1 %s", zp_get_user_nemesis(id) ? "Nemesis" : "Zombie", name, chat)
		else
			color_chat(g_new_round ? 0 : 1, id, users_team, BLUE, "^3[%s](Team Message)^4 %s:^1 %s", zp_get_user_survivor(id) ? "Survivor" : "Human", name, chat)
	}
	
	// Dead user's chat
	else color_chat(1, id, users_team, users_team, "^3[%s](Team Message)^4 %s:^1 %s", users_team == _:CS_TEAM_SPECTATOR ? "SPEC" : "DEAD", name, chat)
	
	return PLUGIN_HANDLED
}

// An improved color chat function
color_chat(team_format, player, player_team, color, const chat_msg[], ...)
{
	// Format the chat message
	static msg[192]
	vformat(msg, charsmax(msg) - 1, chat_msg, 6)
	
	// We need to display the chat message to only the player's team
	if (team_format)
	{
		// Get amount of players present
		static id, i, players[32], count
		get_players(players, count, "e", team_names[player_team])
		
		// Loop through them
		for (i = 0; i < count; i++)
		{
			// Save player's id so we dont re-index
			id = players[i]
			
			// Just in case...
			if (!id) continue;
			
			// Send the colored text message
			message_begin(MSG_ONE_UNRELIABLE, g_msg_saytext, _, id)
			write_byte(player)
			write_string(msg)
			message_end()
			
		}
	}
	else
	{
		// Do we need to change the player's team ?
		if (player_team == color)
		{
			// Send the colored text message
			message_begin(MSG_BROADCAST, g_msg_saytext)
			write_byte(player)
			write_string(msg)
			message_end()
		}
		else
		{
			// Change his team first
			message_begin(MSG_BROADCAST, g_msg_teaminfo)
			write_byte(player)
			write_string(team_names[color])
			message_end()
			
			// Send the colored text message
			message_begin(MSG_BROADCAST, g_msg_saytext)
			write_byte(player)
			write_string(msg)
			message_end()
			
			// Restore player's team
			message_begin(MSG_BROADCAST, g_msg_teaminfo)
			write_byte(player)
			write_string(team_names[player_team])
			message_end()
		}
	}
}
Искам да му се добави admin_chat_color ако може , защото като има такъв включен и този за клас в чат изписва 2 пъти написаното в чата !
флага за админ чат цвята да е "i" за чат правата!
DARKNESS-CS

Order MOD

The GODs here OciXCrom & WaLkZ !
Special thanks to them for the good work!

Аватар
TheRedShoko
Извън линия
Модератор
Модератор
Мнения: 1016
Регистриран на: 06 Окт 2016, 07:42
Местоположение: Бургас
Се отблагодари: 5 пъти
Получена благодарност: 84 пъти

Заявка за Преработка на плъгин

Мнение от TheRedShoko » 31 Окт 2018, 12:33

Оправи си заглавието.

Аватар
User12
Извън линия
Потребител
Потребител
Мнения: 321
Регистриран на: 25 Яну 2018, 22:39
Местоположение: Сливен
Се отблагодари: 40 пъти
Получена благодарност: 17 пъти
Обратна връзка:

Заявка за Преработка на плъгин

Мнение от User12 » 31 Окт 2018, 15:46

SorryMateYoureDead написа: 31 Окт 2018, 10:48 Искам да му се добави admin_chat_color ако може , защото като има такъв включен и този за клас в чат изписва 2 пъти написаното в чата !
Щом ти изписва съобщенията 2 пъти в чата означава , че имаш друг плъгин който контролира самия чат ! И в този случай единия трябва да го спреш , за да излизат нормално съобщенията .
Каналът ми в YouTube : Георги Пламенов

Изображение

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

Заявка за Преработка на плъгин

Мнение от OciXCrom » 31 Окт 2018, 21:39

Няма смисъл да ползваш този плъгин. Просто сложи това и настрой имената на отборите.

Не забравяй и това:
TheRedShoko написа: 31 Окт 2018, 12:33 Оправи си заглавието.

Публикувай отговор
  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Заявки за плъгини”

Кой е на линия

Потребители разглеждащи този форум: 0 регистрирани и 9 госта