Jump to content

damage Library .


Kenix

Recommended Posts

the script does not work = (

  
function damageLibrary ( attacker, weapon, bodypart, loss ) 
    if ( weapon == 4 ) then 
        setElementHealth ( source, getElementHealth(source) - 50 ) 
    elseif ( weapon == 6 ) then 
        setElementHealth ( source, getElementHealth(source) - 100 ) 
        end 
    if ( weapon == 9 ) then 
        setElementHealth ( source, getElementHealth(source) - 200 ) 
    elseif ( weapon == 5 ) then 
        setElementHealth ( source, getElementHealth(source) - 100 ) 
        end 
    if ( weapon == 24 ) then 
        setElementHealth ( source, getElementHealth(source) - 200 ) 
    elseif ( weapon == 25 ) then 
        setElementHealth ( source, getElementHealth(source) - 200 ) 
        end 
    if ( weapon == 26 ) then 
        setElementHealth ( source, getElementHealth(source) - 100 ) 
    elseif ( weapon == 27 ) then 
        setElementHealth ( source, getElementHealth(source) - 100 ) 
        end 
    if ( weapon == 28 ) then 
        setElementHealth ( source, getElementHealth(source) - 20 ) 
    elseif ( weapon == 29 ) then 
        setElementHealth ( source, getElementHealth(source) - 25 ) 
        end 
    if ( weapon == 32 ) then 
        setElementHealth ( source, getElementHealth(source) - 20 ) 
    elseif ( weapon == 30 ) then 
        setElementHealth ( source, getElementHealth(source) - 66 ) 
        end 
    if ( weapon == 31 ) then 
        setElementHealth ( source, getElementHealth(source) - 40 )         
    elseif ( weapon == 33 ) then 
        setElementHealth ( source, getElementHealth(source) - 100 ) 
        end 
    if ( weapon == 34 ) then 
        setElementHealth ( source, getElementHealth(source) - 200 ) 
    elseif ( weapon == 0 ) then 
        setElementHealth ( source, getElementHealth(source) - 50 )                   
    end 
end 
  
addEventHandler ( "onPlayerDamage", getRootElement (), damageLibrary  ) 
  

Link to comment

doesnt work at all or doesnt work as intended?

PS: i bet you have to also remove the default player damage by cancelling onClientPlayerDamage event.

PS2:

if then

elseif then

elseif then

elseif then

...

end

but imo better make a damage table like damage[weaponid] = damageamount to avoid these elseif's.

Link to comment

thanks a lot but there is a bug with one weapon and it is not in the script when I shoot from the spaz-12 is a player kick.

[2010-12-26 21:07:05] QUIT: {O.J.}CARTER(RUS) left the game [Quit]

P.S in the log says that it came out but he actually kicked.

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