• 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 Script dont work? ;O

Adrenaline

Waiting for God
Joined
Jun 13, 2011
Messages
80
Reaction score
6
Location
Poland
Hi !

I found this script but dont work? - When click at chest, opens just like a normal chest :|

TFS 0.3.6 - whats wrong with this script :S

THIS IS NOT SHOP. This is items for beginner players

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local chests = {
	[20000] = {
		items = { {7618,20} },
		container = 2000,
		storage = 5511,
		msg = "You have found a backpack health potions."
	},
	[20001] = {
		items = { {7620,20} },
		container = 2001,
		storage = 5512,
		msg = "You have found a backpack mana potions."
	},
	[20002] = {
		items = { {2160,1}, {2311,100 },
		container = 2002,
		storage = 5513,
		msg = "You have found a backpack with 1 crystal coin and one rune."
	},
	[20003] = {
		items = { {3969,1},{7744,1}, {8910,1}, {8921,1} },
		container = 1988,
		storage = 5514,
		msg = "You have found a beginner items."
	},
	[20004] = {
		items = { {7589,20} },
		container = 2001,
		storage = 5515,
		msg = "You have found a backpack strong mana potions."
	},
	[20005] = {
		items = { {758,20} },
		container = 2000,
		storage = 5516,
		msg = "You have found a backpack strong health potions."
        }
}
	local bp = doCreateItemEx(chests[item.uid].container, 1)
	for i = 1, getContainerCapById(chests[item.uid].container) do
		doAddContainerItem(bp, chests[item.uid].items[1], chests[item.uid].items[2])
	end
	if(doPlayerAddItemEx(cid, bp, 0) == RETURNVALUE_NOERROR) then
		if(getPlayerStorageValue(cid, chests[item.uid].storage) == -1) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, chests[item.uid].msg)
			setPlayerStorageValue(cid, chests[item.uid].storage, 1)
		else
			doPlayerSendCancel(cid, "You have already received your reward.")
		end
	else
		doPlayerSendCancel(cid, "You do not have enough capacity/space.")
	end
	return true
end
 
Last edited:
Back
Top