Sign in to follow this  
Reinhard

restricting an eventhandler to a team?

Recommended Posts

i tried some ways but failed.

how to restrict this event handler to a certain team i don't want anyone who can use it so i guess that the "root" is causing it. i tried to change it but failed, and tried to use return end but failed. any help?

i want only "Civillian" team can trigger this event.

addEventHandler("onPlayerDamage",root, 
function(attacker, weapon) 
     if weapon == 6 then  
         setElementHealth(source, getElementHealth(source) - 50 )
     end 
end)

 

Edited by Reinhard

Share this post


Link to post
addEventHandler("onPlayerDamage",root, 
function(attacker, weapon) 
    if getTeamName(getPlayerTeam(attacker)) ~= 'Civillian' then return end
     if weapon == 6 then  
         setElementHealth(source, getElementHealth(source) - 50 )
     end 
end)

 

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.