Добавяне и команда за админи

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Аватар
Marinovv
Извън линия
Потребител
Потребител
Мнения: 511
Регистриран на: 19 Сеп 2017, 10:01
Местоположение: България
Се отблагодари: 530 пъти
Получена благодарност: 13 пъти
Обратна връзка:

Добавяне и команда за админи

Мнение от Marinovv » 09 Яну 2018, 15:10

Привет!

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

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fun>
#include <colorchat>

new const Chameleon_Sound[] = "misc/haha.wav"

new p_Status
new p_Price
new p_Prefix
new p_Sound
new p_Health
new p_HealthAmount
new p_MaxHealth
new p_InfoMsgInterval
new p_CheckValue
new p_CheckValueInterval

new g_InfoMsgEnt
new g_CheckValueEnt
new g_CZ

new g_Prefix[32]

new bool: b_Chameleon[33]
new bool: isEnabled

new const Terrorist_Models[][] =
{
	"arctic",
	"guerilla",
	"leet",
	"terror",
	"militia"
}

new const CT_Models[][] =
{
	"gign",
	"gsg9",
	"sas",
	"urban",
	"spetsnaz"
}

public plugin_precache()
{
	precache_sound(Chameleon_Sound)
}

public plugin_init()
{
	register_plugin("Chameleon", "3.0 Final", "DaRk_StyLe")
	
	p_Status = register_cvar("chameleon", "1")
	isEnabled = bool:get_pcvar_num(p_Status)
	
	if (isEnabled)
	{
		register_clcmd("say /chameleon", "ClientCommand_Chameleon")
		register_clcmd("say_team /chameleon", "ClientCommand_Chameleon")
		
		register_event("DeathMsg", "Event_DeathMsg", "a")
		
		p_Price = register_cvar("chameleon_price", "12000") 
		p_Prefix = register_cvar("chameleon_prefix", "[Legends BG Chameleon]:")
		p_Sound = register_cvar("chameleon_sounds", "0")
		p_Health = register_cvar("chameleon_health", "0")
		p_InfoMsgInterval = register_cvar("cham_infomsg_show_time", "0")
		p_CheckValue = register_cvar("cl_minmodels_check_value", "0")
		
		g_CZ = is_running("czero")
		
		if (get_pcvar_float(p_InfoMsgInterval))
		{
			g_InfoMsgEnt = create_entity("info_target")
			
			entity_set_string(g_InfoMsgEnt, EV_SZ_classname, "InfoMsg")
			entity_set_float(g_InfoMsgEnt, EV_FL_nextthink, get_gametime() + get_pcvar_float(p_InfoMsgInterval))
			
			register_think("InfoMsg", "InfoMsgThink")
		}
		
		if (get_pcvar_num(p_CheckValue))
		{
			p_CheckValueInterval = register_cvar("cl_minmodels_check_time", "0")
			
			g_CheckValueEnt = create_entity("info_target")
			
			entity_set_string(g_CheckValueEnt, EV_SZ_classname, "Check")
			entity_set_float(g_CheckValueEnt, EV_FL_nextthink, get_gametime() + get_pcvar_float(p_CheckValueInterval))
			
			register_think("Check", "CheckValueThink")
		}
		
		if (get_pcvar_num(p_Health))
		{
			p_HealthAmount = register_cvar("cham_killer_health", "20")
			p_MaxHealth = register_cvar("cham_killer_max_health", "120")
		}
	}
}

public client_connect(id)
{
	b_Chameleon[id] = false 
}

public Event_DeathMsg()
{
	new Killer = read_data(1)
	new Victim = read_data(2)
		
	if (is_user_connected(Killer) && b_Chameleon[Victim])
	{
		if (get_pcvar_num(p_Health))
		{
			new KillerHealth = get_user_health(Killer)
			new MaxHealth = get_pcvar_num(p_MaxHealth)
				
			if (KillerHealth >= MaxHealth)
			{
				set_user_health(Killer, MaxHealth)
			}
			else
			{
				new KillerName[32]
				get_user_name(Killer, KillerName, charsmax(KillerName))
					
				set_user_health(Killer, KillerHealth + get_pcvar_num(p_HealthAmount))
				client_print(0, print_chat, "%s receives extra health for killing a chameleon!", KillerName)
			}
		}
			
		new Sounds = get_pcvar_num(p_Sound)
		
		if (Sounds)
		{
			switch (Sounds)
			{
				case 1: client_cmd(0, "spk ^"%s^"", Chameleon_Sound)
				case 2: client_cmd(Killer, "spk ^"%s^"", Chameleon_Sound)
				case 3: client_cmd(Victim, "spk ^"%s^"", Chameleon_Sound)
			}
		}
		
		cs_reset_user_model(Victim)
		b_Chameleon[Victim] = false 
	}
}

