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

Lua djinn npc

Caym

New Member
Joined
Jun 30, 2020
Messages
7
Reaction score
0
Hi this its my npc djinn.
Can you please check.
waht its wrong with him, he have some limit, example if I setup bunny slippers for 100 its fine, if more then 100scrab coins then he dont want to take item and pay.
Thank You for help

LUA:
focus = 0
talk_start = 0
target = 0
following = false
attacking = false

function onThingMove(creature, thing, oldpos, oldstackpos)

end


function onCreatureAppear(creature)

end


function onCreatureDisappear(cid, pos)
      if focus == cid then
          selfSay('Dowidzenia.')
          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 ((string.find(msg, '(%a*)hi(%a*)')
or string.find(msg, '(%a*)siema(%a*)')
or string.find(msg, '(%a*)czesc(%a*)')
or string.find(msg, '(%a*)cze(%a*)')
or string.find(msg, '(%a*)yo(%a*)')
or string.find(msg, '(%a*)elo(%a*)'))
and (focus == 0)) and getDistanceToCreature(cid) < 4 then

rsay = math.random(1,4)
if rsay == 1 then says = 'Waazzuup'
elseif rsay == 2 then says = 'Siema'
elseif rsay == 3 then says = 'Czesc'
elseif rsay == 4 then says = 'Witam'
end


   selfSay('Abrahamus dobry czlowieku ' .. creatureGetName(cid) .. '! Skupuje: [bunny slippers][200SC], [rose shield][200SC], [cossack armor][200sc], [native armor][200SC], [soft boots][50SC], [red tunic][40SC], [magican hat][200SC], [purple key][100SC], [magiczne klapki][200SC], [crystal wand][200SC], [magic staff][200SC],[cossack mace][100SC]')
   focus = cid

talk_start = os.clock()

   elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
   selfSay('Spadaj ' .. creatureGetName(cid) .. ' do kolejki !')

elseif focus == cid then
talk_start = os.clock()

if msgcontains(msg, 'bunny slippers') then
sell1(cid,2644,1,100000000,100000000,0,0,0)
elseif msgcontains(msg, 'rose shield') then
sell1(cid,2527,1,100000000,100000000,0,0,0)
elseif msgcontains(msg, 'cossack legs') then
sell1(cid,2504,1,100000000,100000000,0,0,0)
elseif msgcontains(msg, 'cossack armor') then
sell1(cid,2503,1,100000000,100000000,0,0,0)
elseif msgcontains(msg, 'soft boots') then
sell(cid,2640,1,50000000)
elseif msgcontains(msg, 'red tunic') then
sell(cid,2653,1,40000000)
elseif msgcontains(msg, 'magican hat') then
sell1(cid,2662,1,100000000,100000000,100000000,100000000,100000000)
elseif msgcontains(msg, 'purple key') then
sell(cid,2086,1,100000000)
elseif msgcontains(msg, 'magiczne klapki') then
sell1(cid,2358,1,100000000,100000000,0,0,0)
elseif msgcontains(msg, 'crystal wand') then
sell1(cid,2452,1,100000000,100000000,0,0,0)
elseif msgcontains(msg, 'magic staff') then
sell1(cid,2433,1,100000000,100000000,100000000,0,0)
elseif msgcontains(msg, 'cossack mace') then
sell(cid,2424,1,100000000)



elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Dowidzenia ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end


function onCreatureChangeOutfit(creature)

end


function onThink()
   if focus == 0 then
    
   end

if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Ktos Nastepny??')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Dowidzenia.')
focus = 0
end
end
if focus == 0 then
cx, cy, cz = selfGetPosition()
randmove = math.random(1,20)
if randmove == 1 then
nx = cx + 1
end
if randmove == 2 then
nx = cx - 1
end
if randmove == 3 then
ny = cy + 1
end
if randmove == 4 then
ny = cy - 1
end
if randmove >= 5 then
nx = cx
ny = cy
end
moveToPosition(nx, ny, cz)
--summons = 30
--summons2 = 30
end
end
, what its wrong with him.
he must pay for me scrab coins, example bunny sllipers for 200.
he have something like limit till 100, how to change the limit ?
 
Back
Top