Jump to content

ped health


-stolka-

Recommended Posts

Posted
addEvent( "onZombieSpawn", true ) 
function RanSpawn_Z ( gx, gy, gz, rot) 
    local safezone = 0 
    local allradars = getElementsByType("radararea") 
    for theKey,theradar in ipairs(allradars) do 
        if getElementData(theradar, "zombieProof") == true then 
            if isInsideRadarArea ( theradar, gx, gy ) then 
                safezone = 1 
            end 
        end 
    end 
    if safezone == 0 then 
        if table.getn ( everyZombie ) < newZombieLimit then 
            if not rot then 
                rot = math.random (1,359) 
            end 
            randomZskin = math.random ( 1, table.getn ( ZombiePedSkins ) )           
            local zomb = createPed( tonumber( ZombiePedSkins[randomZskin] ), gx, gy, gz ) 
            if zomb ~= false then 
                setElementData ( zomb, "zombie", true  ) 
        setElementHealth(zomb, 200) 
                table.insert( everyZombie, zomb )    
                setTimer ( function (zomb, rot) if ( isElement ( zomb ) ) then setPedRotation ( zomb, rot ) end end, 500, 1, zomb, rot ) 
                setTimer ( function (zomb) if ( isElement ( zomb ) ) then setPedAnimation ( zomb, "ped", chaseanim, -1, true, true, true ) end end, 1000, 1, zomb ) 
                setTimer ( function (zomb) if ( isElement ( zomb ) ) then setElementData ( zomb, "status", "idle" ) end end, 2000, 1, zomb ) 
                triggerClientEvent ( "Zomb_STFU", getRootElement(), zomb ) 
            end 
        end 
    end 
end 
addEventHandler( "onZombieSpawn", getRootElement(), RanSpawn_Z ) 
  

  • Moderators
Posted

You don't need to show your code for that, the answer is yes.

You can use it on all elements that can have health. (ped's, players and vehicles)

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