Add glow for best player

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Аватар
Taliban
Извън линия
Foreigner
Foreigner
Мнения: 5
Регистриран на: 01 Авг 2020, 18:54

Add glow for best player

Мнение от Taliban » 01 Авг 2020, 19:07

Здравейте всички) как да направите това, което би било най-добрият играч на кръга, който показва, че е получил блясък, а след това е заснет, ако той в друг кръг вече не е най-добрият, ct синьо, tt червено
наистина трябва моля направете

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

#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <csx>
#include <dhudmessage>

#include <fakemeta>
#include <engine>

#define add_bit(%1,%2) (%1 |= (1 << (%2 - 1)))
#define is_bit(%1,%2) (%1 & (1 << (%2 - 1)))
#define remove_bit(%1,%2) (%1 &= ~(1 << (%2 - 1)))

#pragma semicolon 1

#define PLUGIN "CS:GO Features" // Kill Assists, Simple MVP, Free ammo
#define VERSION "1.0.1.1"
#define AUTHOR "Sho0ter"

#define NORMAL_KILL 1.0
#define HS_KILL 1.3
#define GRENADE_KILL 1.5
#define KNIFE_KILL 2.5
#define BOMB_PLANTED 1.25
#define BOMB_DEFUSED 1.5
#define ASSIST_KILL 0.5
#define MVP_PRIZE 1000

enum any:MVP_STATS
{
	Float:VALUE,
	NORMAL,
	HS,
	bool:GRENADE,
	bool:KNIFE,
	bool:PLANTED,
	bool:DEFUSED,
	ASSIST
};

new max_bpammo[31] =
{
	0,
	52,  //CSW_P228
	0,
	90,  //CSW_SCOUT
	1,   //CSW_HEGRENADE
	32,  //CSW_XM1014
	1,   //CSW_C4
	100, //CSW_MAC10
	90,  //CSW_AUG
	1,   //CSW_SMOKEGRENADE
	120, //CSW_ELITE
	100, //CSW_FIVESEVEN
	100, //CSW_UMP45
	90,  //CSW_SG550
	90,  //CSW_GALIL
	90,  //CSW_FAMAS
	100, //CSW_USP
	120, //CSW_GLOCK18
	30,  //CSW_AWP
	120, //CSW_MP5NAVY
	200, //CSW_M249
	32,  //CSW_M3
	90,  //CSW_M4A1
	120, //CSW_TMP
	90,  //CSW_G3SG1
	2,   //CSW_FLASHBANG
	35,  //CSW_DEAGLE
	90,  //CSW_SG552
	90,  //CSW_AK47
	0,   //CSW_KNIFE
	100  //CSW_P90
};

new clip_size[31] =
{
	0,
	13,  //CSW_P228
	0,
	10,  //CSW_SCOUT
	0,   //CSW_HEGRENADE
	7,   //CSW_XM1014
	0,   //CSW_C4
	30,  //CSW_MAC10
	30,  //CSW_AUG
	0,   //CSW_SMOKEGRENADE
	30,  //CSW_ELITE
	20,  //CSW_FIVESEVEN
	25,  //CSW_UMP45
	30,  //CSW_SG550
	35,  //CSW_GALIL
	25,  //CSW_FAMAS
	12,  //CSW_USP
	20,  //CSW_GLOCK18
	10,  //CSW_AWP
	30,  //CSW_MP5NAVY
	100, //CSW_M249
	8,   //CSW_M3
	30,  //CSW_M4A1
	30,  //CSW_TMP
	20,  //CSW_G3SG1
	0,   //CSW_FLASHBANG
	7,   //CSW_DEAGLE
	30,  //CSW_SG552
	30,  //CSW_AK47
	0,   //CSW_KNIFE
	50   //CSW_P90
};

new ammo_type[31] =
{
	0,
	9,  //CSW_P228
	0,
	2,  //CSW_SCOUT
	12, //CSW_HEGRENADE
	5,  //CSW_XM1014
	14, //CSW_C4
	6,  //CSW_MAC10
	4,  //CSW_AUG
	13, //CSW_SMOKEGRENADE
	10, //CSW_ELITE
	7,  //CSW_FIVESEVEN
	6,  //CSW_UMP45
	4,  //CSW_SG550
	4,  //CSW_GALIL
	4,  //CSW_FAMAS
	6,  //CSW_USP
	10, //CSW_GLOCK18
	1,  //CSW_AWP
	10, //CSW_MP5NAVY
	3,  //CSW_M249
	5,  //CSW_M3
	4,  //CSW_M4A1
	10, //CSW_TMP
	2,  //CSW_G3SG1
	11, //CSW_FLASHBANG
	8,  //CSW_DEAGLE
	4,  //CSW_SG552
	2,  //CSW_AK47
	0,  //CSW_KNIFE
	7   //CSW_P90
};

new ammo_name[15][] =
{
	"",
	"ammo_338magnum",
	"ammo_762nato",
	"ammo_556natobox",
	"ammo_556nato",
	"ammo_buckshot",
	"ammo_45acp",
	"ammo_57mm",
	"ammo_50ae",
	"ammo_357sig",
	"ammo_9mm",
	"",
	"",
	"",
	""
};

new message_saytext, message_deathmsg, message_money, message_weap_pickup, last_message_id, last_message_type, maxplayers, blockinfo;
new last_message[33], last_weap_pickup[33], bought_weapon[33];
new damages[33][33], names[33][32], any:mvp[33][MVP_STATS], assists[33];

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR);

	message_saytext = get_user_msgid("SayText");
	message_deathmsg = get_user_msgid("DeathMsg");
	message_weap_pickup = get_user_msgid("WeapPickup");
	message_money = get_user_msgid("Money");

	register_clcmd("fullupdate", "clcmd_fullupdate");

	register_message(message_deathmsg, "fwd_diemsg");

	register_event("Damage", "fwd_damage", "be", "2!0", "3=0", "4!0");
	register_event("DeathMsg", "fwd_die", "ae");

	register_logevent("fwd_roundend", 2, "1=Round_End");

	RegisterHam(Ham_Spawn, "player", "fwd_spawn", 1);

	register_forward(FM_MessageBegin, "fwd_message_begin", 1);
	register_forward(FM_WriteByte, "fwd_write_byte", 1);

	maxplayers = get_maxplayers();

	return PLUGIN_CONTINUE;
}

public fwd_roundend()
{
	return set_task(0.1, "calc_mvp");
}

