Show speed/HP hud

Useless Stuffs, Spam ... etc
Post Reply
User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 202
Joined: 2 Years Ago
Has thanked: 14 times
Been thanked: 7 times
Age: 20
Contact:

Show speed/HP hud

#1

Post by sPe3doN » 1 Year 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);
	}
}

[ Post made via Android ]

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1962
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 21
Contact:

#2

Post by Raheem » 1 Year 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
You don't know? Learn and you will know.

User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 202
Joined: 2 Years Ago
Has thanked: 14 times
Been thanked: 7 times
Age: 20
Contact:

#3

Post by sPe3doN » 1 Year Ago

Raheem wrote:
1 Year 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

[ Post made via Android ]

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1962
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 21
Contact:

#4

Post by Raheem » 1 Year Ago

Why should they combined? Can you explain why?

[ Post made via Nexus 7 ]
You don't know? Learn and you will know.

User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 202
Joined: 2 Years Ago
Has thanked: 14 times
Been thanked: 7 times
Age: 20
Contact:

#5

Post by sPe3doN » 1 Year Ago

Raheem wrote:
1 Year 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

[ Post made via Android ]

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests