AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   can you read player hp from his HUD? (https://forums.alliedmods.net/showthread.php?t=241124)

aron9forever 05-28-2014 10:23

can you read player hp from his HUD?
 
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?

YamiKaitou 05-28-2014 10:26

Re: can you read player hp from his HUD?
 
if (!(get_user_health(id) % 256))
// HUD is displaying 0

aron9forever 05-28-2014 10:32

Re: can you read player hp from his HUD?
 
Quote:

Originally Posted by YamiKaitou (Post 2143536)
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)     } }

YamiKaitou 05-28-2014 10:38

Re: can you read player hp from his HUD?
 
Try it and see

aron9forever 05-28-2014 11:16

Re: can you read player hp from his HUD?
 
Quote:

Originally Posted by YamiKaitou (Post 2143540)
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

swapped 05-29-2014 02:53

Re: can you read player hp from his HUD?
 
Quote:

Originally Posted by aron9forever (Post 2143552)
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?

OvidiuS 05-29-2014 08:43

Re: can you read player hp from his HUD?
 
Check this: https://forums.alliedmods.net/showthread.php?p=594746

aron9forever 05-29-2014 10:20

Re: can you read player hp from his HUD?
 
Quote:

Originally Posted by OvidiuS (Post 2143948)

thanks a lot


All times are GMT -4. The time now is 18:07.

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