Axel Posted March 19, 2012 Share Posted March 19, 2012 (edited) I made a simple script that shows the health and armour hud when a player is damaged.. the only problem is that after the player gets damaged and the hud dissapears the health gets 100.. function healthdamage ( attacker, weapon, bodypart) showPlayerHudComponent ( "health", true ) showPlayerHudComponent ( "armour", true ) function health() showPlayerHudComponent ( "health", false ) showPlayerHudComponent ( "armour", false ) end setTimer ( health, 5000, 1 ) end addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), healthdamage ) Edited March 19, 2012 by Guest Link to comment
Kenix Posted March 19, 2012 Share Posted March 19, 2012 (edited) local uTimer function fDamage ( ) showPlayerHudComponent ( "health", true ) showPlayerHudComponent ( "armour", true ) if isTimer( uTimer ) then killTimer( uTimer ) end uTimer = setTimer( function( ) showPlayerHudComponent ( "health", false ) showPlayerHudComponent ( "armour", false ) end, 5000, 1 ) end addEventHandler ( "onClientPlayerDamage", localPlayer, fDamage ) I think you mean it ^^ So onPlayerDamage is server side event and you use showPlayerHudComponent with client side arguments. Edited March 19, 2012 by Guest Link to comment
Axel Posted March 19, 2012 Author Share Posted March 19, 2012 (edited) Copied the bugged one, fixed the first post Well it didn't work.. it appears only when u set your health.. not when u lose it Edited March 19, 2012 by Guest Link to comment
Kenix Posted March 19, 2012 Share Posted March 19, 2012 Copy again. Well it didn't work.. it appears only when u set your health.. not when u lose it I did think you need it Anyway you yourself can change arguments in function showPlayerHudComponent. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now