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

HUD doesn't update.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mankled
Senior Member
Join Date: Oct 2019
Old 11-14-2020 , 00:42   HUD doesn't update.
Reply With Quote #1

When someone gets nemesis and left the server, another player will be the nemesis. but the HUD doesn't update with new nemesis info such name and health.
Attached Files
File Type: sma Get Plugin or Get Source (show_health.sma - 122 views - 1.4 KB)
Mankled is offline
AnimalMonster
Senior Member
Join Date: May 2020
Old 11-15-2020 , 07:03   Re: HUD doesn't update.
Reply With Quote #2

Quote:
Originally Posted by Mankled View Post
When someone gets nemesis and left the server, another player will be the nemesis. but the HUD doesn't update with new nemesis info such name and health.
You can try to reset the task and it might work
AnimalMonster is offline
Mankled
Senior Member
Join Date: Oct 2019
Old 11-16-2020 , 23:55   Re: HUD doesn't update.
Reply With Quote #3

Quote:
Originally Posted by AnimalMonster View Post
You can try to reset the task and it might work
how i do it ?
Mankled is offline
Mankled
Senior Member
Join Date: Oct 2019
Old 11-19-2020 , 14:39   Re: HUD doesn't update.
Reply With Quote #4

Can someone help me telling me how to fix it?
Mankled is offline
Abhinash
Senior Member
Join Date: Jan 2015
Location: India,kolkata
Old 11-19-2020 , 17:55   Re: HUD doesn't update.
Reply With Quote #5

Quote:
Originally Posted by Mankled View Post
Can someone help me telling me how to fix it?
Try and tell me the result.

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

#define PLUGIN_NAME "[ZP] Nemesis Health"
#define PLUGIN_VERS "1.2"
#define PLUGIN_AUTH "hi!"

#define TASK_HEALTH 1234554321

new g_iHudSync

public plugin_init() 
{
	register_plugin(PLUGIN_NAME, PLUGIN_VERS, PLUGIN_AUTH)
	
	//
	g_iHudSync = CreateHudSyncObj()
	
	// Fwd's
	RegisterHam(Ham_Spawn, "player", "Fwd_PlayerSpawn_Post", 1)
	RegisterHam(Ham_Killed, "player", "Fwd_PlayerKilled_Pre", 0)
	register_forward(FM_ClientDisconnect, "fw_ClientDisconnect")
}

public Fwd_PlayerSpawn_Post(id)
{
	if (task_exists(id+TASK_HEALTH))
		remove_task(id+TASK_HEALTH)
}

public Fwd_PlayerKilled_Pre(victim, attacker, shouldgib)
{
	if (task_exists(victim+TASK_HEALTH))
		remove_task(victim+TASK_HEALTH)
}

public fw_ClientDisconnect()
{
	if(zp_get_nemesis_round() && zp_get_nemesis_count() == 1)
	{
		set_task(1.0, "Task_ShowHealth", id+TASK_HEALTH, _, _, "b")
	}
}

public zp_round_started(mode, id)
{
	if (mode != MODE_NEMESIS)
		return
		
	if (!zp_get_user_nemesis(id))
		return
		
	set_task(1.0, "Task_ShowHealth", id+TASK_HEALTH, _, _, "b")
}

public Task_ShowHealth(id)
{
	id -= TASK_HEALTH
	
	if (!zp_get_user_nemesis(id))
		remove_task(id+TASK_HEALTH)
		
	new name[32], health
	get_user_name(id, name, charsmax(name))
	health = get_user_health(id)
	
	set_hudmessage(255, 0, 0, 0.57, 0.71, 0, 1.0, 1.0, 0.1, 0.2, -1)
	ShowSyncHudMsg(0, g_iHudSync, "Nemesis is %s^nHealth %d", name, health) 
}
Abhinash is offline
Mankled
Senior Member
Join Date: Oct 2019
Old 11-20-2020 , 00:55   Re: HUD doesn't update.
Reply With Quote #6

