Raised This Month: $51 Target: $400
 12% 

[Request] Hit zones HUD


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
z4rk
Member
Join Date: Aug 2019
Old 10-21-2021 , 06:25   [Request] Hit zones HUD
Reply With Quote #1

Hi. I'm looking for a plugin and I can't find it. It's something like bullet_damage, but it doesn't show numbers, it shows hit zones (arm, leg, head, etc) with random colors (blue, orange, purple, red, pink).

PHOTO
VIDEO

Is possible to make it ? Or if the plugin already exists here, I would like to know its name.
Thank you!

Last edited by z4rk; 10-21-2021 at 06:26.
z4rk is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 10-21-2021 , 09:35   Re: [Request] Hit zones HUD
Reply With Quote #2

Here

To change the name of the hit zones, search for this

Code:
new const HITGROUP_NAMES[9][] = {
	"", // none
	"Headshot",	// HIT_HEAD
	"Chest", // HIT_CHEST
	"Stomach", // HIT_STOMACH
	"Left arm", // HIT_LEFTARM
	"Right arm", // HIT_RIGHTARM
	"Left leg", // HIT_LEFTLEG
	"Right leg", // HIT_RIGHTLEG
	"Shield" // HIT_SHIELD
}

To change the hud colors, search for this

Code:
new const HUD_COLORS[][3] = {
	{200, 0, 0},
	{0, 200, 0},
	{0, 100, 200},
	{0, 150, 150},
	{150, 150, 0},
	{150, 0, 150}
}
Syntax: { red value, green value, blue value }
The color values should be in the range of 0 to 255
The hud color will be a random color among the colors you define

To change the hud positions, search for this

Code:
new const Float:HUD_POSITIONS[][2] = {
	{-0.575, -0.60},
	{-0.50, -0.625},
	{-0.425, -0.60},
	{-0.30, -0.50},
	{-0.70, -0.50}
}
Syntax: { x axis, y axis }
-1.0 means center.
It will start from the beginning, once it reach the end it will restart.

Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

new const HITGROUP_NAMES[9][] = {
	"", // none
	"Headshot",	// HIT_HEAD
	"Chest", // HIT_CHEST
	"Stomach", // HIT_STOMACH
	"Left arm", // HIT_LEFTARM
	"Right arm", // HIT_RIGHTARM
	"Left leg", // HIT_LEFTLEG
	"Right leg", // HIT_RIGHTLEG
	"Shield" // HIT_SHIELD
}

new const HUD_COLORS[][3] = {
	{200, 0, 0},
	{0, 200, 0},
	{0, 100, 200},
	{0, 150, 150},
	{150, 150, 0},
	{150, 0, 150}
}

new const Float:HUD_POSITIONS[][2] = {
	{-0.575, -0.60},
	{-0.50, -0.625},
	{-0.425, -0.60},
	{-0.30, -0.50},
	{-0.70, -0.50}
}

new g_player_hud_pos[MAX_PLAYERS+1]

public plugin_init()
{
	register_plugin("Hitgroup Bullet Damage", "1.0", "Ainsley Harriott")
	RegisterHamPlayer(Ham_TakeDamage, "OnTakeDamagePost", 1)
}

public client_putinserver(index)
{
	g_player_hud_pos[index] = 0
}

public OnTakeDamagePost(victim, inflictor, attacker, Float:damage, damagebits)
{
	if (victim == attacker || !(1 <= attacker <= MaxClients) || get_user_team(victim) == get_user_team(attacker))
	{
		return
	}

	new hitgroup = get_ent_data(victim, "CBaseMonster", "m_LastHitGroup")

	if (!HITGROUP_NAMES[hitgroup][0])
	{
		return
	}

	new rand = random(sizeof HUD_COLORS)
	new pos = g_player_hud_pos[attacker]

	set_hudmessage(HUD_COLORS[rand][0], HUD_COLORS[rand][1], HUD_COLORS[rand][2], HUD_POSITIONS[pos][0], HUD_POSITIONS[pos][1], 2, 0.0, 1.0, 0.02, 0.02)
	show_hudmessage(attacker, HITGROUP_NAMES[hitgroup])

	g_player_hud_pos[attacker] = (g_player_hud_pos[attacker] + 1) % sizeof HUD_POSITIONS
}
__________________









Last edited by CrazY.; 10-21-2021 at 12:14.
CrazY. is offline
z4rk
Member
Join Date: Aug 2019
Old 10-21-2021 , 10:48   Re: [Request] Hit zones HUD
Reply With Quote #3

I tried to compile it, but I get the following errors:

Code:
//// hitzone_hud.sma
// C:\hlds\cs\cstrike\addons\amxmodx\scripting\hitzone_hud.sma(34) : error 017: undefined symbol "MAX_PLAYERS"
// C:\hlds\cs\cstrike\addons\amxmodx\scripting\hitzone_hud.sma(36) : error 009: invalid array size (negative or zero)
// C:\hlds\cs\cstrike\addons\amxmodx\scripting\hitzone_hud.sma(39) : error 017: undefined symbol "RegisterHamPlayer"
// C:\hlds\cs\cstrike\addons\amxmodx\scripting\hitzone_hud.sma(49) : error 017: undefined symbol "MaxClients"
// C:\hlds\cs\cstrike\addons\amxmodx\scripting\hitzone_hud.sma(54) : error 017: undefined symbol "get_ent_data"
//
// 5 Errors.
// Could not locate output file compiled\hitzone_hud.amx (compile failed).
//
// Compilation Time: 0.12 sec

Last edited by z4rk; 10-21-2021 at 10:50.
z4rk is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-21-2021 , 10:54   Re: [Request] Hit zones HUD
Reply With Quote #4

This plugin seems to be made for amxx 1.9+
__________________
HamletEagle is offline
z4rk
Member
Join Date: Aug 2019
Old 10-21-2021 , 12:07   Re: [Request] Hit zones HUD
Reply With Quote #5

Thank you very much.
I tested it with AMXX 1.9.x and it works. The only problem is that the text also appears when I shoot my teammates, even if Friendly fire is off.
z4rk is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 10-21-2021 , 12:15   Re: [Request] Hit zones HUD
Reply With Quote #6

Should be working now, updated my previous post.
__________________









Last edited by CrazY.; 10-21-2021 at 12:16.
CrazY. is offline
z4rk
Member
Join Date: Aug 2019
Old 10-21-2021 , 12:28   Re: [Request] Hit zones HUD
Reply With Quote #7

Quote:
Originally Posted by CrazY. View Post
Should be working now, updated my previous post.
Perfect. Thank you!
z4rk is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:26.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode