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

Manarune

Himii

Premium User
Premium User
Joined
Jan 19, 2011
Messages
1,268
Solutions
5
Reaction score
188
Location
Sweden
PHP:
local ultimateMana = RUNE ID

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local var = numberToVariant(cid)
	local level = getPlayerLevel(cid)
	local mag = getPlayerMagLevel(cid)

	local manamin = (level/2.5)+(mag*2)
	local manamax = (level/2)+(mag*2)

	if itemEx.uid ~= cid or itemEx.itemid ~= 1 then
		return TRUE
	end

	if(item.itemid == ultimateMana) then
		if (getPlayerLevel(cid) < 150) or (getPlayerVocation(cid) ~= VOCATION_ID) then
			doCreatureSay(cid, "This potion can only be consumed by players of level 150 or higher.", TALKTYPE_ORANGE_1)
			return TRUE
		end
		if(doTargetCombatMana(0, cid, manamin, manamax, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		--doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doTransformItem(item.uid, ultimateMana)
	end
	return TRUE
end

[24/12/2011 23:47:57] [Error - LuaScriptInterface::loadFile] data/actions/scripts/runes/Mr.lua:3: '=' expected near 'function'
[24/12/2011 23:47:57] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/runes/Mr.lua)
[24/12/2011 23:47:57] data/actions/scripts/runes/Mr.lua:3: '=' expected near 'function'

Anyone knows the problem??
 
Try
LUA:
config =
{
	manaruneId = XXXX,
	vocationsId = {0, 1, 2},
	requiredLevel = 150
}

function onUse(cid, item, fromPos, itemEx, toPos)

	local level, maglevel = getPlayerLevel(cid), getPlayerMagLevel(cid)
	local min, max = (level / 2.5) + (maglevel * 2), 
		(level / 2) + (maglevel * 2)

	if (itemEx.uid ~= cid or item.itemid ~= config.manaruneId) then
	else
		if (level < config.requiredLevel or not isInArray(getPlayerVocation(cid), config.vocationsId)) then
			doCreatureSay(cid, "This potion can only be consumed by players of level ".. config.requiredLevel .." or higher.", TALKTYPE_ORANGE_1)
		else
			if(doTargetCombatMana(0, cid, min, max, CONST_ME_MAGIC_BLUE) ~= LUA_ERROR) then
				doTransformItem(item.uid, config.manaruneId)
			end
		end
	end
	return true
end
 
Back
Top