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

player dont recive their

Donio

Banned User
Joined
Jun 24, 2008
Messages
4,004
Reaction score
16
Location
Manhattan, New York
Hello, a quest in my server isnt rly working.. basicly the players dont get the boots they should when they leave the required items.. here is the script:

Code:
local t, Topic = {
	items = {
		{2195, 1},
		{8265, 1},
		{5468, 1},
	},
	reward = {9933, 1},
	storage = 100,
	level = 150
}, {}

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

function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	elseif msgcontains(msg, "yes") or msgcontains(msg, "quest") then
		if getPlayerStorageValue(cid, t.storage) < 1 then
			local v, i = "", 0
			for _, k in ipairs(t.items) do
				i = i + 1
				v = v .. (i == #t.items and #t.items ~= 1 and " and" or i > 1 and "," or "") .. (k[2] > 1 and (i == 1 and k[2] or " " .. k[2]) or (getItemInfo(k[1]).article == "" and "" or (i > 1 and " " .. getItemInfo(k[1]).article or getItemInfo(k[1]).article))) .. (i == 1 and getItemInfo(k[1]).article == "" and "" or " ") ..  (k[2] > 1 and not isInArray({624, 688}, getItemInfo(k[1]).slotPosition) and getItemInfo(k[1]).plural or getItemInfo(k[1]).name)
			end
			npcHandler:say("I need you to bring me " .. v .. ", do you have " .. (#t.items < 2 and t.items[1][2] < 2 and not isInArray({624, 688}, getItemInfo(t.items[1][1]).slotPosition) and "it" or "them") .. " with you?", cid)
			Topic[cid] = 1
		else
			npcHandler:say("You can only make this quest this one time!", cid)
			Topic[cid] = 0
		end
	elseif msgcontains(msg, "yes") and Topic[cid] == 1 then
		if getPlayerLevel(cid) >= t.level then
			local v, h = "", true
			for _, k in ipairs(t.items) do
				if getPlayerItemCount(cid, k[1]) < k[2] then
					h = false
					break
				end
			end
			if h then
				for _, k in ipairs(t.items) do
					doPlayerRemoveItem(cid, k[1], k[2] or 1)
				end
				doPlayerAddItem(cid, t.reward[1], t.reward[2] or 1)
				setPlayerStorageValue(cid, t.storage, 1)
				npcHandler:say("Here are your brand-new crafted firewalker boots, Enjoy!", cid)
			else
				npcHandler:say("You do not have the required items.", cid)
			end
		else
			npcHandler:say("You MUST be level " .. t.level .. ", get lost!", cid)
		end
		Topic[cid] = 0
	elseif Topic[cid] == 1 then
		Topic[cid] = 0
		npcHandler:say("Good bye, do not tell anyone about my secret place!", cid)
	end
	return true
end

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

Does anyone see anythnig wrong here?
 
That's my script, and yea it works perfectly :p
Code:
Cykotitan: hi
Riona: Welcome, Cykotitan! I have been expecting you.
Cykotitan: yes
Riona: I need you to bring me boots of haste, a piece of broken amulet and a fire bug, do you have them with you?
Cykotitan: /i boots of haste
Cykotitan: /i fire bug
Cykotitan: /i 8265
Cykotitan: yes
Riona: Here are your brand-new crafted firewalker boots, Enjoy!

You see a firewalker boots (Arm:2, protection fire +90%) that is brand-new.
It weighs 9.50 oz.
Wearing these boots reduces the damage gotten from fiery ground.
Small fix @line 24:
Code:
	elseif [B][COLOR="Red"]([/COLOR][/B]msgcontains(msg, "yes")[B][COLOR="Red"] and Topic[cid] ~= 1)[/COLOR][/B] or msgcontains(msg, "quest") then
 
Back
Top