public calc_mvp()
{
	new mvpid, Float:cmvp;
	for(new id = 1; id <= maxplayers; id++)
	{
		if(is_user_connected(id) && mvp[id][VALUE] > 1.5 && mvp[id][VALUE] > cmvp)
		{
			mvpid = id;
			cmvp = mvp[id][VALUE];
		}
	}

	if(mvpid)
	{
		cs_set_user_money(mvpid, min(cs_get_user_money(mvpid) + MVP_PRIZE, 16000), 1);

		new bool:inits;

		new name[32], mvp_message[256];
		get_user_name(mvpid, name, 31);
		set_dhudmessage(0, 200, 0, -1.0, 0.65, 2, 6.0, 4.0, 0.01, 1.0, true);
		new len = formatex(mvp_message, 256, "Най-добър играч:%s^n % d убийства.", name, mvp[mvpid][NORMAL]);
		if(mvp[mvpid][HS])
		{
			len += formatex(mvp_message[len], 255 - len, ", %d в главата", mvp[mvpid][HS]);
		}
		if(mvp[mvpid][ASSIST])
		{
			len += formatex(mvp_message[len], 255 - len, ", %d грижа", mvp[mvpid][ASSIST]);
		}
		if(mvp[mvpid][GRENADE])
		{
			len += formatex(mvp_message[len], 255 - len, "^убийства с гранати");
			inits = true;
		}
		if(mvp[mvpid][KNIFE])
		{
			if(!inits)
			{
				inits = true;
				len += formatex(mvp_message[len], 255 - len, "^n от нож");
			}
			else
			{
				len += formatex(mvp_message[len], 255 - len, ", от ножl");
			}
		}
		if(mvp[mvpid][PLANTED])
		{
			if(!inits)
			{
				inits = true;
				len += formatex(mvp_message[len], 255 - len, "^Заложил е бомба");
			}
			else
			{
				len += formatex(mvp_message[len], 255 - len, ", Заложил е бомба");
			}
		}
		if(mvp[mvpid][DEFUSED])
		{
			if(!inits)
			{
				inits = true;
				len += formatex(mvp_message[len], 255 - len, "^nОбезвредих бомбата");
			}
			else
			{
				len += formatex(mvp_message[len], 255 - len, ", Обезвредих бомбата");
			}
		}

		show_dhudmessage(0, "%s", mvp_message);
	}

	for(new i = 1; i <= maxplayers; i++)
	{
		mvp[i][VALUE] = 0.0;
		mvp[i][NORMAL] = 0;
		mvp[i][HS] = 0;
		mvp[i][ASSIST] = 0;
		mvp[i][GRENADE] = false;
		mvp[i][KNIFE] = false;
		mvp[i][PLANTED] = false;
		mvp[i][DEFUSED] = false;
	}

	return PLUGIN_CONTINUE;
}

stock show_given_bpammo(id, weap_id, ammount)
{
	if(ammount <= 0)
	{
		return PLUGIN_CONTINUE;
	}

	message_begin(MSG_ONE, get_user_msgid("AmmoPickup"), {0, 0, 0}, id);
	write_byte(ammo_type[weap_id]);
	write_byte(ammount);
	return message_end();
}

public bool:fill_bpammo_show(id, weap_id)
{
	new given_ammo = max_bpammo[weap_id];
	if(weapon_has_ammo(weap_id))
	{
		given_ammo -= cs_get_user_bpammo(id, weap_id);
	}
	if(fill_bpammo(id, weap_id))
	{
		show_given_bpammo(id, weap_id, given_ammo);
		return true;
	}

	return false;
}

public client_putinserver(id)
{
	return get_user_name(id, names[id], 31);
}

public fwd_message_begin(msg_dest, msg_type, const Float:origin[3], id)
{
	if(id < 1 || id > 32)
	{
		return FMRES_IGNORED;
	}

	if(msg_type == message_money && last_message[id] == message_weap_pickup)
	{
		new arg[2];
		arg[0] = id;
		arg[1] = last_weap_pickup[last_message_id];
		set_task(0.1, "do_weapon_buy", _, arg, 2);
	}

	last_message_id = id;
	last_message_type = msg_type;
	last_message[id] = msg_type;

	return FMRES_IGNORED;
}

public do_weapon_buy(arg[])
{
	if(!is_user_connected(arg[0]))
	{
		return PLUGIN_CONTINUE;
	}

	if(fill_weapon(arg[0], arg[1]))
	{
		fill_bpammo_show(arg[0], arg[1]);
	}

	return PLUGIN_CONTINUE;
}

stock bool:weapon_has_ammo(weap_id)
{
	return ammo_name[ammo_type[weap_id]][0] != 0;
}

stock bool:fill_bpammo(id, weap_id)
{
	new ammo = max_bpammo[weap_id];
	if(weapon_has_ammo(weap_id))
	{
		cs_set_user_bpammo(id, weap_id, ammo);
		return true;
	}

	return false;
}

stock bool:fill_weapon(id, weap_id)
{
	new clip_sz = clip_size[weap_id];
	if(clip_sz != 0)
	{
		new weap_name[41];
		get_weaponname(weap_id, weap_name, 40);
		new wpn = find_ent_by_owner(-1, weap_name, id);
		if(wpn != 0)
		{
			cs_set_weapon_ammo(wpn, clip_sz);
			return true;
		}
	}

	return false;
}