public ClientCommand_Chameleon(id)
{
	new Money = cs_get_user_money(id) - get_pcvar_num(p_Price)
	get_pcvar_string(p_Prefix, g_Prefix, charsmax(g_Prefix))
	
	if (b_Chameleon[id])
	{
		ColorChat(id, GREY, "%s Vie veche imate tozi element!", g_Prefix)
	}
	else if (Money < 0)
	{
		ColorChat(id, GREY, "^4%s ^3Vie nyamate dostatachno pari!", g_Prefix)
	}
	else if (!is_user_alive(id))
	{
		ColorChat(id, GREY, "^4%s ^3Vie tryabva da badete zhiv, za da izpolzvate tazi optsiya!", g_Prefix)
	}
	else 
	{
		new CsTeams:Team = cs_get_user_team(id)
		
		switch (Team)
		{
			case CS_TEAM_T:
			{
				cs_set_user_model(id, CT_Models[random(g_CZ ? 5 : 4)])
				cs_set_user_money(id, Money)
				
				ColorChat(id, GREY, "^4%s ^3Chestito! Sega vie shte izglezhdate kato vragovete si!", g_Prefix)
				b_Chameleon[id] = true 
			}
			case CS_TEAM_CT:
			{
				cs_set_user_model(id, Terrorist_Models[random(g_CZ ? 5 : 4)])
				cs_set_user_money(id, Money)
				
				ColorChat(id, GREY, "^4%s ^3Chestito! Sega vie shte izglezhdate kato vragovete si!", g_Prefix)
				b_Chameleon[id] = true 
			}
		}
	}
}

public InfoMsgThink(Ent)
{
	if (Ent == g_InfoMsgEnt)
	{
		get_pcvar_string(p_Prefix, g_Prefix, charsmax(g_Prefix))
		client_print(0, print_chat, "%s Type /chameleon to look like the enemy!", g_Prefix)
		
		entity_set_float(g_InfoMsgEnt, EV_FL_nextthink, get_gametime() + get_pcvar_float(p_InfoMsgInterval))
	}
}

public CheckValueThink(Ent)
{
	if (Ent == g_CheckValueEnt)
	{
		CheckMinModelsValue()
		entity_set_float(g_CheckValueEnt, EV_FL_nextthink, get_gametime() + get_pcvar_float(p_CheckValueInterval))
	}
}

CheckMinModelsValue()
{
	new Players[32], Num, id
	get_players(Players, Num, "ch")
	
	for (--Num; Num >= 0; Num--)
	{
		id = Players[Num]
		query_client_cvar(id, "cl_minmodels", "Minmodels_Value")
	}
}

public Minmodels_Value(id, const cvar[], const value[])
{
	new Value = str_to_num(value)
	
	if (Value > 0)
	{
		server_cmd("kick #%d ^"This server is using a chameleon item, which requires cl_minmodels 0 !^"", get_user_userid(id))
	}
}
Може ли този код да му добавите и код като amx_chameleon <name> т.е. да може да се дава и от админи.
Иван Маринов,

лицензиран оператор и пилот на професионални дронове клас C1 за всички държави в EU.

DJI Mavic 3 Classic | DJI Mavic 3 PRO - погледни света от различна перспектива.

Последвайте ме във Facebook

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

Добавяне и команда за админи

Мнение от OciXCrom » 09 Яну 2018, 15:27

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

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fun>
#include <colorchat>

new const Chameleon_Sound[] = "misc/haha.wav"

new p_Status
new p_Price
new p_Prefix
new p_Sound
new p_Health
new p_HealthAmount
new p_MaxHealth
new p_InfoMsgInterval
new p_CheckValue
new p_CheckValueInterval

new g_InfoMsgEnt
new g_CheckValueEnt
new g_CZ

new g_Prefix[32]

new bool: b_Chameleon[33]
new bool: isEnabled

