Jump to content

Zombie Dim


^iiEcoo'x_)

Recommended Posts

There is RanSpawn_Z function (starting on line 385 in zombie_server.lua), you have to use setElementDimension after ped is created.

Also if you're using stream method to constantly spawn zombies near players, don't forget to add statement, which will check if player is in that dimension (SpawnZombie function).

Link to comment
11 minutes ago, Rataj said:

There is RanSpawn_Z function (starting on line 385 in zombie_server.lua), you have to use setElementDimension after ped is created.

Also if you're using stream method to constantly spawn zombies near players, don't forget to add statement, which will check if player is in that dimension (SpawnZombie function).

Can you do for me? Please

Link to comment

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)

 

  • Like 1
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...