public fwd_write_byte(value)
{
	if(last_message_type == message_weap_pickup)
	{
		last_weap_pickup[last_message_id] = value;
	}

	return FMRES_IGNORED;
}

public client_disconnected(id)
{
	arrayset(damages[id], 0, 33);
	assists[id] = 0;
	last_message[id] = 0;
	last_weap_pickup[id] = 0;
	bought_weapon[id] = 0;
	mvp[id][VALUE] = 0.0;
	mvp[id][NORMAL] = 0;
	mvp[id][HS] = 0;
	mvp[id][ASSIST] = 0;
	mvp[id][GRENADE] = false;
	mvp[id][KNIFE] = false;
	mvp[id][PLANTED] = false;
	mvp[id][DEFUSED] = false;
	return PLUGIN_CONTINUE;
}

public clcmd_fullupdate()
{
	return PLUGIN_HANDLED;
}

public client_infochanged(id)
{
	if(is_bit(blockinfo, id))
	{
		return PLUGIN_CONTINUE;
	}

	return get_user_info(id, "name", names[id], 31);
}

public fwd_spawn(id)
{
	if(!is_user_alive(id))
	{
		return HAM_IGNORED;
	}

	new name[32];
	get_user_name(id, name, 31);
	if(!equal(name, names[id]))
	{
		set_msg_block(message_saytext, BLOCK_ONCE);
		set_user_info(id, "name", names[id]);
	}

	arrayset(damages[id], 0, 33);
	last_message[id] = 0;
	last_weap_pickup[id] = 0;
	bought_weapon[id] = 0;
	mvp[id][VALUE] = 0.0;
	mvp[id][NORMAL] = 0;
	mvp[id][HS] = 0;
	mvp[id][ASSIST] = 0;
	mvp[id][GRENADE] = false;
	mvp[id][KNIFE] = false;
	mvp[id][PLANTED] = false;
	mvp[id][DEFUSED] = false;

	return HAM_IGNORED;
}

public ammo_spawn(id)
{
	if(!is_user_connected(id))
	{
		return PLUGIN_CONTINUE;
	}

	new weap_ids[32], num_weaps;
	get_user_weapons(id, weap_ids, num_weaps);

	for(new i = 0; i < num_weaps; i++)
	{
		new weap_id = weap_ids[i];

		if(fill_weapon(id, weap_id))
		{
			fill_bpammo_show(id, weap_id);
		}
	}

	return PLUGIN_CONTINUE;
}

public fwd_damage(id)
{
	if(!(1 <= id <= maxplayers))
	{
		return PLUGIN_CONTINUE;
	}

	new aid = get_user_attacker(id);

	if(!(1 <= aid <= maxplayers))
	{
		return PLUGIN_CONTINUE;
	}

	if(cs_get_user_team(id) == cs_get_user_team(aid))
	{
		return PLUGIN_CONTINUE;
	}

	damages[aid][id] += read_data(2);

	return PLUGIN_CONTINUE;
}

