• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Add time to new monster to spawn

tompan

Member
Joined
Dec 13, 2008
Messages
646
Reaction score
24
Location
Sweden
can some one add a timer so after X second there will spawn 3 new demons at the existing pos?

PHP:
-- UniqueIDs used:
--
-- 5024 = The switch.
-- 5025 = sca chest.
-- 5026 = thuder chest.
-- 5027 = sov chest.
-- 5028 = sbs chest.
--
 
function onUse(cid, item, frompos, item2, topos)
	if item.uid == 5024 then
		if item.itemid == 1945 then
 
			player1pos = {x=1154, y=1582, z=7, stackpos=253}
			player1 = getThingfromPos(player1pos)
 
			player2pos = {x=1154, y=1581, z=7, stackpos=253}
			player2 = getThingfromPos(player2pos)
 
			player3pos = {x=1154, y=1580, z=7, stackpos=253}
			player3 = getThingfromPos(player3pos)
 
			player4pos = {x=1154, y=1579, z=7, stackpos=253}
			player4 = getThingfromPos(player4pos)
 
 
			if player1.itemid > 0 and player2.itemid > 0 and player3.itemid > 0 and player4.itemid > 0 then
 
				player1level = getPlayerLevel(player1.uid)
				player2level = getPlayerLevel(player2.uid)
				player3level = getPlayerLevel(player3.uid)
				player4level = getPlayerLevel(player4.uid)
 
				questlevel = 1
 
				if player1level >= questlevel and player2level >= questlevel and player3level >= questlevel and player4level >= questlevel then
 
					queststatus1 = getPlayerStorageValue(player1.uid,5024)
					queststatus2 = getPlayerStorageValue(player2.uid,5024)
					queststatus3 = getPlayerStorageValue(player3.uid,5024)
					queststatus4 = getPlayerStorageValue(player4.uid,5024)
 
					if queststatus1 == -1 and queststatus2 == -1 and queststatus3 == -1 and queststatus4 == -1 then
 
						wall1pos = {x=1155, y=1582, z=8}
						demon2pos = {x=1152, y=1584, z=8}
						demon3pos = {x=1152, y=1580, z=8}
						demon4pos = {x=1149, y=1582, z=8}

 
						doSummonCreature("Brick Wall", wall1pos)
						doSummonCreature("Demon", demon2pos)
						doSummonCreature("Demon", demon3pos)
						doSummonCreature("Demon", demon4pos)
 
						nplayer1pos = {x=1154, y=1582, z=8}
						nplayer2pos = {x=1153, y=1582, z=8}
						nplayer3pos = {x=1152, y=1582, z=8}
						nplayer4pos = {x=1151, y=1582, z=8}
 
						doSendMagicEffect(player1pos,2)
						doSendMagicEffect(player2pos,2)
						doSendMagicEffect(player3pos,2)
						doSendMagicEffect(player4pos,2)
 
						doTeleportThing(player1.uid,nplayer1pos)
						doTeleportThing(player2.uid,nplayer2pos)
						doTeleportThing(player3.uid,nplayer3pos)
						doTeleportThing(player4.uid,nplayer4pos)
 
						doSendMagicEffect(nplayer1pos,10)
						doSendMagicEffect(nplayer2pos,10)
						doSendMagicEffect(nplayer3pos,10)
						doSendMagicEffect(nplayer4pos,10)
						doTransformItem(item.uid,item.itemid+1)
 						doSendAnimatedText(wall1pos,("You got 60 seconds until new monsters spawn! Kill the wall fast!"), TEXTCOLOR_RED)

					else
						doPlayerSendCancel(cid,"Sorry, not possible.")
					end
				else
					doPlayerSendCancel(cid,"Sorry. not possible.")
				end
			else
				doPlayerSendCancel(cid,"Sorry, not possible.")
			end
		elseif item.itemid == 1946 then
			if getPlayerAccess(cid) == 3 then
				doTransformItem(item.uid,item.itemid-1)
			else
				doPlayerSendCancel(cid,"Sorry, someone have already done this quest today.")
			end
		end
	elseif item.uid == 5025 then
 
		queststatus = getPlayerStorageValue(cid,5024)
 
		if queststatus == -1 then
			doPlayerSendTextMessage(cid,22,"You have found a stonecutter axe.")
			doPlayerAddItem(cid,2431,1)
			setPlayerStorageValue(cid,5024,1)
		else
			doPlayerSendTextMessage(cid,22,"It is empty.")
		end
	elseif item.uid == 5026 then
 
		queststatus = getPlayerStorageValue(cid,5024)
 
		if queststatus == -1 then
			doPlayerSendTextMessage(cid,22,"You have found a thunder hammer.")
			doPlayerAddItem(cid,2421,1)
			setPlayerStorageValue(cid,5024,1)
		else
			doPlayerSendTextMessage(cid,22,"It is empty.")
		end
	elseif item.uid == 5027 then
 
		queststatus = getPlayerStorageValue(cid,5024)
 
		if queststatus == -1 then
			doPlayerSendTextMessage(cid,22,"You have found a magic sword.")
			doPlayerAddItem(cid,2400,1)
			setPlayerStorageValue(cid,5024,1)
		else
			doPlayerSendTextMessage(cid,22,"It is empty.")
		end
	elseif item.uid == 5028 then
 
		queststatus = getPlayerStorageValue(cid,5024)
 
		if queststatus == -1 then
			doPlayerSendTextMessage(cid,22,"You have found a pair of soft boots.")
			doPlayerAddItem(cid,2640,1)
			setPlayerStorageValue(cid,5024,1)
		else
			doPlayerSendTextMessage(cid,22,"It is empty.")
		end
	end
	return 1
end
 
Back
Top