Jump to content

damage bug..


Axel

Recommended Posts

Posted (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 by Guest
Posted (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 by Guest

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted (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 by Guest
Posted

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.

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

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...