• 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 [Action]Level Chest

error656

New Member
Joined
Aug 27, 2007
Messages
60
Reaction score
1
Hello
I want to ask you about chest witch player can open only if he have enought lvl. I was using that script:

local CONFIG =
{
[50003] = { -- Chest Unique ID
chestLevel = xx, -- Player Level
chestStorage = 10501, -- Storage
items = {{2160,10}}, -- {ITEM_ID,COUNT}
},
[50004] = { -- Chest Unique ID
chestLevel = xx, -- Player Level
chestStorage = 10502, -- Storage
items = {{2160,25}}, -- {ITEM_ID,COUNT}
},
[50005] = { -- Chest Unique ID
chestLevel = xx, -- Player Level
chestStorage = 10503, -- Storage
items = {{2160,50}} -- {ITEM_ID,COUNT}
},
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
local questStatus = getPlayerStorageValue(cid, CONFIG[item.uid].chestStorage)
if (questStatus == -1) then
if getPlayerLevel(cid) >= CONFIG[item.uid].chestLevel then
for i = 1, #CONFIG[item.uid].items do
doPlayerAddItem(cid, CONFIG[item.uid].items[1], CONFIG[item.uid].items[2])
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Congratulations! Now you can buy some staff :)")
doSendAnimatedText(getCreaturePosition(cid), "Success!", TEXTCOLOR_RED)
setPlayerStorageValue(cid, CONFIG[item.uid].chestStorage, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must be atleast level ".. CONFIG[item.uid].chestLevel.." to open this chest.")
end
else
doSendAnimatedText(fromPosition, "Empty", TEXTCOLOR_WHITE)
end
return true
end


and its working fine, but now i using older version of TFS with is not supporting local config. Is there anybody who can rebuild this script?

Oh and i search on forum something helpful but nothing found.

Thanks for helping!
 
Any errors? Did you replace xx with numbers?

xDDDDDDDDDD of course :D i just show you my script with is working good on TFS 3.6, but now im using older version and server dont recognize local config - console doesnt showing any errors but script isnt working. I just need to rebuild that script (if its possible) to doing the same without local config.^_^
 
Didn't Search? o.0
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid, 5640) == -1 then
		if getPlayerLevel(cid) >= 100 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found 15 crystal coins.')
			doPlayerAddItem(cid, 2160, 15)
			setPlayerStorageValue(cid, 5640, 1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You need level 100 or higher to use this chest.')
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty.')
	end
	return true
end
 
Didn't Search? o.0
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid, 5640) == -1 then
		if getPlayerLevel(cid) >= 100 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found 15 crystal coins.')
			doPlayerAddItem(cid, 2160, 15)
			setPlayerStorageValue(cid, 5640, 1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You need level 100 or higher to use this chest.')
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty.')
	end
	return true
end

Thanks mate, its working, i tried to search that a few days ago, obviously i must miss this script ;o Thx Thx Thx ! ;)
Thread To close
 
Back
Top