• 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 SOLVED Help with adding other items to this script.

sylvan

New Member
Joined
Jun 23, 2009
Messages
35
Reaction score
0
Im new to scripting and i dont know how to add more items to this script

Code:
local talk_state = 0
 
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 msgcontains(msg, 'demon legs') then
              if getPlayerItemCount(cid,2157) >= 2 then
                    if doPlayerRemoveItem(cid,2157,2) == 1 then
                              selfSay('Here you are! .')
                              doPlayerAddItem(cid,2495,1)
                    end
              else
                    selfSay('I am sorry then!. ')
                    talk_state = 0
              end
     elseif msgcontains(msg, 'no') then
              selfSay('Ok.. Good bye then!!')
              talk_state = 0
     end
 
return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

~slade
 
You can add more
Lua:
     if msgcontains(msg, 'demon legs') then
              if getPlayerItemCount(cid,2157) >= 2 then
                    if doPlayerRemoveItem(cid,2157,2) == 1 then
                              selfSay('Here you are! .')
                              doPlayerAddItem(cid,2495,1)
                    end
              else
                    selfSay('I am sorry then!. ')
                    talk_state = 0
              end
     elseif msgcontains(msg, 'no') then
              selfSay('Ok.. Good bye then!!')
              talk_state = 0
     end

Beteween these lines
Code:
     end
[COLOR="red"] YOURANOTHERCODEABOVEHERE[/COLOR]
return true
Like that way
Lua:
local talk_state = 0
 
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 msgcontains(msg, 'demon legs') then
              if getPlayerItemCount(cid,2157) >= 2 then
                    if doPlayerRemoveItem(cid,2157,2) == 1 then
                              selfSay('Here you are! .')
                              doPlayerAddItem(cid,2495,1)
                    end
              else
                    selfSay('I am sorry then!. ')
                    talk_state = 0
              end
     elseif msgcontains(msg, 'no') then
              selfSay('Ok.. Good bye then!!')
              talk_state = 0
     end
	 
	      if msgcontains(msg, 'demon legs') then
              if getPlayerItemCount(cid,2157) >= 2 then
                    if doPlayerRemoveItem(cid,2157,2) == 1 then
                              selfSay('Here you are! .')
                              doPlayerAddItem(cid,2495,1)
                    end
              else
                    selfSay('I am sorry then!. ')
                    talk_state = 0
              end
     elseif msgcontains(msg, 'no') then
              selfSay('Ok.. Good bye then!!')
              talk_state = 0
     end
 
return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Only change
if msgcontains(msg, 'demon legs') then --Green means what he have to say
if getPlayerItemCount(cid,2157) >= 2 then --Red is itemid what he must have, blue is how much
if doPlayerRemoveItem(cid,2157,2) == 1 then --In this line it will remove them, grey is itemid again (same as above), red is how much again
doPlayerAddItem(cid,2495,1) --This line adds the item to him if he had those items above, Green is what item he will get (itemid) and red means how many

Rep++ --Red means that I helped you so rep+
 
Back
Top