public fwd_die()
{
	new vid = read_data(2);
	new kid = read_data(1);
	new ihs = read_data(3);

	new weapon[24];
	read_data(4, weapon, 23);
	if(!(1 <= vid <= maxplayers))
	{
		do_deathmsg(kid, vid, ihs, weapon);
		return PLUGIN_CONTINUE;
	}

	mvp[vid][VALUE] -= 0.5;

	if(kid != vid)
	{
		if((1 <= kid <= maxplayers) && get_user_team(kid) != get_user_team(vid))
		{
			mvp[kid][NORMAL]++;

			if(equal(weapon, "knife"))
			{
				mvp[kid][VALUE] += calculate_mvp(kid, KNIFE_KILL);
				mvp[kid][KNIFE] = true;
			}
			else if(equal(weapon, "grenade"))
			{
				mvp[kid][VALUE] += calculate_mvp(kid, GRENADE_KILL);
				mvp[kid][GRENADE] = true;
			}
			else if(ihs)
			{
				mvp[kid][VALUE] += calculate_mvp(kid, HS_KILL);
				mvp[kid][HS]++;
			}
			else
			{
				mvp[kid][VALUE] += calculate_mvp(kid, NORMAL_KILL);
			}
		}

		new assistid, maxdmg;

		for(new id = 1; id <= maxplayers; id++)
		{
			if(id != kid && is_user_connected(id) && damages[id][vid] >= 50 && damages[id][vid] > maxdmg)
			{
				assistid = id;
				maxdmg = damages[id][vid];
			}

			damages[id][vid] = 0;
		}

		if(assistid)
		{

			mvp[assistid][VALUE] += ASSIST_KILL;
			mvp[assistid][ASSIST]++;

			if(++assists[assistid] == 2)
			{
				set_pev(assistid, pev_frags, float(pev(assistid, pev_frags)) + 1.0);

				assists[assistid] = 0;
			}

			cs_set_user_money(assistid, min(cs_get_user_money(assistid) + 150, 16000), 1);

			if(!(1 <= kid <= maxplayers))
			{
				do_deathmsg(kid, vid, ihs, weapon);
				return PLUGIN_CONTINUE;
			}

			new kname[32], aname[32], newnames[32], wpn[32];

			if(is_user_alive(kid))
			{
				get_user_name(kid, kname, 31);
				get_user_name(assistid, aname, 31);

				copy(names[kid], 31, kname);

				if((strlen(kname) + strlen(aname)) <= 29) {
					formatex(newnames, 31, "%s", kname, aname);
				} else {
					formatex(newnames, 28, "%s", kname, aname);
					add(newnames, 31, "...");
				}

				set_msg_block(message_saytext, BLOCK_ONCE);
				add_bit(blockinfo, kid);

				set_user_info(kid, "name", newnames);
			}

			if(equali(weapon, "grenade"))
			{
				wpn = "weapon_hegrenade";
			}
			else
			{
				formatex(wpn, 31, "weapon_%s", weapon);
			}

			new args[4];
			args[0] = vid;
			args[1] = kid;
			args[2] = ihs;
			args[3] = get_weaponid(wpn);

			set_task(0.1, "fwd_diepost", 0, args, 4);
		}
		else
		{
			do_deathmsg(kid, vid, ihs, weapon);
		}
	}
	else
	{
		do_deathmsg(kid, vid, ihs, weapon);
	}

	return PLUGIN_CONTINUE;
}

public fwd_diepost(arg[])
{
	new weapon[24];
	new kid = arg[1];

	if(!is_user_connected(kid) || !is_user_connected(arg[0]))
	{
		return PLUGIN_CONTINUE;
	}

	get_weaponname(arg[3], weapon, 23);

	format(weapon, 22, "%s", weapon[7]);

	if(equal(weapon, "hegrenade"))
	{
		weapon = "grenade";
	}

	do_deathmsg(kid, arg[0], arg[2], weapon);

	set_msg_block(message_saytext, BLOCK_ONCE);
	set_user_info(kid, "name", names[kid]);
	remove_bit(blockinfo, kid);

	return PLUGIN_CONTINUE;
}

public bomb_planted(id)
{
	mvp[id][VALUE] += calculate_mvp(id, BOMB_PLANTED);
	mvp[id][PLANTED] = true;

	return PLUGIN_CONTINUE;
}

public bomb_defused(id)
{
	mvp[id][VALUE] += calculate_mvp(id, BOMB_DEFUSED);
	mvp[id][DEFUSED] = true;

	return PLUGIN_CONTINUE;
}

public fwd_diemsg()
{
	return PLUGIN_HANDLED;
}

