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

[DevLand][NPC] Błąd

Drakos

Banned User
Joined
May 27, 2008
Messages
218
Reaction score
1
Location
Poland
Witam , potrzebuje pomocy ponieważ na konsoli wyskakuje takie coś
luaSetNpcFocus <>. Creature not found

Lua Script Error: [Npc interface]
data/npc/scripts/frodo.lua : onThink
Z każdym npc , Wiecie może od czego ?

Skrypt Npc :

Code:
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('Hello, ' .. getCreatureName(cid) .. '! I sell jet pack (50zeni), shovels (20zeni), bag (5zeni), backpacks (10zeni), pick (50zeni), scythe (50zeni) , and torches (2zeni).')
focus = cid
talk_start = os.clock()

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.')

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

if msgcontains(msg, 'shovel') then
buy(cid,2554,getCount(msg),20)
elseif msgcontains(msg, 'backpack') then
buy(cid,1998,getCount(msg),10)
elseif msgcontains(msg, 'jet pack') then
buy(cid,2120,getCount(msg),20)
elseif msgcontains(msg, 'pick') then
buy(cid,2553,getCount(msg),50)
elseif msgcontains(msg, 'torch') then
buy(cid,2050,getCount(msg),2)
elseif msgcontains(msg, 'scythe') then
buy(cid,2550,getCount(msg),50)
elseif msgcontains(msg, 'bag') then
buy(cid,1987,getCount(msg),5)
elseif msgcontains(msg, 'worms') then
buy(cid,3976,getCount(msg),1)
elseif msgcontains(msg, 'fishing') then
buy(cid,2580,getCount(msg),100)
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. getCreatureName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end

function onThink()
doNpcSetCreatureFocus(focus)
if (os.clock() - talk_start) > 45 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

Proszę Pomocy
 
Last edited by a moderator:
Code:
if (focus ~= nil) then
	doNpcSetCreatureFocus(focus)
end
 
Back
Top