• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Help with vocation doors

Alastore

New Member
Joined
Oct 12, 2011
Messages
7
Reaction score
0
Hi, I encountered an issue with vocation doors script :

LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.actionID== 1228) then
if getplayervocation(cid) == 1 or getplayervocation(cid) == 5 and getPlayerLevel(cid) >= 300 then
	doTeleportThing(cid, {x = 18123, y = 18262, z = 7})
	doSendMagicEffect(v,10)
	else
	doPlayerSendTextMessage(cid, 22, "Only Sorcerer level 300 may enter here!")
	end
else if getplayervocation(cid) == 2 or getplayervocation(cid) == 6 and getPlayerLevel(cid) >= 300 then
	doTeleportThing(cid, {x = 18127, y = 18262, z = 7})
	doSendMagicEffect(v,10)
	else
	doPlayerSendTextMessage(cid, 22, "Only Druid level 300 may enter here!")
	end
else if getplayervocation(cid) == 3 or getplayervocation(cid) == 7 and getPlayerLevel(cid) >= 300 then
	doTeleportThing(cid, {x = 18131, y = 18262, z = 7})
	doSendMagicEffect(v,10)
	else
	doPlayerSendTextMessage(cid, 22, "Only Paladin level 300 may enter here!")
	end
else if getplayervocation(cid) == 4 or getplayervocation(cid) == 8 and getPlayerLevel(cid) >= 300 then
	doTeleportThing(cid, {x = 18135, y = 18262, z = 7})
	doSendMagicEffect(v,10)
	else
	doPlayerSendTextMessage(cid, 22, "Only Knights level 300 may enter here!")
	end
	end
    return TRUE
end

Error says :

[Error - LuaInterface::loadFile] data/actions/scripts/other/vocquest.lua:101: 'end' expected (to close 'function' at line 1) near 'else'
 
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.actionID== 1228) then
if getplayervocation(cid) == 1 or getplayervocation(cid) == 5 and getPlayerLevel(cid) >= 300 then
	doTeleportThing(cid, {x = 18123, y = 18262, z = 7})
	doSendMagicEffect(v,10)
	else
	doPlayerSendTextMessage(cid, 22, "Only Sorcerer level 300 may enter here!")
	end
elseif getplayervocation(cid) == 2 or getplayervocation(cid) == 6 and getPlayerLevel(cid) >= 300 then
	doTeleportThing(cid, {x = 18127, y = 18262, z = 7})
	doSendMagicEffect(v,10)
	else
	doPlayerSendTextMessage(cid, 22, "Only Druid level 300 may enter here!")
	end
elseif getplayervocation(cid) == 3 or getplayervocation(cid) == 7 and getPlayerLevel(cid) >= 300 then
	doTeleportThing(cid, {x = 18131, y = 18262, z = 7})
	doSendMagicEffect(v,10)
	else
	doPlayerSendTextMessage(cid, 22, "Only Paladin level 300 may enter here!")
	end
elseif getplayervocation(cid) == 4 or getplayervocation(cid) == 8 and getPlayerLevel(cid) >= 300 then
	doTeleportThing(cid, {x = 18135, y = 18262, z = 7})
	doSendMagicEffect(v,10)
	else
	doPlayerSendTextMessage(cid, 22, "Only Knights level 300 may enter here!")
	end
	end
    return TRUE
end
end

try
 
it says now

[Error - LuaInterface::loadFile] data/actions/scripts/other/vocquest.lua:15: 'end' expected (to close 'function' at line 1) near 'elseif'
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.actionID== 1228) then
if getplayervocation(cid) == 1 or getplayervocation(cid) == 5 and getPlayerLevel(cid) >= 300 then
	doTeleportThing(cid, {x = 18123, y = 18262, z = 7})
	doSendMagicEffect(v,10)
	else
	doPlayerSendTextMessage(cid, 22, "Only Sorcerer level 300 may enter here!")
	end
elseif getplayervocation(cid) == 2 or getplayervocation(cid) == 6 and getPlayerLevel(cid) >= 300 then
	doTeleportThing(cid, {x = 18127, y = 18262, z = 7})
	doSendMagicEffect(v,10)
	else
	doPlayerSendTextMessage(cid, 22, "Only Druid level 300 may enter here!")
elseif getplayervocation(cid) == 3 or getplayervocation(cid) == 7 and getPlayerLevel(cid) >= 300 then
	doTeleportThing(cid, {x = 18131, y = 18262, z = 7})
	doSendMagicEffect(v,10)
	else
	doPlayerSendTextMessage(cid, 22, "Only Paladin level 300 may enter here!")
elseif getplayervocation(cid) == 4 or getplayervocation(cid) == 8 and getPlayerLevel(cid) >= 300 then
	doTeleportThing(cid, {x = 18135, y = 18262, z = 7})
	doSendMagicEffect(v,10)
	else
	doPlayerSendTextMessage(cid, 22, "Only Knights level 300 may enter here!")
	end
    return TRUE
