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

Can Some one fix this .lua

dualshock3

New Member
Joined
May 14, 2010
Messages
89
Reaction score
3
ioddruid.lua
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid)				npcHandler:onCreatureAppear(cid)			end
function onCreatureDisappear(cid)			npcHandler:onCreatureDisappear(cid)			end
function onCreatureSay(cid, type, msg)			npcHandler:onCreatureSay(cid, type, msg)		end
function onThink()					npcHandler:onThink()					end

item = 'You do not have the required Level.'
done = 'Congratulations now you are Druid, Go to the dungeon and take your items and hunt.'

function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
	
		if msgcontains(msg, 'yes') then
		selfSay('Do you Want to become a Druid?', cid)

			elseif msgcontains(msg, 'yes') then
			if(getPlayerLevel(cid) < 8) then
				selfSay('Say it Proudly: Yes, I Want to Become a Druid!', cid)
				talk_state = 1
			else
				selfSay('You do not have the required Level.', cid)
				talk_state = 0
			end

			elseif msgcontains(msg, 'druid') and talk_state == 1 then
			talk_state = 0
			if(getPlayerLevel(cid) < 8) == TRUE then
							selfSay(done, cid)
			doPlayerSetVocation(cid, druid)
			end
			else
				selfSay(item, cid)
			end

        elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
            selfSay('Ok than.')
            talk_state = 0
        end

    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

error:
Code:
[21/02/2011 22:54:31] [Error - LuaScriptInterface::loadFile] data/npc/scripts/ioddruid.lua:40: 'end' expected (to close 'function' at line 13) near 'elseif'
[21/02/2011 22:54:31] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/ioddruid.lua

if someone fix this, i will publish the Island of Destiny Npcs Full 100 % working
 
Last edited:
LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid)				npcHandler:onCreatureAppear(cid)			end
function onCreatureDisappear(cid)			npcHandler:onCreatureDisappear(cid)			end
function onCreatureSay(cid, type, msg)			npcHandler:onCreatureSay(cid, type, msg)		end
function onThink()					npcHandler:onThink()					end

item = 'You do not have the required Level.'
done = 'Congratulations now you are Druid, Go to the dungeon and take your items and hunt.'

function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end

	if msgcontains(msg, 'yes') then
		selfSay('Do you Want to become a Druid?', cid)
	elseif msgcontains(msg, 'yes') then
		if(getPlayerLevel(cid) < 8) then
			selfSay('Say it Proudly: Yes, I Want to Become a Druid!', cid)
			talk_state = 1
		else
			selfSay('You do not have the required Level.', cid)
			talk_state = 0
		end
	elseif msgcontains(msg, 'druid') and talk_state == 1 then
		talk_state = 0
		if(getPlayerLevel(cid) < 8) == TRUE then
			selfSay(done, cid)
			doPlayerSetVocation(cid, druid)
		else
			selfSay(item, cid)
		end
	elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
		selfSay('Ok than.')
		talk_state = 0
	end
	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Fixed.

Edit: The tabbing was pissing me off. xD
 
Last edited:
Back
Top