Jump to content

Ayuda respawn de zombies


Plate

Recommended Posts

El tema con este scirpt es que un suponer hay 10 zombies en 1 spot mato a 1 y respawnean 10

    function Zomb_respawn (ped) 
        if isElement(ped) then 
            if (getElementData (ped, "zombie") == true) then 
                for theKey,thePed in ipairs(zombiesInSpot) do 
                    if ped == thePed then 
                        table.remove( zombiesInSpot, theKey ) 
                        break 
                    end 
                end 
                local zombieSkin = getElementModel(ped) 
                local zombieLevel = getElementData(ped,"level") 
                local maxHP = getElementData(ped,"maxhealth") 
                local zombieSpot = getElementData(ped,"zombieSpot") 
                local spotRadius = getElementData(zombieSpot,"radius") 
                local sortZombies = spotRadius/1.2 
                local sx,sy,sz = getElementPosition(zombieSpot) 
                local zom = createZombie (sx+math.random(-sortZombies,sortZombies),sy+math.random(-sortZombies,sortZombies),sz+1.5,math.random(1,360),zombieSkin,0,0,zombieLevel,maxHP) 
                table.insert(zombiesInSpot,zom) 
                setElementData(zom,"zombieSpot",zombieSpot) 
            end 
        end 
    end 
      
    function respawnZombieWhenDead(dataName) 
        if getElementType ( source ) == "ped" and dataName == "status" then 
            if (getElementData (source, "zombie") == true) then 
                if (getElementData ( source, "status" ) ==  "dead" ) then 
                    setTimer ( Zomb_respawn, 9000, 1, source) 
                end 
            end 
        end 
    end 
    addEventHandler ( "onElementDataChange", getRootElement(),respawnZombieWhenDead ) 

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...