Jump to content
Sign in to follow this  
Simon

[SUG] See Alive Player's Health

Recommended Posts

Long ago I posted this -

...

Lowest HP Game - All Ts are supposed to have same hp(Important) reach a previously specified high place(preferably a high tower) and they are asked to jump down. Whoever has the lowest HP chooses his LR partner.

*EDIT* Sometimes I even allow them to do it any number of times they want and from any place but in a specified time frame. Most of the times there is only 1 left even before the game finishes.

...

Now I don't know if you can see the player health of players from spectator or not, so you may need an admin for this as I can't even find a plugin which shows player health on aiming him with crosshair as in 1.6

Not a bad game, but unfortunately CTs can't see T's HP.

So now I have made this sourcemod plugin which can show a players health on PrintHintText box upon aiming on them but I don't have srcds to test it so here it is -

#include 
#include 
#include 

#define PLUGIN_VERSION   "1.0"

new target_health;

public Plugin:myinfo =
{
	name = "HUD Health",
	author = "Simon",
	description = "Show health on HUD for CSGO",
	version = PLUGIN_VERSION,
	url = "http://www.sourcemod.net/"
};

public OnPluginStart()
{
    LoadTranslations("common.phrases");
	CreateConVar("sm_hud_health", PLUGIN_VERSION, "Show health on HUD", FCVAR_PLUGIN | FCVAR_SPONLY | FCVAR_DONTRECORD | FCVAR_NOTIFY);
	CreateTimer(0.5, Timer, _, TIMER_REPEAT);
}

stock TraceClientViewEntity(client)
{
	new Float:m_vecOrigin[3];
	new Float:m_angRotation[3];

	GetClientEyePosition(client, m_vecOrigin);
	GetClientEyeAngles(client, m_angRotation);

	new Handle:tr = TR_TraceRayFilterEx(m_vecOrigin, m_angRotation, MASK_VISIBLE, RayType_Infinite, TRDontHitSelf, client);
	new pEntity = -1;

	if (TR_DidHit(tr))
	{
		pEntity = TR_GetEntityIndex(tr);
		CloseHandle(tr);
		return pEntity;
	}

	if(tr != INVALID_HANDLE)
	{
		CloseHandle(tr);
	}

	return -1;
}

public Action:Timer(Handle:timer)
{
	for(new i = 1; i <= MaxClients; i++)
	{
		if (IsClientInGame(i))
		{
			new target = TraceClientViewEntity(i);
			if(target > 0 && target <= MaxClients && IsClientInGame(target) && IsPlayerAlive(target))
			{
				target_health = GetClientHealth(target);
				PrintHintText(i, "HP: \"%i\"", target_health);
			}
		}
	}
	return Plugin_Continue; 
}

public bool:TRDontHitSelf(entity, mask, any:data)
{
return (1 <= entity <= MaxClients); 
}

If there is anyone familiar with SourcePawn then check the code as I am not too familiar with SourcePawn.

Link to the thread

EDIT: Plugin posted on AlliedModders

Edited by Guest

Share this post


Link to post

Interesting

So you're sending out a ray trace from the players view, checking if it hit a player then displaying a hint with that players health.

Could be good, although isn't there a few plugins or server commands for viewing enemy health anyway?

It'd be good if you could do it for just a specific person, for example the two people in LR.

Share this post


Link to post
Interesting

So you're sending out a ray trace from the players view, checking if it hit a player then displaying a hint with that players health.

Could be good, although isn't there a few plugins or server commands for viewing enemy health anyway?

It'd be good if you could do it for just a specific person, for example the two people in LR.

I couldn't find any plugin or server command that can do this till now. I wanted to make it available only for Counter-Terrorists so that they can check players' health and then can conduct the Lowest HP game. Though I can do it for specific people.(Why for the 2 people in lr?)

Edit: If anyone can compile it(needs sdktools, sourcemod) then I can publish it on AlliedModders.

Share this post


Link to post
Interesting

So you're sending out a ray trace from the players view, checking if it hit a player then displaying a hint with that players health.

Could be good, although isn't there a few plugins or server commands for viewing enemy health anyway?

It'd be good if you could do it for just a specific person, for example the two people in LR.

I couldn't find any plugin or server command that can do this till now. I wanted to make it available only for Counter-Terrorists so that they can check players' health and then can conduct the Lowest HP game. Though I can do it for specific people.(Why for the 2 people in lr?)

If you do need to implement it for certain people, take a look at https://forums.alliedmods.net/showthread.php?p=1044646.

Here there is an admin group that can see everybodies health.

Share this post


Link to post
Interesting

So you're sending out a ray trace from the players view, checking if it hit a player then displaying a hint with that players health.

Could be good, although isn't there a few plugins or server commands for viewing enemy health anyway?

It'd be good if you could do it for just a specific person, for example the two people in LR.

I couldn't find any plugin or server command that can do this till now. I wanted to make it available only for Counter-Terrorists so that they can check players' health and then can conduct the Lowest HP game. Though I can do it for specific people.(Why for the 2 people in lr?)

If you do need to implement it for certain people, take a look at https://forums.alliedmods.net/showthread.php?p=1044646.

Here there is an admin group that can see everybodies health.

That plugin was the closest thing to it but doesn't have CS:GO/CS:S support. The reason is basically that CS:GO and CS:S do not support HUD text as of now.

Games Supporting hudtext:

-TF2

-Age of Chivarly

-hl2mp

-insurgency

-zombie_master

-sourceforts

-obsidian

-bg2

And yeah I know how to implement it for specific people as I have good knowledge of coding in Pawn which was used in 1.6 and CZ. It is just that I have uploaded the version which is not updated by that because I didn't know if the server would need it.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...