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

can you read player hp from his HUD?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 05-28-2014 , 10:23   can you read player hp from his HUD?
Reply With Quote #1

so here's the deal
there's this really annoying and weird bug where for example if a player has more than 255hp, let's give an example of 500, if his hp keeps dropping and reaches 0 on his screen(not real value of hp, just on his screen) he can't move his mouse and move buttons are inversed
I've searched and couldn't find anything related to this, what I'd like to do is check player's screen and remove 1hp if he's bugged

register_event("Health", "EventHealth", "be", "1>0");
this event is called when the user hp changes in the hud, can I retrieve info from it?
aron9forever is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 05-28-2014 , 10:26   Re: can you read player hp from his HUD?
Reply With Quote #2

if (!(get_user_health(id) % 256))
// HUD is displaying 0
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 05-28-2014 , 10:32   Re: can you read player hp from his HUD?
Reply With Quote #3

Quote:
Originally Posted by YamiKaitou View Post
if (!(get_user_health(id) % 256))
// HUD is displaying 0
does this mean that if the hp amount is divisible by 256 then it's gonna show as 0?
it's the same thing as if((get_user_health(id) % 256) == 0) right? easier to read for me


thanks for the reply

edit::

will this fix my problem?

Code:
RegisterHam(Ham_TakeDamage, "player", "player_damage") public player_damage(victim, ent, attacker, Float:damage, bits) {     if(!is_user_connected(victim))         return HAM_IGNORED     if(!is_user_connected(attacker))         return HAM_IGNORED     if(victim == attacker)         return HAM_IGNORED     static hashpe     hashpe=get_user_health(victim)     if( ( (hashpe % 256) == 0) )     {         set_user_health(victim, hashpe - 1)     } }

Last edited by aron9forever; 05-28-2014 at 10:37.
aron9forever is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 05-28-2014 , 10:38   Re: can you read player hp from his HUD?
Reply With Quote #4

Try it and see
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 05-28-2014 , 11:16   Re: can you read player hp from his HUD?
Reply With Quote #5

Quote:
Originally Posted by YamiKaitou View Post
Try it and see
it is not working
please tell me how I can refresh an user's HUD if using this forward
register_event("Health", "EventHealth", "be", "1>0"); which is called when user hp changes on screen

but even after I set_user_health to value-1 it still won't refresh the info from the hud until he takes damage so it's useless
aron9forever is offline
swapped
BANNED
Join Date: Mar 2014
Location: OrpheuRegisterHook
Old 05-29-2014 , 02:53   Re: can you read player hp from his HUD?
Reply With Quote #6

Quote:
Originally Posted by aron9forever View Post
it is not working
please tell me how I can refresh an user's HUD if using this forward
register_event("Health", "EventHealth", "be", "1>0"); which is called when user hp changes on screen

but even after I set_user_health to value-1 it still won't refresh the info from the hud until he takes damage so it's useless

why you cant talk normaly ?


He mean the HP SPRITE is bugged when you have more than 255 hp.

Why you dont create an HUD for showing the player hp?
swapped is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 05-29-2014 , 08:43   Re: can you read player hp from his HUD?
Reply With Quote #7

Check this: https://forums.alliedmods.net/showthread.php?p=594746
OvidiuS is offline
Send a message via Skype™ to OvidiuS
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 05-29-2014 , 10:20   Re: can you read player hp from his HUD?
Reply With Quote #8

Quote:
Originally Posted by OvidiuS View Post
thanks a lot
aron9forever 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 06:59.


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