• 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 What's wrong with this script?

Joined
Jun 19, 2009
Messages
1,852
Reaction score
5
Code:
local t = {
	[8885] = 8886,
	[8886] = 8887,
	[8887] = 8885
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local storage, exhausted = 13315, 3
	if getPlayerStorageValue(cid, storage) > os.time() then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You need to wait " .. getPlayerStorageValue(cid, storage) - os.time() .. ' second' .. ((getPlayerStorageValue(cid, storage) - os.time()) == 1 and "" or "s") .. " to transform your armor again.")
		local i = t[item.itemid]
	if i then
		doTransformItem(item.uid, i)
		doCreatureSay(cid, "Change!", TALKTYPE_ORANGE_1)
		setPlayerStorageValue(cid, storage, os.time() + exhausted)
end	
	return true
	end
end

tried everything but can't get it to work ;z
 
Code:
local t = {
	[8885] = 8886,
	[8886] = 8887,
	[8887] = 8885
}
local storage, exhausted = 13315, 3
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid, storage) > os.time() then
		return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You need to wait " .. getPlayerStorageValue(cid, storage) - os.time() .. ' second' .. ((getPlayerStorageValue(cid, storage) - os.time()) == 1 and "" or "s") .. " to transform your armor again.")
	end
	local i = t[item.itemid]
	if i then
		doTransformItem(item.uid, i)
		doCreatureSay(cid, "Change!", TALKTYPE_ORANGE_1)
		setPlayerStorageValue(cid, storage, os.time() + exhausted)
		return true
	end
end
 
Code:
local t = {
	[8885] = 8886,
	[8886] = 8887,
	[8887] = 8885
}
local storage, exhausted = 13315, 3
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid, storage) > os.time() then
		return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You need to wait " .. getPlayerStorageValue(cid, storage) - os.time() .. ' second' .. ((getPlayerStorageValue(cid, storage) - os.time()) == 1 and "" or "s") .. " to transform your armor again.")
	end
	local i = t[item.itemid]
	if i then
		doTransformItem(item.uid, i)
		doCreatureSay(cid, getItemNameById(i) .. "!", TALKTYPE_ORANGE_1)
		setPlayerStorageValue(cid, storage, os.time() + exhausted)
		return true
	end
end
 
Code:
local t = {
	[8885] = 8886,
	[8886] = 8887,
	[8887] = 8885
}
local storage, exhausted = 13315, 3
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid, storage) > os.time() then
		return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You need to wait " .. getPlayerStorageValue(cid, storage) - os.time() .. ' second' .. ((getPlayerStorageValue(cid, storage) - os.time()) == 1 and "" or "s") .. " to transform your armor again.")
	end
	local i = t[item.itemid]
	if i then
		doTransformItem(item.uid, i)
		doCreatureSay(cid, "Change!", TALKTYPE_ORANGE_1)
		setPlayerStorageValue(cid, storage, os.time() + exhausted)
		return true
	end
end

Out of curiousity when you use variables such as t, i etc... does it make any difference what letter you use? :p
 
Back
Top