-Spawn NPC Zombie every X second.
-In random area like rp_amstria in C4 server : Zombie Spawn Randomly but always in the beach
Sorry im bad English.
Scripts
Spawn NPC like in rp_amstria C4 server
Spawn NPC like in rp_amstria C4 server
X = 5	-- spawn NPC every 5 seconds. Change it if necessary
spawns={
	{{1,5},{5,10}},	-- Example spawn location, not on pixels but on tiles, separated by comma. {{Start_X,Start_Y},{End_X},{End_Y}},
}
function doSpawnNPC()
	local num,x,y
	num=math.random(1,#spawns)
	x=math.random(spawns[num][1][1],spawns[num][2][1])
	y=math.random(spawns[num][1][2],spawns[num][2][2])
	parse("spawnnpc 1 "..x.." "..y)
end
timer(X*1000,"doSpawnNPC","",-1)
-Abandoned Account-: Nerver telltable = {
	time = 10000;
	pos = { 2; {10, 20}; {20, 30}; };
}
timer(table.time, [[doSpawnNPC]])
function doSpawnNPC()
	local random, rotation = math.random(1, table.pos[1]), math.random(1, 360)
	local x, y = table.pos[2][random], table.pos[3][random]
	parse([[spawnnpc 1 ]]..x..[[ ]]..y..[[ ]]..rotation)
end
MikuAuahDark . Tested again wand work !function doSpawnNPC()
	local num,x,y=0,0,0
	while tile(x,y,"frame")~=6 do	-- I hope that coordinates 0|0 on map is NOT sand tile
		num=math.random(1,#spawns)
		x=math.random(spawns[num][1][1],spawns[num][2][1])
		y=math.random(spawns[num][1][2],spawns[num][2][2])
	end
	parse("spawnnpc 1 "..x.." "..y)
end
Sand tile frame is 6(CS2D can't know if tile with frame 6 is sand)
There many sand tile(tile frame 6) at theretable = {
time = 10000;
pos = { {10, 20}; {20, 30}; };
}
timer(table.time, [[doSpawnNPC]])
function doSpawnNPC()
	 local x, y, rotation = math.random(table.pos[1][1], table.pos[1][2]), math.random(table.pos[2][1], table.pos[2][2]), math.random(1, 360)
	 if tile(x, y, [[frame]]) == 6 then parse([[spawnnpc 1 ]]..x..[[ ]]..y..[[ ]]..rotation) end
end
Dousea code . It just spawn 1 zombie at start...
sheeL: Lol what is your code?
-DIE Wolf-: Im using this function too, spawning zombie in an area but random x|y.function SpawnZombie()
local x=math.random(0,40)
local y=math.random(59,99)
local rot=math.random(0,360)
if tile(x,y,"walkable")==true then
parse("spawnnpc "..(1).." "..x.." "..y.." "..rot)
else
SpawnZombie()
end
end
MikuAuahDark's code are more simple (and have more darkness) than my messed up code. table = {
	time = 10000;
	pos = { {10, 20}; {20, 30}; };
}
function spawnTimer()
	timer(table.time, [[spawnNPC]])
end
spawnTimer()
function spawnNPC()
	local x, y, rotation = math.random(table.pos[1][1], table.pos[1][2]), math.random(table.pos[2][1], table.pos[2][2]), math.random(0, 360)
	if tile(x, y, [[frame]]) == 6 then parse([[spawnnpc 1 ]]..x..[[ ]]..y..[[ ]]..rotation) end
	spawnTimer()
end
Dousea . It work ! Thank you so much