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

help npc

11997733

New Member
Joined
Feb 10, 2009
Messages
25
Reaction score
1
Can, someone make me a npc plz

Ok, wel i need a npc were u can trade 100 green eggs id:6544 for exp or for a blue egg id:6543, if someone could make this for me i would rlly appreciate it Thanks.
 
Lua:
-- [url]http://otland.net/f132/help-npc-146299/[/url]

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState= {}

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

function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then return false end
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

	local exp = 121212 -- Experience

-- 100 green eggs id:6544 for exp or for a blue egg id:6543

	if doMessageCheck(msg, "green eggs") then
		if getPlayerItemCount(cid, 6544) >= 100 then
			selfSay("you will trade for blue egg or more experience", cid)
			talkState[talkUser] = 1
		end

	elseif talkState[talkUser] == 1 and doMessageCheck(msg, "blue egg") then
		if doPlayerRemoveItem(cid, 6544, 100) then
			doPlayerAddItem(cid, 6543, 1)
			selfSay("here", cid)
		else
			selfSay("items?", cid)
		end
		talkState[talkUser] = 0

	elseif talkState[talkUser] == 1 and doMessageCheck(msg, "exp") then
		if doPlayerRemoveItem(cid, 6544, 100) then
			doPlayerAddExperience(cid, exp)
			selfSay("here", cid)
		else
			selfSay("items?", cid)
		end
		talkState[talkUser] = 0

-- msg "no"
	elseif doMessageCheck(msg, 'no') and isInArray({1}, talkState[talkUser])  then
		selfSay("Okay. Okey.", cid)
	end

	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Last edited:
There was an error in my consol =/.

Lua:
[10/12/2011 20:12:38] [Error - LuaScriptInterface::loadFile] data/npc/scripts/Egg Trader.lua:36: unexpected symbol near 'then'
[10/12/2011 20:12:38] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/Egg Trader.lua
[10/12/2011 20:12:38] data/npc/scripts/Egg Trader.lua:36: unexpected symbol near 'then'
[10/12/2011 20:12:39] > Broadcasted message: "Full server save within 30 seconds, please mind it may freeze!".
[10/12/2011 20:12:39] [Error - LuaScriptInterface::loadFile] data/npc/scripts/Egg Trader.lua:36: unexpected symbol near 'then'
[10/12/2011 20:12:39] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/Egg Trader.lua
[10/12/2011 20:12:39] data/npc/scripts/Egg Trader.lua:36: unexpected symbol near 'then'
 
Last edited:
Back
Top