Show speed/HP hud

Useless Stuffs, Spam ... etc
Post Reply
User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 258
Joined: 7 years ago
Contact:

Show speed/HP hud

#1

Post by sPe3doN » 5 years ago

This plugin show your HP can some one add for it show your speed to ?!
PS: i know there is plugin show speed but i want speed in this plugin :)

Code: Select all

#include <amxmodx>
#include <amxmisc>


#define PLUGIN_NAME	"Health Display"
#define PLUGIN_VERSION	"11.1"
#define PLUGIN_AUTHOR	"Exolent"


#pragma semicolon 1


new bool:g_player_didnt_spawn[33];

new health_on;
new health_time;
new health_color;
new health_custom;
new health_effects;
new health_always;

public plugin_init()
{
	register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
	register_cvar("health_display", PLUGIN_VERSION, FCVAR_SPONLY);
	
	register_clcmd("say /health", "CmdHealth");
	register_clcmd("say_team /health", "CmdHealth");
	register_clcmd("fullupdate", "CmdFullupdate");
	
	register_event("Health", "EventHealth", "be", "1>0");
	register_event("ResetHUD", "EventResetHud", "be");
	register_event("TextMsg", "EventRestartAttempt", "a", "2&#Game_w");
	register_event("DeathMsg", "EventDeathMsg", "a");
	
	health_on = register_cvar("health_on", "1");
	health_time = register_cvar("health_time", "12");
	health_color = register_cvar("health_color", "1");
	health_custom = register_cvar("health_custom", "255 255 0");
	health_effects = register_cvar("health_effects", "1");
	health_always = register_cvar("health_always", "0");
}

public client_disconnect(client)
{
	remove_task(client);
}

public CmdHealth(client)
{
	if( !get_pcvar_num(health_on) )
	{
		client_print(client, print_chat, "Health Display is currently off.");
	}
	else if( is_user_alive(client) )
	{
		ShowHealth(client);
	}
	
	return PLUGIN_HANDLED;
}

public CmdFullupdate(client)
{
	return PLUGIN_HANDLED_MAIN;
}

public EventHealth(client)
{
	if( get_pcvar_num(health_on) )
	{
		ShowHealth(client);
	}
}

public EventResetHud(client)
{
	if( g_player_didnt_spawn[client] )
	{
		g_player_didnt_spawn[client] = false;
	}
	else if( is_user_alive(client) && get_pcvar_num(health_always) )
	{
		set_task(0.1, "ShowHealth", client);
	}
}

public EventRestartAttempt()
{
	new players[32], pnum;
	get_players(players, pnum, "a");
	
	for( new i = 0; i < pnum; i++ )
	{
		g_player_didnt_spawn[players[i]] = true;
	}
}

public EventDeathMsg()
{
	new client = read_data(2);
	
	remove_task(client);
	
	set_hudmessage(_, _, _, _, _, _, _, _, _, _, 3);
	show_hudmessage(client, "");
}

public ShowHealth(client)
{
	remove_task(client);
	
	new hud_red, hud_green, hud_blue;
	switch( get_pcvar_num(health_color) )
	{
		case 0:
		{
			hud_red = 255;
			hud_green = 255;
			hud_blue = 255;
		}
		case 1:
		{
			new color[16], red[4], green[4], blue[4];
			get_pcvar_string(health_custom, color, 15);
			parse(color, red, 3, green, 3, blue, 3);
			
			hud_red = str_to_num(red);
			hud_green = str_to_num(green);
			hud_blue = str_to_num(blue);
		}
		case 2:
		{
			hud_red = random(256);
			hud_green = random(256);
			hud_blue = random(256);
		}
	}
	
	new Float:hud_time = get_pcvar_float(health_time);
	
	set_hudmessage(hud_red, hud_green, hud_blue, -1.0, 0.9, get_pcvar_num(health_effects), hud_time, hud_time, 0.1, 0.2, 3);
	show_hudmessage(client, "Health: %i", get_user_health(client));
	
	if( get_pcvar_num(health_always) )
	{
		set_task(hud_time - 0.1, "ShowHealth", client);
	}
}
Image

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#2

Post by Raheem » 5 years ago

Health display already in our Mod, so why you are using this?

Also for speed, you can use: https://forums.alliedmods.net/showthread.php?t=167625
For velocity and speed: https://forums.alliedmods.net/showthread.php?p=702520
He who fails to plan is planning to fail

User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 258
Joined: 7 years ago
Contact:

#3

Post by sPe3doN » 5 years ago

Raheem wrote: 5 years ago Health display already in our Mod, so why you are using this?

Also for speed, you can use: https://forums.alliedmods.net/showthread.php?t=167625
For velocity and speed: https://forums.alliedmods.net/showthread.php?p=702520
Nah i remove your mod health and coins HUD thats why i use that plugin and raheem please if you can add to that plugin show speed
Image

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#4

Post by Raheem » 5 years ago

Why should they combined? Can you explain why?
He who fails to plan is planning to fail

User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 258
Joined: 7 years ago
Contact:

#5

Post by sPe3doN » 5 years ago

Raheem wrote: 5 years ago Why should they combined? Can you explain why?
When i have time i will record video to understand the problem when i use health display and show speed plugins
Image

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 2 guests