end
 
It says now [Error - LuaInterface::loadFile] data/actions/scripts/other/vocquest.lua:14: 'end' expected (to close 'if' at line 2) near 'elseif'

sorry :s
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.actionID== 1228) then
if getplayervocation(cid) == 1 or getplayervocation(cid) == 5 and getPlayerLevel(cid) >= 300 then
	doTeleportThing(cid, {x = 18123, y = 18262, z = 7})
	doSendMagicEffect(v,10)
	else
	doPlayerSendTextMessage(cid, 22, "Only Sorcerer level 300 may enter here!")
elseif getplayervocation(cid) == 2 or getplayervocation(cid) == 6 and getPlayerLevel(cid) >= 300 then
	doTeleportThing(cid, {x = 18127, y = 18262, z = 7})
	doSendMagicEffect(v,10)
	else
	doPlayerSendTextMessage(cid, 22, "Only Druid level 300 may enter here!")
elseif getplayervocation(cid) == 3 or getplayervocation(cid) == 7 and getPlayerLevel(cid) >= 300 then
	doTeleportThing(cid, {x = 18131, y = 18262, z = 7})
	doSendMagicEffect(v,10)
	else
	doPlayerSendTextMessage(cid, 22, "Only Paladin level 300 may enter here!")
elseif getplayervocation(cid) == 4 or getplayervocation(cid) == 8 and getPlayerLevel(cid) >= 300 then
	doTeleportThing(cid, {x = 18135, y = 18262, z = 7})
	doSendMagicEffect(v,10)
	else
	doPlayerSendTextMessage(cid, 22, "Only Knights level 300 may enter here!")
	end
	end
    return TRUE
end
 
It says now [Error - LuaInterface::loadFile] data/actions/scripts/other/vocquest.lua:8: 'end' expected (to close 'if' at line 3 near 'elseif'

sorry :s

Maybe i have to put a different script to make vocation doors ?
 
LUA:
local levelCheck = getPlayerLevel(cid) == 300
local v = getCreaturePosition(cid)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.actionID== 1228) then
		if isSorcerer(cid) then
			if levelCheck then
				doTeleportThing(cid, {x = 18123, y = 18262, z = 7})
				doSendMagicEffect(v,10)
			else
				doPlayerSendTextMessage(cid, 22, "Only Sorcerer level 300 may enter here!")
			end
		elseif isDruid(cid) then 
			if levelCheck then
				doTeleportThing(cid, {x = 18127, y = 18262, z = 7})
				doSendMagicEffect(v,10)
			else
				doPlayerSendTextMessage(cid, 22, "Only Druids of level 300 may enter here!")
			end
		elseif isPaladin(cid) then
			if levelCheck then
				doTeleportThing(cid, {x = 18131, y = 18262, z = 7})
				doSendMagicEffect(v, 10)
			else
				doPlayerSendTextMessage(cid, 22, "Only Paladins of level 300 may enter here!")
			end
		else
			if levelCheck then
				doTeleportThing(cid, {x = 18135, y = 18262, z = 7})
				doSendMagicEffect(v, 10)
			else
				doPlayerSendTextMessage(cid, 22, "Only Knights of level 300 may enter here!")
			end
		end
	return true
	end
end
Try it.
 
Thx i got no error anymore.

Doors aint working tho. It says "The door is closed" or "The door seems to be sealed against unwanted intruders". Whatever door I put.

LUA:
<action actionid="1228" event="script" value="other/vocquest.lua"/>
 
LUA:
local levelCheck = getPlayerLevel(cid) == 300
local v = getCreaturePosition(cid)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isSorcerer(cid) then
		if levelCheck then
			doTeleportThing(cid, {x = 18123, y = 18262, z = 7})
			doSendMagicEffect(v,10)
		else
			doPlayerSendTextMessage(cid, 22, "Only Sorcerer level 300 may enter here!")
		end
	elseif isDruid(cid) then 
		if levelCheck then
			doTeleportThing(cid, {x = 18127, y = 18262, z = 7})
			doSendMagicEffect(v,10)
		else
			doPlayerSendTextMessage(cid, 22, "Only Druids of level 300 may enter here!")
		end
	elseif isPaladin(cid) then
		if levelCheck then
			doTeleportThing(cid, {x = 18131, y = 18262, z = 7})
			doSendMagicEffect(v, 10)
		else
			doPlayerSendTextMessage(cid, 22, "Only Paladins of level 300 may enter here!")
		end
	else
		if levelCheck then
			doTeleportThing(cid, {x = 18135, y = 18262, z = 7})
			doSendMagicEffect(v, 10)
		else
			doPlayerSendTextMessage(cid, 22, "Only Knights of level 300 may enter here!")
		end
	end
	return true
end
Try it now.
There's no need for the script itself to check for the actionid :).
 
Back
Top