-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.
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)
table = { 	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
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
table = { 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
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
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