Jump to content

Adding 2 More allowed teams issue


ramzi

Recommended Posts

Hi guys,i've over here my Headshot script which works only with team"Admins",the problem is that i tried to add 2 more teams using "and" but i failed :? ,Plz help me out!here is the script:

  
addEvent "onPlayerHeadshot" 
addEventHandler("onPlayerDamage", getRootElement(), 
    function (attacker, weapon, bodypart, loss) 
    if getElementType ( attacker ) == "player" then 
        if bodypart == 9 and weapon == 34 then 
            local HSteam = getPlayerTeam(attacker) 
            if HSteam and getTeamName(HSteam)=="Admins" then       
                local result = triggerEvent("onPlayerHeadshot",source, attacker, weapon, loss) 
                if result == true then                      
                  killPed(source, attacker, weapon, bodypart) 
                  setPedHeadless( source, true )                
                  addEventHandler("onPlayerSpawn", root, function () setPedHeadless( source, false) end ) 
                end               
            end         
        end                                     
    end 
    end  
) 
    function BackUp( source )   
    if getElementType ( source ) == "player" then 
        setPedHeadless ( source, false ) 
    end 
end 
  

Link to comment

BE CAREFUL!

if Condition1 AND Condition2 then

body

The body will be executed ONLY IF Condition1 is TRUE AND Condition2 is TRUE

if Condition1 or Condition2 then

body

The body will be executed ONLY IF Condition1 is TRUE or Condition2 is TRUE

example:if HSteam and (getTeamName(HSteam)=="Admins" OR getTeamName(HSteam)=="Moderators") then ...

the example should work

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