• 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!

Use item 1x

alissonfgp

LUA, C, C++, C#
Joined
Jul 13, 2011
Messages
111
Reaction score
29
Location
Brazil
I need a script type,
if the player uses an item on another item, then it will be able to use again after 2 minutes.
if possible...
 
You can use exhaustion.check/set/get for this.
Lua:
local config = {
	exhausttime = 120, -- time in seconds
	exhauststorage = 2309
}

function onUse(cid, item, fromPosition, itemEx, toPosition)

	if exhaustion.check(cid, config.exhauststorage) then
		local time = exhaustion.get(cid, config.exhauststorage)
		local minutes, seconds = math.floor ((time - ((math.floor (time / 3600)) * 3600))/ 60), time - ((math.floor (time/60)) * 60)
		if time >= 120 then
			text = ""..minutes.." minutes and "..seconds.." seconds"
		elseif time >= 60 then
			text = ""..minutes.." minute and "..seconds.." seconds"
		else
			text = ""..seconds.." seconds"
		end
		doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) 
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You need to wait "..text.." before you can use this again.")
		return true
	end
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Here you can add what the rest of the script should do.")
	exhaustion.set(cid, config.exhauststorage, config.exhausttime)
	return true
end
 
insert??
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 15389 and itemEx.itemid == 14772 then
		if getPlayerStorageValue(cid, 77878) >= 0 and getPlayerStorageValue(cid, 77878) < 8 then
			setPlayerStorageValue(cid, 77878, getPlayerStorageValue(cid, 77878) + 1)
			doSendMagicEffect(toPosition, 31)
			doTransformItem(itemEx.uid, 14773)
			doPlayerSendTextMessage(cid,18,"The Antennae has been blinded.")
		else
	doPlayerSendTextMessage(cid,18,"You have already blinded this antenna.")
	end
end

I tried to change but here he uses not spend time and yet again he uses the update log ....
uhsauhasuh
 
Lua:
local config = {
	exhausttime = 120, -- time in seconds
	exhauststorage = 2309
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
 
	if item.itemid == 15389 and itemEx.itemid == 14772 then
		if exhaustion.check(cid, config.exhauststorage) then
			local time = exhaustion.get(cid, config.exhauststorage)
			local minutes, seconds = math.floor ((time - ((math.floor (time / 3600)) * 3600))/ 60), time - ((math.floor (time/60)) * 60)
			if time >= 120 then
				text = ""..minutes.." minutes and "..seconds.." seconds"
			elseif time >= 60 then
				text = ""..minutes.." minute and "..seconds.." seconds"
			else
				text = ""..seconds.." seconds"
			end
			doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) 
			doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You need to wait "..text.." before you can use this again.")
			return true
		end

		if getPlayerStorageValue(cid, 77878) >= 0 and getPlayerStorageValue(cid, 77878) < 8 then
			setPlayerStorageValue(cid, 77878, getPlayerStorageValue(cid, 77878) + 1)
			doSendMagicEffect(toPosition, 31)
			doTransformItem(itemEx.uid, 14773)
			doPlayerSendTextMessage(cid,18,"The Antennae has been blinded.")
			exhaustion.set(cid, config.exhauststorage, config.exhausttime)
		else
			doPlayerSendTextMessage(cid,18,"You have already blinded this antenna.")
		end
	end
	return true
end
 
Lua:
local config = {
	exhausttime = 120, -- time in seconds
	exhauststorage = 2309
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
 
	if item.itemid == 15389 and itemEx.itemid == 14772 then
		if exhaustion.check(cid, config.exhauststorage) then
			local time = exhaustion.get(cid, config.exhauststorage)
			local minutes, seconds = math.floor ((time - ((math.floor (time / 3600)) * 3600))/ 60), time - ((math.floor (time/60)) * 60)
			if time >= 120 then
				text = ""..minutes.." minutes and "..seconds.." seconds"
			elseif time >= 60 then
				text = ""..minutes.." minute and "..seconds.." seconds"
			else
				text = ""..seconds.." seconds"
			end
			doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) 
			doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You need to wait "..text.." before you can use this again.")
			return true
		end

		if getPlayerStorageValue(cid, 77878) >= 0 and getPlayerStorageValue(cid, 77878) < 8 then
			setPlayerStorageValue(cid, 77878, getPlayerStorageValue(cid, 77878) + 1)
			doSendMagicEffect(toPosition, 31)
			doTransformItem(itemEx.uid, 14773)
			doPlayerSendTextMessage(cid,18,"The Antennae has been blinded.")
			exhaustion.set(cid, config.exhauststorage, config.exhausttime)
		else
			doPlayerSendTextMessage(cid,18,"You have already blinded this antenna.")
		end
	end
	return true
end

Greaat!! thx :D
 
Back
Top