Wird denke ich nur am Ped-Creation liegen, hier der zensierte Teil:
addEventHandler("onColShapeHit", getRootElement(),
function(hElement)
if(isElement(hElement) and getElementType(hElement) == "player") then
local tc = ZED_GLOBAL_MAX + (ZED_GLOBAL_OFFSET * (pCount - 1))
tc = tc - zCountArea
for i = 1, tc, 1 do
if(zed_count > ZED_MAX) then break end
local rnd = math.random()
if(rnd < zSpawnChance) then
local zed = spawnZombie(source, hElement, zMinRoaming, zMaxRoaming)
zed_count = zed_count + 1
end
end
end
end
)
Alles anzeigen
Und die passende spawnZombie-Function:
function spawnZombie(col, player, minRoaming, maxRoaming)
local pX, pY, pZ = getElementPosition(player)
local cX, cY, cZ = getElementPosition(col)
local rX, rY
while true do
rX = math.random(minRoaming, maxRoaming)
rY = math.random(minRoaming, maxRoaming)
rX = math.random(cX - rX, cX + rX)
rY = math.random(cY - rY, cY + rY)
if(table.getn(players) == 0) then break end
end
local zed = createPed(13, rX, rY, cZ, true)
local x, y, z = getElementPosition(zed)
local zCol = createColTube(x, y, z, 2, 1337)
attachElements(zCol, zed)
setElementSyncer(zed, player)
setTimer(zCheckDespawn, 1000, 1, zed)
outputDebugString("ZOMBIE SPAWNED!")
return zed
end
Alles anzeigen