new const Terrorist_Models[][] =
{
	"arctic",
	"guerilla",
	"leet",
	"terror",
	"militia"
}

new const CT_Models[][] =
{
	"gign",
	"gsg9",
	"sas",
	"urban",
	"spetsnaz"
}

public plugin_precache()
{
	precache_sound(Chameleon_Sound)
}

public plugin_init()
{
	register_plugin("Chameleon", "3.0 Final", "DaRk_StyLe")
	
	p_Status = register_cvar("chameleon", "1")
	isEnabled = bool:get_pcvar_num(p_Status)
	
	if (isEnabled)
	{
		register_clcmd("say /chameleon", "ClientCommand_Chameleon")
		register_clcmd("say_team /chameleon", "ClientCommand_Chameleon")
		register_concmd("amx_chameleon", "AdminCommand_Chameleon", ADMIN_SLAY, "<name|#userid>")
		
		register_event("DeathMsg", "Event_DeathMsg", "a")
		
		p_Price = register_cvar("chameleon_price", "12000") 
		p_Prefix = register_cvar("chameleon_prefix", "[Legends BG Chameleon]:")
		p_Sound = register_cvar("chameleon_sounds", "0")
		p_Health = register_cvar("chameleon_health", "0")
		p_InfoMsgInterval = register_cvar("cham_infomsg_show_time", "0")
		p_CheckValue = register_cvar("cl_minmodels_check_value", "0")
		
		g_CZ = is_running("czero")
		
		if (get_pcvar_float(p_InfoMsgInterval))
		{
			g_InfoMsgEnt = create_entity("info_target")
			
			entity_set_string(g_InfoMsgEnt, EV_SZ_classname, "InfoMsg")
			entity_set_float(g_InfoMsgEnt, EV_FL_nextthink, get_gametime() + get_pcvar_float(p_InfoMsgInterval))
			
			register_think("InfoMsg", "InfoMsgThink")
		}
		
		if (get_pcvar_num(p_CheckValue))
		{
			p_CheckValueInterval = register_cvar("cl_minmodels_check_time", "0")
			
			g_CheckValueEnt = create_entity("info_target")
			
			entity_set_string(g_CheckValueEnt, EV_SZ_classname, "Check")
			entity_set_float(g_CheckValueEnt, EV_FL_nextthink, get_gametime() + get_pcvar_float(p_CheckValueInterval))
			
			register_think("Check", "CheckValueThink")
		}
		
		if (get_pcvar_num(p_Health))
		{
			p_HealthAmount = register_cvar("cham_killer_health", "20")
			p_MaxHealth = register_cvar("cham_killer_max_health", "120")
		}
	}
}

public client_connect(id)
{
	b_Chameleon[id] = false 
}

public Event_DeathMsg()
{
	new Killer = read_data(1)
	new Victim = read_data(2)
		
	if (is_user_connected(Killer) && b_Chameleon[Victim])
	{
		if (get_pcvar_num(p_Health))
		{
			new KillerHealth = get_user_health(Killer)
			new MaxHealth = get_pcvar_num(p_MaxHealth)
				
			if (KillerHealth >= MaxHealth)
			{
				set_user_health(Killer, MaxHealth)
			}
			else
			{
				new KillerName[32]
				get_user_name(Killer, KillerName, charsmax(KillerName))
					
				set_user_health(Killer, KillerHealth + get_pcvar_num(p_HealthAmount))
				client_print(0, print_chat, "%s receives extra health for killing a chameleon!", KillerName)
			}
		}
			
		new Sounds = get_pcvar_num(p_Sound)
		
		if (Sounds)
		{
			switch (Sounds)
			{
				case 1: client_cmd(0, "spk ^"%s^"", Chameleon_Sound)
				case 2: client_cmd(Killer, "spk ^"%s^"", Chameleon_Sound)
				case 3: client_cmd(Victim, "spk ^"%s^"", Chameleon_Sound)
			}
		}
		
		cs_reset_user_model(Victim)
		b_Chameleon[Victim] = false 
	}
}

public ClientCommand_Chameleon(id)
{
	purchase_chameleon(id)
	return PLUGIN_HANDLED
}

