PDA

View Full Version : [REQUEST] HUD (playername, health, clan tag)


john2012
02-04-2012, 05:51
Hi,

Is there someone can code a script that shows the player name , his clan tag and his health in a hud (hud with the same texture that a menu) located in the low center ? with a distance of 250. So player can see the name, clan tag and health of all palyers team.

Thanks,

TheAvengers2
02-04-2012, 12:55
I might make this, but I'll need some information from you:

What hud exactly? Could you clarify this, perhaps take a screenshot of it?
If it's the hint box hud, then that's limited to a maximum of 127 characters and 10 lines.

What's the maximum number of players you intend on having for each team?
If there's too much player information, then it'll have to show a different player each refresh because it can't fit in the hud message.

What game is this for?

john2012
02-04-2012, 15:59
Thanks for reply,
it's for counter strike source, and it's for 40-46 players.
like this:

http://**************/photo/my-images/855/hud.gif/

regards,

TheAvengers2
02-04-2012, 16:57
So, what we're looking at here is:

12 characters for max tag length
32 characters for max username length
3 characters for max hp length
2 characters total for a spacer between information
1 character for new line or null byte

50 characters total per player while the hud only allows a maximum of 127.


Yup, like I thought, the hint box hud. This might not be a very good idea for that many players. You can only fit two players with max length information in there, but since people don't usually have max everything, maybe 3-5 players assuming you're lucky. If we're to go through with this, then we'll probably need to display a different set of users each second or so.

Are you sure you want this plugin? I mean the hint box sound alone might drive someone nuts assuming they don't have cl_hudhint_sound set to 0.

john2012
02-04-2012, 18:13
oh sorry, I think you don't understand my request. In fact I want that a hud appear with name, clan tag, health when we target a player like the basic playerid.

TheAvengers2
02-04-2012, 20:52
Ah, I should've took a better look at that image. I see what you want now. it shouldn't be too much work to code it. :P

You wanted it limited to only displaying info of players that are within a distance of 250, right?

