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

Linux Remove item!

onion679

Working on o.s.s.m ONLINE
Joined
Jan 18, 2008
Messages
79
Reaction score
0
I want to create an npc. Here the script:

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
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
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)

	if msgcontains(msg, 'quest') then
		if getPlayerStorageValue(cid, 10000) == -1 then
			selfSay('Ye, I got a quest for you... Do you want to know what it is?')
			talkState = 1
			setPlayerStorageValue(cid, 10000, 1)
		elseif getPlayerStorageValue(cid, 10000) == 1 then
			selfSay('I asked you to bring me a ruby...')
		elseif getPlayerStorageValue(cid, 10000) == 2 then
			doPlayerRemoveItem(cid, 2147, 1)
			selfSay('Thanks man! You can now ask me to travel to a new place!')
			setPlayerStorageValue(cid, 10000, 5)
		elseif getPlayerStorageValue(cid, 10000) == 5 then
			selfSay('Ask me to travel if you want to!')
		end
	elseif msgcontains(msg, 'travel') then
		if getPlayerStorageValue(cid, 10000) == 5 then
			selfSay('Do you wish to travel right now?')
			talkState = 2
		else
			selfSay('Please help me before!')
		end
------------------------------------------Confirmation-----------------------------------------------
----------------------------------------------YES----------------------------------------------------
	elseif msgcontains(msg, 'yes') then
		if talkState == 1 then
			selfSay('Allright! Get a ruby from the red cristal in the sewer and bring me it!')
		end
		if talkState == 2 then
			selfSay('Good! Here we go!')
		end
----------------------------------------------NOP----------------------------------------------------
	else
		if talkState == 1 then
			selfSay('You know that you will not leave this island until you helped me out? Come back later when you will be grown up!')
		end
		if talkState == 2 then
			selfSay('Oh well... Come back when you will be ready!')
		end		
	end
end

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

All works in it but the remove item thing :S can you tell me what i s wrong in it???
Code:
doPlayerRemoveItem(cid, 2147, 1)
 
Back
Top