public AdminCommand_Chameleon(id, iLevel, iCid)
{
	if(!cmd_access(id, iLevel, iCid, 2))
		return PLUGIN_HANDLED
		
	new szPlayer[32]
	read_argv(1, szPlayer, charsmax(szPlayer))
	
	new iPlayer = cmd_target(id, szPlayer, CMDTARGET_OBEY_IMMUNITY|CMDTARGET_ALLOW_SELF|CMDTARGET_ONLY_ALIVE)
	
	if(!iPlayer)
		return PLUGIN_HANDLED
		
	new szName[2][32]
	get_user_name(id, szName[0], charsmax(szName[]))
	get_user_name(iPlayer, szName[1], charsmax(szName[]))
	ColorChat(0, GREY, "ADMIN ^4%s ^3gave Chameleon to ^4%s", szName[0], szName[1])
	purchase_chameleon(id, false)
	return PLUGIN_HANDLED
}

purchase_chameleon(const id, const bool:bPlayer = true)
{
	new Money
	
	if(bPlayer)
	{
		Money = cs_get_user_money(id) - get_pcvar_num(p_Price)
		get_pcvar_string(p_Prefix, g_Prefix, charsmax(g_Prefix))
	}
	
	if (b_Chameleon[id])
	{
		ColorChat(id, GREY, "%s Vie veche imate tozi element!", g_Prefix)
	}
	else if (bPlayer && Money < 0)
	{
		ColorChat(id, GREY, "^4%s ^3Vie nyamate dostatachno pari!", g_Prefix)
	}
	else if (!is_user_alive(id))
	{
		ColorChat(id, GREY, "^4%s ^3Vie tryabva da badete zhiv, za da izpolzvate tazi optsiya!", g_Prefix)
	}
	else 
	{
		new CsTeams:Team = cs_get_user_team(id)
		
		switch (Team)
		{
			case CS_TEAM_T:
			{
				cs_set_user_model(id, CT_Models[random(g_CZ ? 5 : 4)])
				cs_set_user_money(id, Money)
				
				ColorChat(id, GREY, "^4%s ^3Chestito! Sega vie shte izglezhdate kato vragovete si!", g_Prefix)
				b_Chameleon[id] = true 
			}
			case CS_TEAM_CT:
			{
				cs_set_user_model(id, Terrorist_Models[random(g_CZ ? 5 : 4)])
				cs_set_user_money(id, Money)
				
				ColorChat(id, GREY, "^4%s ^3Chestito! Sega vie shte izglezhdate kato vragovete si!", g_Prefix)
				b_Chameleon[id] = true 
			}
		}
	}
}

public InfoMsgThink(Ent)
{
	if (Ent == g_InfoMsgEnt)
	{
		get_pcvar_string(p_Prefix, g_Prefix, charsmax(g_Prefix))
		client_print(0, print_chat, "%s Type /chameleon to look like the enemy!", g_Prefix)
		
		entity_set_float(g_InfoMsgEnt, EV_FL_nextthink, get_gametime() + get_pcvar_float(p_InfoMsgInterval))
	}
}

public CheckValueThink(Ent)
{
	if (Ent == g_CheckValueEnt)
	{
		CheckMinModelsValue()
		entity_set_float(g_CheckValueEnt, EV_FL_nextthink, get_gametime() + get_pcvar_float(p_CheckValueInterval))
	}
}

CheckMinModelsValue()
{
	new Players[32], Num, id
	get_players(Players, Num, "ch")
	
	for (--Num; Num >= 0; Num--)
	{
		id = Players[Num]
		query_client_cvar(id, "cl_minmodels", "Minmodels_Value")
	}
}

public Minmodels_Value(id, const cvar[], const value[])
{
	new Value = str_to_num(value)
	
	if (Value > 0)
	{
		server_cmd("kick #%d ^"This server is using a chameleon item, which requires cl_minmodels 0 !^"", get_user_userid(id))
	}
}

Аватар
Marinovv
Извън линия
Потребител
Потребител
Мнения: 511
Регистриран на: 19 Сеп 2017, 10:01
Местоположение: България
Се отблагодари: 530 пъти
Получена благодарност: 13 пъти
Обратна връзка:

Добавяне и команда за админи

Мнение от Marinovv » 09 Яну 2018, 15:54

Благодаря ти, работи и може да локвате.
Иван Маринов,

лицензиран оператор и пилот на професионални дронове клас C1 за всички държави в EU.

DJI Mavic 3 Classic | DJI Mavic 3 PRO - погледни света от различна перспектива.

Последвайте ме във Facebook

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

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

Кой е на линия

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