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

why doesn't my script work?

Ecstacy

Mothafuckaaa
Joined
Dec 26, 2008
Messages
3,836
Reaction score
108
Location
The Netherlands
Hey, I can't get this to work :blink:.
Could anyone tell me whats wrong with it?

LUA:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, getConfigInfo('timeBetweenExActions') - 100)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local level, maglevel = getPlayerLevel(cid), getPlayerMagLevel(cid)
	local mana_minimum = level * 8 + maglevel * 1.0
	local mana_maximum = level * 11 + maglevel * 1.0

function onUse(cid, item, fromPosition, itemEx, toPosition)	
	if getPlayerVocation(cid) <= 2 then
		doPlayerAddMana(cid, math.random(mana_minimum, mana_maximum))
		doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
		doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
	elseif getPlayerVocation(cid) >= 3 then
		if level > 10 and level < 3000 then
			doPlayerAddHealth(cid, 5000)
			doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
			doCreatureSay(itemEx.uid, "Aaaah... Health!", TALKTYPE_ORANGE_1)
		elseif level > 3000 and level < 6000 then
			doPlayerAddHealth(cid, 10000)
			doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
			doCreatureSay(itemEx.uid, "Aaaah... Health!", TALKTYPE_ORANGE_1)
		elseif level > 6000 and level < 12000 then
			doPlayerAddHealth(cid, 15000)
			doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
			doCreatureSay(itemEx.uid, "Aaaah... Health!", TALKTYPE_ORANGE_1)
		elseif level > 12000 then
			doPlayerAddHealth(cid, 20000)
			doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
			doCreatureSay(itemEx.uid, "Aaaah... Health!", TALKTYPE_ORANGE_1)
		end
	end
	return TRUE
end
end
 
Last edited:
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, getConfigInfo('timeBetweenExActions') - 100)

        local level, maglevel = getPlayerLevel(cid), getPlayerMagLevel(cid)
        local mana_minimum = level * 8 + maglevel * 1.0
        local mana_maximum = level * 11 + maglevel * 1.0

function onUse(cid, item, fromPosition, itemEx, toPosition)    
        if getPlayerVocation(cid) <= 2 then
                doPlayerAddMana(cid, math.random(mana_minimum, mana_maximum))
                doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
                doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
        elseif getPlayerVocation(cid) >= 3 then
                if level > 10 and level < 3000 then
                        doPlayerAddHealth(cid, 5000)
                        doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
                        doCreatureSay(itemEx.uid, "Aaaah... Health!", TALKTYPE_ORANGE_1)
                elseif level > 3000 and level < 6000 then
                        doPlayerAddHealth(cid, 10000)
                        doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
                        doCreatureSay(itemEx.uid, "Aaaah... Health!", TALKTYPE_ORANGE_1)
                elseif level > 6000 and level < 12000 then
                        doPlayerAddHealth(cid, 15000)
                        doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
                        doCreatureSay(itemEx.uid, "Aaaah... Health!", TALKTYPE_ORANGE_1)
                elseif level > 12000 then
                        doPlayerAddHealth(cid, 20000)
                        doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
                        doCreatureSay(itemEx.uid, "Aaaah... Health!", TALKTYPE_ORANGE_1)
                end
        end
        return TRUE
end
 
aaa
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local lvl, mag = getPlayerLevel(cid), getPlayerMagLevel(cid)
	local c, a = lvl * 8 + mag * 1.0, lvl * 11 + mag * 1.0
	local r = math.random(c, a)
	local myTable = {
		[2] = {mana = r, eff = CONST_ME_MAGIC_BLUE, text = "Aaaah..."},
		[3] = {health = {
			[{10, 3000}] = {hp = 5000},
			[{3000, 6000}] = {hp = 10000},
			[{6000, 12000}] = {hp = 15000},
			[{12000}] = {hp = 20000}
		},
		eff = CONST_ME_MAGIC_BLUE, text = "Aaaah... Health!"}
	}
	local k = myTable[getPlayerVocation(cid)]
	if k then
		if not k.health then
			doCreatureAddMana(cid, r)
			doSendMagicEffect(getThingPos(itemEx.uid), k.eff)
			doCreatureSay(itemEx.uid, k.text, 19)
		else
			for _, v in pairs(k.health) do
				if v[2] then
					if lvl > v[1] and lvl < v[2] then
						doCreatureAddHealth(cid, v.hp)
						doSendMagicEffect(getThingPos(itemEx.uid), v.eff)
						doCreatureSay(itemEx.uid, v.text, 19)
					end
				elseif not v[2] and lvl > v[1] then
					doCreatureAddHealth(cid, v.hp)
					doSendMagicEffect(getThingPos(itemEx.uid), v.eff)
					doCreatureSay(itemEx.uid, v.text, 19)
				end
			end
		end
	end
	return true