try this plugin (requires CS:S clan tags): (http://forums.alliedmods.net/showthread.php?t=149322)

#pragma semicolon 1

#include <cssclantags>

#define TEAM_RED 2
#define TEAM_BLUE 3
#define MAX_HUD_LINES 10
#define MAX_HUD_LEN 127
#define MAX_ENT_DISTANCE 250.0

public Plugin:myinfo =
{
name = "Show team info in hud.",
author = "TheAvengers2",
description = "Shows clan tag, name, health in hud.",
version = "0.0",
url = "sourcemod.com"
};

new vecOrigin;

public OnPluginStart()
{
vecOrigin = FindSendPropOffs("CBaseEntity", "m_vecOrigin");
}

public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
{
switch (GetClientTeam(client))
{
case TEAM_RED:
{
CheckClientTarget(client, TEAM_RED);
}
case TEAM_BLUE:
{
CheckClientTarget(client, TEAM_BLUE);
}
}
}

CheckClientTarget(client, clientTeam)
{
new iClientTarget = GetClientAimTarget(client);
if (iClientTarget > 0 && GetClientTeam(iClientTarget) == clientTeam && GetEntDistance(client, iClientTarget))
{
decl String:targetClanTag[16], String:targetName[32];
if (GetClientName(iClientTarget, targetName, sizeof(targetName)))
{
CS_GetClientClanTag(iClientTarget, targetClanTag, sizeof(targetClanTag));
PrintHintText(client, "%s %s [%i]", targetClanTag, targetName, GetClientHealth(iClientTarget));
}
}
}

bool:GetEntDistance(ent1, ent2)
{
decl Float:orig1[3], Float:orig2[3];

GetEntDataVector(ent1, vecOrigin, orig1);
GetEntDataVector(ent2, vecOrigin, orig2);

return GetVectorDistance(orig1, orig2) <= MAX_ENT_DISTANCE;
}

john2012
02-05-2012, 09:24
Yes it's good thks but we can't see the hud for an enemy. I would like we can see the hud for an enemy please.

TheAvengers2
02-05-2012, 16:52
Yes it's good thks but we can't see the hud for an enemy. I would like we can see the hud for an enemy please.
Ah, sorry about that. I misinterpreted what you wanted and assumed you wanted it that way.

So player can see the name, clan tag and health of all palyers team.I guess it was just a bit ambiguous.


Here, try this:

#pragma semicolon 1

#include <cssclantags>

#define MAX_HUD_LINES 10
#define MAX_HUD_LEN 127
#define MAX_ENT_DISTANCE 250.0

public Plugin:myinfo =
{
name = "Show team info in hud.",
author = "TheAvengers2",
description = "Shows clan tag, name, health in hud.",
version = "0.0",
url = "sourcemod.com"
};

new vecOrigin;

public OnPluginStart()
{
vecOrigin = FindSendPropOffs("CBaseEntity", "m_vecOrigin");
}

public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
{
new iClientTarget = GetClientAimTarget(client);
if (iClientTarget > 0 && GetEntDistance(client, iClientTarget))
{
decl String:targetClanTag[16], String:targetName[32];
if (GetClientName(iClientTarget, targetName, sizeof(targetName)))
{
CS_GetClientClanTag(iClientTarget, targetClanTag, sizeof(targetClanTag));
PrintHintText(client, "%s %s [%i]", targetClanTag, targetName, GetClientHealth(iClientTarget));
}
}
}

bool:GetEntDistance(ent1, ent2)
{
decl Float:orig1[3], Float:orig2[3];

GetEntDataVector(ent1, vecOrigin, orig1);
GetEntDataVector(ent2, vecOrigin, orig2);

return GetVectorDistance(orig1, orig2) <= MAX_ENT_DISTANCE;
}

Dr!fter
02-06-2012, 18:34
Ah, sorry about that. I misinterpreted what you wanted and assumed you wanted it that way.

I guess it was just a bit ambiguous.


Here, try this:

#pragma semicolon 1

#include <cssclantags>

#define MAX_HUD_LINES 10
#define MAX_HUD_LEN 127
#define MAX_ENT_DISTANCE 250.0

public Plugin:myinfo =
{
name = "Show team info in hud.",
author = "TheAvengers2",
description = "Shows clan tag, name, health in hud.",
version = "0.0",
url = "sourcemod.com"
};

new vecOrigin;

public OnPluginStart()
{
vecOrigin = FindSendPropOffs("CBaseEntity", "m_vecOrigin");
}

public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
{
new iClientTarget = GetClientAimTarget(client);
if (iClientTarget > 0 && GetEntDistance(client, iClientTarget))
{
decl String:targetClanTag[16], String:targetName[32];
if (GetClientName(iClientTarget, targetName, sizeof(targetName)))
{
CS_GetClientClanTag(iClientTarget, targetClanTag, sizeof(targetClanTag));
PrintHintText(client, "%s %s [%i]", targetClanTag, targetName, GetClientHealth(iClientTarget));
}
}
}

bool:GetEntDistance(ent1, ent2)
{
decl Float:orig1[3], Float:orig2[3];

GetEntDataVector(ent1, vecOrigin, orig1);
GetEntDataVector(ent2, vecOrigin, orig2);

return GetVectorDistance(orig1, orig2) <= MAX_ENT_DISTANCE;
}

You shouldn't be using CS:S clan tags. It was incorporated into SM 1.4 (The natives are the same) just need to include the cstrike include and remove the cssclantags one.

TheAvengers2
02-06-2012, 22:40
Ah, I wasn't are of that. Thanks! :)

Abb4ertW
02-07-2012, 04:04
You wanted it limited to only displaying info of players that are within a distance of 250, right?http://www.sf700.info/2.jpghttp://www.sf700.info/4.jpghttp://www.sf700.info/3.jpghttp://www.sf700.info/6.jpg