• 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 Vocation Quest [Help]

Northnorial

Member
Joined
May 30, 2009
Messages
742
Reaction score
5
Location
Germany
I got a problem with my script.

Error Message:
unbenanntbd.png


Script:
Code:
local config = {
	sorcerer = "1",
	druid = "2",
	paladin = "3",
	knight = "4",
	message = "You have chosen your vocation and gained some experience for your adventure.",
	exp = "1000",
	temple = {x=1021, y=941, z=6}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	
	if item.uid == 35821 then	
		if getPlayerStorageValue(cid,51924) < 1 then
			if getPlayerLevel(cid) >= 8 then	
				doPlayerSetVocation(cid, config.sorcerer)
				doPlayerSendTextMessage(cid,21,""..config.message.."")
				doPlayerAddExp(cid, config.exp)
				doPlayerSetTown(cid, 1)
				doTeleportThing(cid, config.temple)
				setPlayerStorageValue(cid,51924,1)			
			else
				doPlayerSendCancel(cid,"You don't have the required level.")
			end
		else
			doPlayerSendCancel(cid,"You have already chosen your vocation.")
		end
	end

	elseif item.uid == 35822 then
		if getPlayerStorageValue(cid,51924) < 1 then
			if getPlayerLevel(cid) >= 8 then	
				doPlayerSetVocation(cid, config.druid)
				doPlayerSendTextMessage(cid,21,""..config.message.."")
				doPlayerAddExp(cid, config.exp)
				doPlayerSetTown(cid, 1)
				doTeleportThing(cid, config.temple)
				setPlayerStorageValue(cid,51924,1)			
			else
				doPlayerSendCancel(cid,"You don't have the required level.")
			end
		else
			doPlayerSendCancel(cid,"You have already chosen your vocation.")
		end
	end

	elseif item.uid == 35823 then
		if getPlayerStorageValue(cid,51924) < 1 then
			if getPlayerLevel(cid) >= 8 then	
				doPlayerSetVocation(cid, config.paladin)
				doPlayerSendTextMessage(cid,21,""..config.message.."")
				doPlayerAddExp(cid, config.exp)
				doPlayerSetTown(cid, 1)
				doTeleportThing(cid, config.temple)
				setPlayerStorageValue(cid,51924,1)			
			else
				doPlayerSendCancel(cid,"You don't have the required level.")
			end
		else
			doPlayerSendCancel(cid,"You have already chosen your vocation.")
		end
	end

	elseif item.uid == 335824 then
		if getPlayerStorageValue(cid,51924) < 1 then
			if getPlayerLevel(cid) >= 8 then	
				doPlayerSetVocation(cid, config.knight)
				doPlayerSendTextMessage(cid,21,""..config.message.."")
				doPlayerAddExp(cid, config.exp)
				doPlayerSetTown(cid, 1)
				doTeleportThing(cid, config.temple)
				setPlayerStorageValue(cid,51924,1)			
			else
				doPlayerSendCancel(cid,"You don't have the required level.")
			end
		else
			doPlayerSendCancel(cid,"You have already chosen your vocation.")
		end
	end

return TRUE
end
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.uid >= 35821 and item.uid <= 35824 then	
		if getPlayerStorageValue(cid, 51924) < 1 then
			if getPlayerLevel(cid) >= 8 then	
				doPlayerSetVocation(cid, item.uid - 35820)
				doPlayerSendTextMessage(cid, 21, "You have chosen your vocation and gained some experience for your adventure.")
				doPlayerAddExp(cid, 1000)
				doPlayerSetTown(cid, 1)
				doTeleportThing(cid, {x=1021, y=941, z=6})
				doSendMagicEffect({x=1021, y=941, z=6}, CONST_ME_TELEPORT)
				setPlayerStorageValue(cid, 51924, 1)
			else
				doPlayerSendCancel(cid, "You don't have the required level.")
			end
		else
			doPlayerSendCancel(cid, "You have already chosen your vocation.")
		end
	end
	return TRUE
end
 
Back
Top