Ir para conteúdo

Problema Com Script De Orlan (7.6)


vini0111

Posts Recomendados

Estou tendo problemas com o npc Orlan (barco)

vou postar primero uma ss, dos erros que ocorrem quando tento iniciar o server:

erroexecutaveldk7.png

 

Agora irei postar o script:

...data/nps/scripts/boat

 

following = false

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('Heloo' .. creatureGetName(cid) .. '! I can take you to the Mer Jungle (200 gps) the Samaransa Desert (150gps) House City (1000gps) Lost City (500gps) Isengard (1000gps).')

focus = cid

talk_start = os.clock()

else

selfSay('Sorry, only premium players can travel by boat.')

focus = 0

talk_start = 0

end

 

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then

selfSay('Sorry, I talk to you in a minute.')

 

elseif focus == cid then

talk_start = os.clock()

elseif msgcontains(msg, 'samaransa desert') then

if pay(cid,150) then

selfSay('Let's go!')

selfSay('/send ' .. creatureGetName(cid) .. ', 263 111 6')

focus = 0

talk_start = 0

else

selfSay('Sorry, you don't have enough money.')

end

 

elseif msgcontains(msg, 'mer jungle') then

if pay(cid,200) then

selfSay('Let's go!')

selfSay('/send ' .. creatureGetName(cid) .. ', 253 227 7')

focus = 0

talk_start = 0

else

selfSay('Sorry, you don't have enough money.')

end

 

elseif msgcontains(msg, 'house city') then

if pay(cid,1000) then

selfSay('Let's go!')

selfSay('/send ' .. creatureGetName(cid) .. ', 363 107 7')

focus = 0

talk_start = 0

else

selfSay('Sorry, you don't have enough money.')

end

 

elseif msgcontains(msg, 'lost city') then

if pay(cid,500) then

selfSay('Let's go!')

selfSay('/send ' .. creatureGetName(cid) .. ', 477 35 7')

focus = 0

talk_start = 0

else

selfSay('Sorry, you don't have enough money.')

end

 

elseif msgcontains(msg, 'isengard') then

if pay(cid,1000) then

selfSay('Let's go!')

selfSay('/send ' .. creatureGetName(cid) .. ', 728 212 7')

focus = 0

talk_start = 0

else

selfSay('Sorry, you don't have enough money.')

end

 

if string.find(msg, '(%a*)yes(%a*)') and cid == focus and talkcount == 1 then

if shop == 1 then

buy(cid,item,count,price)

talk_start = os.clock()

end

if shop == 2 then

sell(cid,item,count,price)

talk_start = os.clock()

end

 

if string.find(msg, '(%a*)bye(%a*)') and focus == cid and getDistanceToCreature(cid) < 3 then

selfSay('Come back later...')')

focus = 0

talk_start = 0

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

 

Agora o arquivo da pasta npc:

...data/npc/fargum.xml

 

<?xml version="1.0"?>

<npc name="Fargum" script="data/npc/scripts/boat.lua" access="3">

<look type="134" head="114" body="114" legs="114" feet="114"/>

</npc>

 

Finalmente, a tag da pasta world:

...data/world/npc.xml

 

<npc name="Fargum" x="97" y="75" z="6" dir="3"/>

 

Ta ae.. nao sei o motivo do erro! Espero que alguem possa me ajudar..

Desde de já, Obrigado pela atenção!

 

ty :positive:

Link para o comentário
Compartilhar em outros sites

nunca vi um script tão bugado! o.O

não sei se vai dar certo, tive que fazer algumas gambiarras, tome e teste por você mesmo:

following = false
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('Heloo' .. creatureGetName(cid) .. '! I can take you to the Mer Jungle (200 gps) the Samaransa Desert (150gps) House City (1000gps) Lost City (500gps) Isengard (1000gps).')
			focus = cid
			talk_start = os.clock()
		else
			selfSay('Sorry, only premium players can travel by boat.')
			focus = 0
			talk_start = 0
		elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
			selfSay('Sorry, I talk to you in a minute.')
		elseif focus == cid then
			talk_start = os.clock()
		elseif msgcontains(msg, 'samaransa desert') then
				if pay(cid,150) then
					selfSay('Lets go!')
					selfSay('/send ' .. creatureGetName(cid) .. ', 263 111 6')
					focus = 0
					talk_start = 0
				else
					selfSay('Sorry, you dont have enough money.')
				end

		elseif msgcontains(msg, 'mer jungle') then
				if pay(cid,200) then
					selfSay('Lets go!')
					selfSay('/send ' .. creatureGetName(cid) .. ', 253 227 7')
					focus = 0
					talk_start = 0
				else
					selfSay('Sorry, you dont have enough money.')
				end
		elseif msgcontains(msg, 'house city') then
				if pay(cid,1000) then
					selfSay('Lets go!')
					selfSay('/send ' .. creatureGetName(cid) .. ', 363 107 7')
					focus = 0
					talk_start = 0
				else
					selfSay('Sorry, you dont have enough money.')
				end
		elseif msgcontains(msg, 'lost city') then
				if pay(cid,500) then
					selfSay('Lets go!')
					selfSay('/send ' .. creatureGetName(cid) .. ', 477 35 7')
					focus = 0
					talk_start = 0
				else
					selfSay('Sorry, you dont have enough money.') 
				end
		elseif msgcontains(msg, 'isengard') then
				if pay(cid,1000) then
					selfSay('Lets go!')
					selfSay('/send ' .. creatureGetName(cid) .. ', 728 212 7')
					focus = 0
					talk_start = 0
				else
					selfSay('Sorry, you dont have enough money.')
				end
		end
		if string.find(msg, '(%a*)yes(%a*)') and cid == focus and talkcount == 1 then
				if shop == 1 then
					buy(cid,item,count,price)
					talk_start = os.clock()
				end
				if shop == 2 then
					sell(cid,item,count,price)
					talk_start = os.clock()
				end
		end
	if string.find(msg, '(%a*)bye(%a*)') and focus == cid and getDistanceToCreature(cid) < 3 then
		selfSay('Come back later...')
		focus = 0
		talk_start = 0
	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

Link para o comentário
Compartilhar em outros sites

name='Eventide' date='11:17 - 18/12/2008 ' post='659183'

nunca vi um script tão bugado! o.O

não sei se vai dar certo, tive que fazer algumas gambiarras, tome e teste por você mesmo

 

Cara testei aki.. e deu esse erro no script:

 

erroexecutavel2wn3.png

 

Se puder me ajudar.. obrigado!

Link para o comentário
Compartilhar em outros sites

Cara, ta horrível esse script, ta tudo errado...

 

if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Heloo' .. creatureGetName(cid) .. '! I can take you to the Mer Jungle (200 gps) the Samaransa Desert (150gps) House City (1000gps) Lost City (500gps) Isengard (1000gps).')
focus = cid
talk_start = os.clock()
else
selfSay('Sorry, only premium players can travel by boat.')
focus = 0
talk_start = 0
end

 

A função acima, por exemplo, verifica a mensagem HI do player e se ele estiver a uma distancia maior de 4 sqm do NPC, o mesmo falará: "Sorry, only premium players can travel by boat.". o.O

 

Mas arrumando seu script:

 

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

if isPremium(cid) then
selfSay('Heloo' .. creatureGetName(cid) .. '! I can take you to the Mer Jungle (200 gps) the Samaransa Desert (150gps) House City (1000gps) Lost City (500gps) Isengard (1000gps).')
focus = cid
talk_start = os.clock()
else
selfSay('Sorry, only premium players can travel by boat.')
focus = 0
talk_start = 0
end

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

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

if msgcontains(msg, 'samaransa desert') then
if pay(cid,150) then
selfSay('Let's go!')
selfSay('/send ' .. creatureGetName(cid) .. ', 263 111 6')
focus = 0
talk_start = 0
else
selfSay('Sorry, you don't have enough money.')
end

elseif msgcontains(msg, 'mer jungle') then
if pay(cid,200) then
selfSay('Let's go!')
selfSay('/send ' .. creatureGetName(cid) .. ', 253 227 7')
focus = 0
talk_start = 0
else
selfSay('Sorry, you don't have enough money.')
end

elseif msgcontains(msg, 'house city') then
if pay(cid,1000) then
selfSay('Let's go!')
selfSay('/send ' .. creatureGetName(cid) .. ', 363 107 7')
focus = 0
talk_start = 0
else
selfSay('Sorry, you don't have enough money.')
end

elseif msgcontains(msg, 'lost city') then
if pay(cid,500) then
selfSay('Let's go!')
selfSay('/send ' .. creatureGetName(cid) .. ', 477 35 7')
focus = 0
talk_start = 0
else
selfSay('Sorry, you don't have enough money.')
end

elseif msgcontains(msg, 'isengard') then
if pay(cid,1000) then
selfSay('Let's go!')
selfSay('/send ' .. creatureGetName(cid) .. ', 728 212 7')
focus = 0
talk_start = 0
else
selfSay('Sorry, you don't have enough money.')
end

if string.find(msg, '(%a*)yes(%a*)') and cid == focus and talkcount == 1 then
if shop == 1 then
buy(cid,item,count,price)
talk_start = os.clock()
end
if shop == 2 then
sell(cid,item,count,price)
talk_start = os.clock()
end

elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 3 then
selfSay('Come back later...')')
focus = 0
talk_start = 0
end
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

 

Se não funcionar poste a SS do erro.

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...