Jump to content

making the team tactics damage proof


Recommended Posts

Hey can any one tell me how do i make players from team tactics damage proof

I mean the only way to kill them should be when they get shot on right arm

like they cannot be killed with any weapon but if players shoot at thier right arm they lose 50% hp.

Link to comment
  • Moderators

You can try something like this, edit it like you want.

client

local connectionOverFlowLimiter = 0 
  
local validBodyParts = {[5]=true,[6]=true} 
addEventHandler ( "onClientPlayerDamage",localPlayer, 
function (attacker, weapon, bodypart) 
    if attacker and attacker ~= localPlayer then -- optional 
        if not validBodyParts[bodypart] then 
            cancelEvent() 
        else 
            local newHealth = getElementHealth(localPlayer)-50 
            if newHealth > 0 then 
                setElementHealth(localPlayer,newHealth) 
            elseif getTickCount() > connectionOverFlowLimiter then -- recommendation. 
                triggerServerEvent("onCustomPlayerWasted",localPlayer,attacker, weapon, bodypart) 
                connectionOverFlowLimiter = getTickCount()+50-- time now + 50 ms 
                toggleAllControls (false,false,true) 
            end 
        end 
    end 
end) 
  
addEventHandler("onClientPlayerSpawn",localPlayer, 
function () 
    toggleAllControls (true,true,true) 
end) 

server

addEvent("onCustomPlayerWasted",true) 
addEventHandler("onCustomPlayerWasted",root, 
function (attacker,weapon,bodyPart) 
    if client == source and isElement(source) then 
        killPed(source,attacker,weapon,bodyPart) 
    end 
end) 

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