Jump to content

damage bug..


Axel

Recommended Posts

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 by Guest
Link to comment
  
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 by Guest
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...