Here...
-- SERVER
addEvent( "onZombieSpawn", true )
function RanSpawn_Z ( gx, gy, gz, rot, zDimension)
local safezone = 0
local allradars = getElementsByType("radararea")
for i = 1, #allradars do
local theradar = allradars[ i ]
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
setElementDimension( zomb, zDimension or 0 )
setElementData ( zomb, "zombie", true )
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 )
-- CLIENT
addEvent( "Spawn_Placement", true )
function Spawn_Place(xcoord, ycoord)
local x,y,z = getElementPosition( getLocalPlayer() )
local playerDimension = getElementDimension( localPlayer )
local posx = x+xcoord
local posy = y+ycoord
local gz = getGroundPosition ( posx, posy, z+500 )
triggerServerEvent ("onZombieSpawn", getLocalPlayer(), posx, posy, gz+1, playerDimension )
end
addEventHandler("Spawn_Placement", getRootElement(), Spawn_Place)