• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action {help} please help me with adding a time to my lever script!

kaspertje100

Member
Joined
May 8, 2008
Messages
236
Reaction score
7
Hi guys,

I made this script:
Code:
local basin_pos = {x=1167, y=1155, z=7} 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	basin = getTileItemById(basin_pos,2151) ; 
    if basin.uid > 0 then  
    doRemoveItem(basin.uid, 1) 
	doTransformItem(item.uid, 1946)
	doSummonCreature("Bloody Mary", {x = 1168, y = 1156, z = 7})
	doCreateItem(2776, 1, {x = 1168, y = 1158, z = 7})
	doCreateItem(2776, 1, {x = 1169, y = 1158, z = 7})
	doCreateItem(2774, 1, {x = 1170, y = 1158, z = 7})
	doCreateItem(2776, 1, {x = 1171, y = 1157, z = 7})
	doCreateItem(2774, 1, {x = 1171, y = 1154, z = 7})
	doCreateItem(2776, 1, {x = 1165, y = 1153, z = 7})
	doCreateItem(2774, 1, {x = 1169, y = 1152, z = 7})
	doCreateItem(2776, 1, {x = 1165, y = 1157, z = 7})	
	doSendMagicEffect({x = 1168, y = 1156, z = 7}, CONST_ME_TELEPORT)
	doCreatureSay(cid, "Hahaha, now you are trapped!", TALKTYPE_ORANGE_1)
	return TRUE
end
end

That scripts works fine. But i wanted to add a timer to it so a player can only use it once in 3 hours but I failed on that. So could someone make a timer to this script?

Thanks in advance!
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		local s = getStorage(1)
		if os.time() < s then
			return doPlayerSendCancel(cid, 'You must wait ' .. s - os.time() .. ' more seconds.')
		end
		local k = getTileItemById({x=1167, y=1155, z=7}, 2151).uid
		if k ~= 0 then
			doRemoveItem(k)
			doCreateMonster('Bloody Mary', {x=1168, y=1156, z=7})
			doCreateItem(2776, 1, {x=1168, y=1158, z=7})
			doCreateItem(2776, 1, {x=1169, y=1158, z=7})
			doCreateItem(2774, 1, {x=1170, y=1158, z=7})
			doCreateItem(2776, 1, {x=1171, y=1157, z=7})
			doCreateItem(2774, 1, {x=1171, y=1154, z=7})
			doCreateItem(2776, 1, {x=1165, y=1153, z=7})
			doCreateItem(2774, 1, {x=1169, y=1152, z=7})
			doCreateItem(2776, 1, {x=1165, y=1157, z=7})
			doSendMagicEffect({x=1168, y=1156, z=7}, CONST_ME_TELEPORT)
			doCreatureSay(cid, 'Hahaha, now you are trapped!', TALKTYPE_ORANGE_1)
			doSetStorage(1, os.time() + 3 * 3600)
		else
			return doPlayerSendCancel(cid, 'Sorry, not possible.')
		end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
Back
Top