Jump to content

help zombie


golanu21

Recommended Posts

if exp system uses element data you can use it like that

  
addEventHandler ( "onClientElementDataChange", getRootElement(), 
function ( dataName ) 
    if getElementType ( source ) == "player" and dataName == "exp" then 
        if getElementData(source, "exp") == 3 then 
            outputChatBox ("Data is 3") 
        elseif getElementData(source, "exp") == 5 then 
            outputChatBox ("Data is 5") 
        end 
    end 
end 
)  

Link to comment
function deanimated( ammo, attacker, weapon, bodypart ) 
    if (attacker) then 
        if (getElementType ( attacker ) == "player") and (getElementType ( source ) == "ped") then 
            if (getElementData (source, "zombie") == true) then 
                local oldZcount = getElementData ( attacker, "Zombie kills" ) 
                if oldZcount ~= false then 
                    setElementData ( attacker, "Zombie kills", oldZcount+1  ) 
                    triggerEvent ( "onZombieWasted", source, attacker, weapon, bodypart ) 
                else 
                    setElementData ( attacker, "Zombie kills", 1  ) 
                    triggerEvent ( "onZombieWasted", source, attacker, weapon, bodypart )                
                end 
            end 
        end 
    end 
end 
addEventHandler("onPedWasted", resourceRoot, deanimated) 

this function ?

Link to comment
addEvent ( "onZombieWasted", true ) 
addEventHandler ( "onZombieWasted", root, 
    function ( killer ) 
        local kills = getElementData ( killer, "Zombie kills" ) 
        if ( kills == 3 ) then 
            outputChatBox ( "You've killed 3 zombies!", killer ) 
        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...