LoveSong
New Member
- Joined
- Dec 16, 2007
- Messages
- 185
- Reaction score
- 0
Hello. I have a NPC called Bernard.
You can sell Rings and Emeralds.
But the Problem is he dont do that... When i wanna sell somthing there is come this error:
And this is my NPC:
Bernard.xml
jewels.lua
Please help that players can sell her rings and jewels on him.
You can sell Rings and Emeralds.
But the Problem is he dont do that... When i wanna sell somthing there is come this error:

And this is my NPC:
Bernard.xml
PHP:
<?xml version="1.0"?>
<npc name="Bernard" script="data/npc/scripts/rings.lua" access="5" lookdir="2">
<mana now="800" max="800"/>
<health now="200" max="200"/>
<look type="132" head="78" body="112" legs="112" feet="58" corpse="2131"/>
</npc>
jewels.lua
PHP:
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and focus == 0) and getDistanceToCreature(cid) < 4 then
selfSay('Welcome, Welcome! I love jewels! Got any jewel that you want me to take a look at?')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'white pearl') then
sell(cid,2143,1,200)
elseif msgcontains(msg, 'black pearl') then
sell(cid,2144,1,200)
elseif msgcontains(msg, 'small diamond') then
sell(cid,2145,1,400)
elseif msgcontains(msg, 'small sapphire') then
sell(cid,2146,1,400)
elseif msgcontains(msg, 'small ruby') then
sell(cid,2147,1,400)
elseif msgcontains(msg, 'small emerald') then
sell(cid,2149,1,400)
elseif msgcontains(msg, 'small amethyst') then
sell(cid,2150,1,600)
elseif msgcontains(msg, 'talon') then
sell(cid,2151,1,500)
elseif msgcontains(msg, 'violet gem') then
sell(cid,2153,1,15000)
elseif msgcontains(msg, 'yellow gem') then
sell(cid,2154,1,15000)
elseif msgcontains(msg, 'green gem') then
sell(cid,2155,1,15000)
elseif msgcontains(msg, 'red gem') then
sell(cid,2156,1,15000)
elseif msgcontains(msg, 'blue gem') then
sell(cid,2158,1,15000)
elseif msgcontains(msg, 'jewels') or msgcontains(msg, 'yes') or msgcontains(msg, 'diamond') or msgcontains(msg, 'pearl') or msgcontains(msg, 'jewel') then
selfSay('I buy white and black pearls 200gp, small diamond, small sapphire, small ruby and small emeralds 400gp, talons 500gp, small amethyst 600gp and all kind of gems 15.000gp each.')
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end
Please help that players can sell her rings and jewels on him.