Jump to content

I need Help about Damage


Hero192

Recommended Posts

Hey guys again, I want when a Law Team shoot with silenced gun or hit with nightstick the wanted players "Do not take their HPs" and Also the LAW team do not get Stars when they shoot wanted players

I tried by doing this code but i fails, Can anyone correct me please?

local law = {["Police"]=true, ["SWAT"]=true} 
function arrestPlayer (attacker, weapon, bodypart) 
if (attacker and getElementType(attacker) == "player" and attacker ~= source) and (weapon == 23 or weapon == 3) then   
if (getPlayerTeam(attacker) and law [getTeamName(getPlayerTeam(attacker))]) and getPlayerWantedLevel(source) > 0 then 
cancelEvent() 
setPedAnimation(source, "CRACK", "crckdeth2", 4000, false, true, false) 
end 
end 
end 
addEventHandler("onPlayerDamage", root, arrestPlayer) 

But It won't make the animation for the hitted wanted player, THANKS ALOT !

Link to comment

And how to make the police team when shoots with silenced or nightstick wont become wanted

ALSO , I tried that I don't know if I am wrong or right

local law = {["Police"]=true, ["SWAT"]=true} 
addEventHandler("onClientPlayerDamage", localPlayer, 
function (attacker, weapon) 
    local wanted = getPlayerWantedLevel() 
    if attacker and getElementType(attacker) == "player" and weapon == 23 or weapon == 3 and wanted > 0 then 
        local team = getPlayerTeam(attacker) 
        if getPlayerTeam(attacker) and law [getTeamName(getPlayerTeam(attacker))]) then  
            cancelEvent() 
        end 
    end 
end) 

Link to comment
  • Moderators

RED or GREEN

if attacker and getElementType(attacker) == "player" and weapon == 23 or weapon == 3 and wanted > 0 then

How to solve: (weapon == 23 or weapon == 3)

if attacker and getElementType(attacker) == "player" and (weapon == 23 or weapon == 3) and wanted > 0 then 

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