Quote:
Originally Posted by Abhinash View Post
Try and tell me the result.

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

#define PLUGIN_NAME "[ZP] Nemesis Health"
#define PLUGIN_VERS "1.2"
#define PLUGIN_AUTH "hi!"

#define TASK_HEALTH 1234554321

new g_iHudSync

public plugin_init() 
{
	register_plugin(PLUGIN_NAME, PLUGIN_VERS, PLUGIN_AUTH)
	
	//
	g_iHudSync = CreateHudSyncObj()
	
	// Fwd's
	RegisterHam(Ham_Spawn, "player", "Fwd_PlayerSpawn_Post", 1)
	RegisterHam(Ham_Killed, "player", "Fwd_PlayerKilled_Pre", 0)
	register_forward(FM_ClientDisconnect, "fw_ClientDisconnect")
}

public Fwd_PlayerSpawn_Post(id)
{
	if (task_exists(id+TASK_HEALTH))
		remove_task(id+TASK_HEALTH)
}

public Fwd_PlayerKilled_Pre(victim, attacker, shouldgib)
{
	if (task_exists(victim+TASK_HEALTH))
		remove_task(victim+TASK_HEALTH)
}

public fw_ClientDisconnect()
{
	if(zp_get_nemesis_round() && zp_get_nemesis_count() == 1)
	{
		set_task(1.0, "Task_ShowHealth", id+TASK_HEALTH, _, _, "b")
	}
}

public zp_round_started(mode, id)
{
	if (mode != MODE_NEMESIS)
		return
		
	if (!zp_get_user_nemesis(id))
		return
		
	set_task(1.0, "Task_ShowHealth", id+TASK_HEALTH, _, _, "b")
}

public Task_ShowHealth(id)
{
	id -= TASK_HEALTH
	
	if (!zp_get_user_nemesis(id))
		remove_task(id+TASK_HEALTH)
		
	new name[32], health
	get_user_name(id, name, charsmax(name))
	health = get_user_health(id)
	
	set_hudmessage(255, 0, 0, 0.57, 0.71, 0, 1.0, 1.0, 0.1, 0.2, -1)
	ShowSyncHudMsg(0, g_iHudSync, "Nemesis is %s^nHealth %d", name, health) 
}
it gave me some errors and I fixed to:
Code:
public fw_ClientDisconnect(id)
{
	if(zp_is_nemesis_round() && zp_get_nemesis_count() == 1)
	{
		set_task(1.0, "Task_ShowHealth", id+TASK_HEALTH, _, _, "b")
	}
}
but it didn't work
Mankled is offline
Abhinash
Senior Member
Join Date: Jan 2015
Location: India,kolkata
Old 11-20-2020 , 07:20   Re: HUD doesn't update.
Reply With Quote #7

Quote:
Originally Posted by Mankled View Post
it gave me some errors and I fixed to:
Code:
public fw_ClientDisconnect(id)
{
	if(zp_is_nemesis_round() && zp_get_nemesis_count() == 1)
	{
		set_task(1.0, "Task_ShowHealth", id+TASK_HEALTH, _, _, "b")
	}
}
but it didn't work
If it didn't work, then give me your main zombie_plague.sma.
I will make inside it
Abhinash is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 11-20-2020 , 08:28   Re: HUD doesn't update.
Reply With Quote #8

attach all the strange includes such as zombie_plague_advance.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Abhinash
Senior Member
Join Date: Jan 2015
Location: India,kolkata
Old 11-20-2020 , 10:35   Re: HUD doesn't update.
Reply With Quote #9

Quote:
Originally Posted by Natsheh View Post
attach all the strange includes such as zombie_plague_advance.
Exactly, because unless we see your natives from your include file if become difficult.
The code which I gave should perfectly work fine, but the exception is only there if your natives differ from those which I used.
Abhinash 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 11:00.


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