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

A Chest that you can use once every 2 days

Lightonia

Lightonia.servegame.com
Joined
Jun 4, 2007
Messages
492
Reaction score
9
Hey, as the Title says, im requesting a script to a chest, the chest can be looted only every 2 days.
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local z = {
		x = 100098,
		y = 2 * 60 * 60 * 24,
		items = {
			[1] = {2160, 3},
			[2] = {2192, 1}
		}
	}
	
	if(exhaustion.check(cid, z.x) == false) then
		exhaustion.set(cid, z.x, z.y)
		for i = 1, #z.items do
			doPlayerAddItem(cid, z.items[i][1], z.items[i][2])
		end
	else
		doPlayerSendCancel(cid, "You are exhausted in ".. exhaustion.get(cid, z.x) .." seconds.")
	end

	return true
end
 
Last edited:
Don't use the post above, I don't know what the hell it is.
Who would want to be exhausted from everything for 2 days?
 
He wants exhaust for 2 days.
With your script, he won't use any spells or anything for two days, if I'm not mistaken.
 
Ah, I didn't read 2 days, I read it as 2 seconds. But that exhaustion is not spells it's just giving exhaust for that storage. So if you call that storage in other script, it's just that storage that has the exhaust.

But the script is updated!
 
Oh, well, I guess I need to start learning about those little stuff that dwell at the bottom of LUA_FUNCTIONS.
 
Lua:
local wait = 60 * 60 * 48 -- 48 hours
local storage = 1452 -- The storage id of the chest
local item = 100 -- The item in the chest
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(exhaustion.check(cid, storage) == false) then
		exhaustion.set(cid, storage, wait)
		doPlayerAddItem(cid, item)
	else
		if((exhaustion.get(cid, storage)/60) > 1)
			doPlayerSendCancel(cid, "You may not loot this chest for another ".. exhaustion.get(cid, storage) / 60 .." minute(s).")
		else
			doPlayerSendCancel(cid, "You may not loot this chest for another ".. exhaustion.get(cid, storage) .." second(s).")
		end
	end
 
	return true
end
 
Lua:
local wait = 60 * 60 * 48 -- 48 hours
local storage = 1452 -- The storage id of the chest
local item = 100 -- The item in the chest
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(exhaustion.check(cid, storage) == false) then
		exhaustion.set(cid, storage, wait)
		doPlayerAddItem(cid, item)
	else
		if((exhaustion.get(cid, storage)/60) > 1)
			doPlayerSendCancel(cid, "You may not loot this chest for another ".. exhaustion.get(cid, storage) / 60 .." minute(s).")
		else
			doPlayerSendCancel(cid, "You may not loot this chest for another ".. exhaustion.get(cid, storage) .." second(s).")
		end
	end
 
	return true
end

Lol, why you post it again with a lower priority script?
 
Oh, well, I guess I need to start learning about those little stuff that dwell at the bottom of LUA_FUNCTIONS.

That's exhaustion storage, a lot different from spell storage exhaustion and you can also use SUBID's (but they go away if you log off) with a condition for exhaustion
 
Didn't you see my script?
My script had more configurations...

Just so you know, mine is more configurable since your variables are "x, y, z" which are usually used for positions in OTs. First thing you learn in programming/scripting; you need to make your variables have meaningful names.
 
It's not that important with meaningful variables. In my script you can choose which items should be given to the player and how many. In yours, it's just a variable with number... -.-
 
Back
Top