end
 
Last edited:
LUA:
	local myTable = {
		[1] = {mana = r, eff = CONST_ME_MAGIC_BLUE, text = "Aaaah..."},
		[2] = {mana = r, eff = CONST_ME_MAGIC_BLUE, text = "Aaaah..."},
		[3] = {health = {
			[{10, 3000}] = {hp = 5000},
			[{3000, 6000}] = {hp = 10000},
			[{6000, 12000}] = {hp = 15000},
			[{12000}] = {hp = 20000}
		},
		[4] = {health = {
			[{10, 3000}] = {hp = 5000},
			[{3000, 6000}] = {hp = 10000},
			[{6000, 12000}] = {hp = 15000},
			[{12000}] = {hp = 20000}
		},
		eff = CONST_ME_MAGIC_BLUE, text = "Aaaah... Health!"}
	}

I'm getting error at this part, when vocations are added.

Code:
[11/05/2010 15:05:50] [Error - LuaScriptInterface::loadFile] data/actions/scripts/other/manarunetest.lua:22: '}' expected (to close '{' at line 5) near 'local'
[11/05/2010 15:05:50] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/manarunetest.lua)
[11/05/2010 15:05:50] data/actions/scripts/other/manarunetest.lua:22: '}' expected (to close '{' at line 5) near 'local'
[11/05/2010 15:05:50] Reloaded actions.
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local lvl, mag = getPlayerLevel(cid), getPlayerMagLevel(cid)
	local c, a = lvl * 8 + mag * 1.0, lvl * 11 + mag * 1.0
	local r = math.random(c, a)
	local myTable = {
		[2] = {mana = r, eff = CONST_ME_MAGIC_BLUE, text = "Aaaah..."},
		[3] = {health = {
			[{10, 3000}] = {hp = 5000},
			[{3000, 6000}] = {hp = 10000},
			[{6000, 12000}] = {hp = 15000},
			[{12000}] = {hp = 20000}
		}, eff = CONST_ME_MAGIC_BLUE, text = "Aaaah... Health!"},
		[4] = {health = {
                        [{10, 3000}] = {hp = 5000},
                        [{3000, 6000}] = {hp = 10000},
                        [{6000, 12000}] = {hp = 15000},
                        [{12000}] = {hp = 20000}
		}, eff = CONST_ME_MAGIC_BLUE, text = "Aaaah... Health!"}
	}
	local k = myTable[getPlayerVocation(cid)]
	if k then
		if not k.health then
			doCreatureAddMana(cid, r)
			doSendMagicEffect(getThingPos(itemEx.uid), k.eff)
			doCreatureSay(itemEx.uid, k.text, 19)
		else
			for _, v in pairs(k.health) do
				if v[2] then
					if lvl > v[1] and lvl < v[2] then
						doCreatureAddHealth(cid, v.hp)
						doSendMagicEffect(getThingPos(itemEx.uid), v.eff)
						doCreatureSay(itemEx.uid, v.text, 19)
					end
				elseif not v[2] and lvl > v[1] then
					doCreatureAddHealth(cid, v.hp)
					doSendMagicEffect(getThingPos(itemEx.uid), v.eff)
					doCreatureSay(itemEx.uid, v.text, 19)
				end
			end
		end
	end
	return true
end
 
Last edited:
Back
Top