stock do_deathmsg(kid, vid, ihd, const wpn[])
{
	message_begin(MSG_ALL, message_deathmsg);
	write_byte(kid);
	write_byte(vid);
	write_byte(ihd);
	write_string(wpn);
	return message_end();
}

stock Float:calculate_mvp(id, Float:val)
{
	new CsTeams:etm, CsTeams:itm = cs_get_user_team(id);
	if(itm == CS_TEAM_CT)
	{
		etm = CS_TEAM_T;
	}
	else if(itm == CS_TEAM_T)
	{
		etm = CS_TEAM_CT;
	}
	else
	{
		return 0.0;
	}

	new icnt = 1, ecnt = 1;

	for(new i = 1; i <= maxplayers; i++)
	{
		if(!is_user_alive(i) || i == id)
		{
			continue;
		}

		if(cs_get_user_team(i) == itm)
		{
			icnt++;
		}
		else if(cs_get_user_team(i) == etm)
		{
			ecnt++;
		}
	}

	return (val * floatclamp((float(ecnt) / float(icnt)), 0.75, 1.3));
}
Последно промяна от OciXCrom на 02 Авг 2020, 14:29, променено общо 1 път.
Причина: Use descriptive topic titles!

Аватар
atmax
Извън линия
Потребител
Потребител
Мнения: 271
Регистриран на: 22 Мар 2018, 15:06
Се отблагодари: 8 пъти
Получена благодарност: 15 пъти

добавяне към плъгин

Мнение от atmax » 01 Авг 2020, 22:03

Do not use Google translate.. Just type your question in english
while(alive)
{
if(friends == 0){
find_friends()
else
find_job()
}
compile error: undefined symbol friends
compile error: find_friends returned false.

Аватар
Taliban
Извън линия
Foreigner
Foreigner
Мнения: 5
Регистриран на: 01 Авг 2020, 18:54

добавяне към плъгин

Мнение от Taliban » 01 Авг 2020, 22:12

atmax написа:
01 Авг 2020, 22:03
Do not use Google translate.. Just type your question in english
Hi, I need that when the plugin shows the best player at the end of the round, it has a glow in the new round, and so every best player in the new round

Аватар
Taliban
Извън линия
Foreigner
Foreigner
Мнения: 5
Регистриран на: 01 Авг 2020, 18:54

добавяне към плъгин

Мнение от Taliban » 01 Авг 2020, 22:16

the CT is blue and the TT is red

Аватар
Taliban
Извън линия
Foreigner
Foreigner
Мнения: 5
Регистриран на: 01 Авг 2020, 18:54

Add glow for best player

Мнение от Taliban » 02 Авг 2020, 20:48

МНЕНИЕТО Е СКРИТО ОТ СТРАНА НА МОДЕРАТОР! ЦЪКНИ ВЪРХУ ЛЕНТАТА ЗА ДА ГО ПРЕГЛЕДАШ.
Последно промяна от OciXCrom на 03 Авг 2020, 14:25, променено общо 1 път.
Причина: Do NOT bump your threads!!!

Аватар
JackEyedJones
Извън линия
Потребител
Потребител
Мнения: 351
Регистриран на: 10 Сеп 2018, 17:26
Местоположение: Plovdiv, Bulgaria, Europe, Entire World
Се отблагодари: 4 пъти
Получена благодарност: 57 пъти
Обратна връзка:

Add glow for best player

Мнение от JackEyedJones » 02 Авг 2020, 21:06

Something similar here: viewtopic.php?p=54689#p54689
Hope it helps.

Аватар
Taliban
Извън линия
Foreigner
Foreigner
Мнения: 5
Регистриран на: 01 Авг 2020, 18:54

Add glow for best player

Мнение от Taliban » 02 Авг 2020, 21:25

JackEyedJones написа:
02 Авг 2020, 21:06
Something similar here: viewtopic.php?p=54689#p54689
Hope it helps.
it doesn't fit

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

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

Кой е на линия

Потребители разглеждащи този форум: Yandex [Bot] и 8 госта