Ir para conteúdo

Olhem Meu Script E Me Ajudem A Achar Os Meus Erros


Bladedj

Posts Recomendados

Desculpem ae estar postando novamente mas é que minhas duvidas continuam a vir xP

este é outro script que eu fiz mas novamente da erro <eof>

já mudei ele varias vezes e continua ñ sei mais oque fazer, se alguem puder dar uma olhada e me dizer onde falhei agradeço muito.

 

Script:>

focus = 0

talk_start = 0

target = 0

following = false

attacking = false

talk_state = 20

cname = ''

vocation = 0

mainlevel = 400

gstat = 0 -- guild status

grank = '' -- guild rank

gname = '' -- guild name

pname = '' -- name of some other player

maxnamelen = 30

maxranklen = 20

maxnicklen = 20

leaderlevel = 50

NONE = 0

INVITED = 1

MEMBER = 2

VICE = 3

leader = 4

allow_pattern = '^[a-zA-Z0-9 -]+$'

 

function onThingMove(creature, thing, oldpos, oldstackpos)

 

end

 

 

function onCreatureAppear(creature)

 

end

 

 

function onCreatureDisappear(cid, pos)

if focus == cid then

selfSay('Bye.')

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)

cname = creatureGetName(cid)

msg = string.lower(msg)

end

if ((string.find(msg, '(%a*)hi(%a*)')) and (focus == 0)) and getDistanceToCreature(cid) < 4 then

if getPlayerSex(cid) == 1 or getPlayerSex(cid) == 2 or getPlayerSex(cid) == 17 or getPlayerSex(cid) == 18 or getPlayerSex(cid) == 19 or getPlayerSex(cid) == 20 then

selfSay('Hello, ' .. creatureGetName(cid) .. '! So, you want to get in the Akatsuki?')

talk_state = 20

focus = cid

talk_start = os.clock()

else

selfSay('Sorry, but you alredy chose your position. If not, talk to the Admin.')

talk_state = 0

focus = cid

end

end

 

elseif string.find(msg, '(%a*)hi(%a*)') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then

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

 

elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then

selfSay('Cya, ' .. cname .. '!')

talk_state = 20

focus = 0

talk_start = 0 elseif focus == cid then

talk_start = os.clock()

 

if talk_state == 20 then

if msgcontains(msg, 'yes') then -- confirmando decisao

level = getPlayerLevel(cname)

end

end

end

end

 

 

if level >= mainlevel then

selfSay('Great! tell me what member you want to be?')

talk_state = 1

else

selfSay('Sorry, you don\'t have all the requeriments to be one Akatsuki member...')

talk_state = 20

 

else

selfSay('So, come back when you have level '.. mainlevel ..'.')

talk_state = 20

end

end

end

 

elseif talk_state == 1 then -- telling vilage

talk_state = 2

 

if msgcontains(msg, 'pain') then

selfSay('hum, kill the monster named pain and bring to me his rune. if you have the rune say: pain rune')

talk_state = 2

 

 

elseif msgcontains(msg, 'konan') then

selfSay('hum, kill the monster named konan and bring to me his rune. if you have the rune say: konan rune')

talk_state = 2

 

elseif msgcontains(msg, 'hidan') then

selfSay('hum, kill the monster named hidan and bring to me his rune. if you have the rune say: hidan rune')

talk_state = 2

 

 

elseif msgcontains(msg, 'tobi') then

selfSay('hum, kill the monster named tobi and bring to me his rune. if you have the rune say: tobi rune')

talk_state = 2

 

 

elseif msgcontains(msg, 'zetsu') then

selfSay('hum, kill the monster named zetsu and bring to me his rune. if you have the rune say zetsu rune')

talk_state = 2

 

 

elseif msgcontains(msg, 'sasori') then

selfSay('hum, kill the monster named sasori and bring to me his rune. if you have the rune say sasori rune')

talk_state = 2

 

 

elseif msgcontains(msg, 'deidara') then

selfSay('hum, kill the monster named deidara and bring to me his rune. if you have the rune say deidara rune')

talk_state = 2

 

elseif msgcontains(msg, 'itachi') then

selfSay('hum, kill the monster named itachi and bring to me his rune. if you have the rune say itachi rune')

talk_state = 2

 

 

elseif msgcontains(msg, 'kisame') then

selfSay('hum, kill the monster named kisame and bring to me his rune. if you have the rune say kisame rune')

talk_state = 2

end

 

elseif msgcontains(msg, 'kakuzu') then

selfSay('hum, kill the monster named kakuzu and bring to me his rune. if you have the rune say kakuzu rune')

talk_state = 2

 

else

selfSay('Sorry, this member does not exist')

vocation = 3

talk_state = 1

end

 

elseif talk_state == 2 then -- telling vilage

 

 

if msgcontains(msg, 'pain rune') then

selfSay('Very good, let me take the rune! are you sure?')

itemstatus = doPlayerRemoveItem(cid,2294)

talk_state = 4

end

 

elseif msgcontains(msg, 'konan rune') then

selfSay('Very good, let me take the rune! are you sure?')

itemstatus = doPlayerRemoveItem(cid,2295)

talk_state = 6

end

 

elseif msgcontains(msg, 'hidan rune') then

selfSay('Right your son of the b---! are you sure?')

itemstatus = doPlayerRemoveItem(cid,2296)

talk_state = 7

end

 

elseif msgcontains(msg, 'tobi rune') then

selfSay('I\'m with hunger, get out of here! are you sure?')

itemstatus = doPlayerRemoveItem(cid,2297)

talk_state = 5

end

 

elseif msgcontains(msg, 'zetsu rune') then

selfSay('Get out of here! are you sure?')

itemstatus = doPlayerRemoveItem(cid,2299)

talk_state = 8

end

 

elseif msgcontains(msg, 'sasori rune') then

selfSay('Oh my God! You\'ll be and master killer! are you sure')

itemstatus = doPlayerRemoveItem(cid,2299)

talk_state = 9

end

 

elseif msgcontains(msg, 'deidara rune') then

selfSay('Hmm, i going put fire in your ass! get out of here! are you sure?')

itemstatus = doPlayerRemoveItem(cid,2304)

talk_state = 10

end

 

elseif msgcontains(msg, 'itachi rune') then

selfSay('Humm, Mangekyou Sharingan! don\'t worry i\'m just kidding! are you sure?')

itemstatus = doPlayerRemoveItem(cid,2306)

talk_state = 11

end

 

elseif msgcontains(msg, 'kisame rune') then

selfSay('Humm... are you sure?')

itemstatus = doPlayerRemoveItem(cid,2309)

talk_state = 12

end

 

elseif msgcontains(msg, 'kakuzu rune') then

selfSay('o.O! are you sure?')

itemstatus = doPlayerRemoveItem(cid,2312)

talk_state = 13

end

 

else

selfSay('Sorry, this clan does not exists.')

vocation = 0

talk_state = 2

end

 

 

elseif talk_state == 4 then -- confirming vocation

if msgcontains(msg, 'yes') and talk_state == 4 then

buy(cid,6227,1,0)

buy(cid,6272,1,0)

buy(cid,2195,1,0)

setPlayerStorageValue(cid,7845,1)

setPlayerStorageValue(cid,50,1)

learnSpell(cid,'mar de areia',0)

learnSpell(cid,'akatsuki final rinnegan no jutsu',0)

learnSpell(cid,'akat impulse',0)

learnSpell(cid,'akatsuki no jutsu',0)

learnSpell(cid,'rinnegan',0)

selfSay('Here is your new habilities.')

selfSay('mar de areia, akatsuki final rinnegan no jutsu, akat impulse, akatsuki no jutsu and rinnegan.')

selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 161')

talk_state = 20

focus = 0

end

end

 

if talk_state == 5 then

if msgcontains(msg, 'yes') and talk_state == 5 then

buy(cid,6227,1,0)

buy(cid,6272,1,0)

buy(cid,2195,1,0)

setPlayerStorageValue(cid,7846,1)

setPlayerStorageValue(cid,51,1)

learnSpell(cid,'dragao de chakra',0)

learnSpell(cid,'suiton tsunami no jutsu',0)

learnSpell(cid,'akat impulse',0)

learnSpell(cid,'akatsuki no jutsu',0)

selfSay('Here is your new habilities.')

selfSay('dragao de chakra, suiton tsunami no jutsu, akat impulse and akatsuki no jutsu.')

selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 168')

talk_state = 20

focus = 0

end

end

 

 

 

 

if talk_state == 6 then

if msgcontains(msg, 'yes') and talk_state == 6 then

buy(cid,6227,1,0)

buy(cid,6272,1,0)

buy(cid,2195,1,0)

setPlayerStorageValue(cid,7847,1)

setPlayerStorageValue(cid,52,1)

selfSay('Here is your new habilities.')

selfSay('ritual jashin, sugakra, akat impulse and akatsuki no jutsu.')

selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 170')

learnSpell(cid,'ritual jashin',0)

learnSpell(cid,'akat impulse',0)

learnSpell(cid,'akatsuki no jutsu',0)

learnSpell(cid,'sugakra',0)

talk_state = 20

focus = 0

end

end

 

 

 

if talk_state == 7 then

if msgcontains(msg, 'yes') and talk_state == 7 then

buy(cid,6227,1,0)

buy(cid,6272,1,0)

buy(cid,2195,1,0)

setPlayerStorageValue(cid,7848,1)

setPlayerStorageValue(cid,53,1)

selfSay('Here is your new habilities.')

selfSay('amaterasu, katon karyuudan, mangekyou sharingan, akat impulse and akatsuki no jutsu.')

selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 164')

learnSpell(cid,'amaterasu',0)

learnSpell(cid,'katon karyuudan',0)

learnSpell(cid,'akat impulse',0)

learnSpell(cid,'akatsuki no jutsu',0)

learnSpell(cid,'mangekyou sharingan',0)

talk_state = 20

focus = 0

end

end

 

 

if talk_state == 8 then

if msgcontains(msg, 'yes') and talk_state == 8 then

buy(cid,6227,1,0)

buy(cid,6272,1,0)

buy(cid,2195,1,0)

setPlayerStorageValue(cid,7849,1)

setPlayerStorageValue(cid,54,1)

learnSpell(cid,'camuflate',0)

learnSpell(cid,'zetsu gan no jutsu',0)

learnSpell(cid,'akat impulse',0)

learnSpell(cid,'akatsuki no jutsu',0)

learnSpell(cid,'corda de mil metros',0)

selfSay('Here is your new habilities.')

selfSay('camuflate, zetsu gan no jutsu, corda de mil metros, akat impulse and akatsuki no jutsu.')

selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 169.')

talk_state = 20

focus = 0

end

end

 

 

if talk_state == 9 then

if msgcontains(msg, 'yes') and talk_state == 9 then

buy(cid,6227,1,0)

buy(cid,6272,1,0)

buy(cid,2195,1,0)

setPlayerStorageValue(cid,7850,1)

setPlayerStorageValue(cid,55,1)

learnSpell(cid,'akat impulse',0)

learnSpell(cid,'akatsuki no jutsu',0)

learnSpell(cid,'sabaku sousou',0)

learnSpell(cid,'corda de mil metros',0)

selfSay('Here is your new habilities.')

selfSay('sabaku sousou, corda de mil metros, akat impulse and akatsuki no jutsu.')

selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 162.')

talk_state = 20

focus = 0

end

end

 

 

if talk_state == 10 then

if msgcontains(msg, 'yes') and talk_state == 10 then

buy(cid,6227,1,0)

buy(cid,6272,1,0)

buy(cid,2195,1,0)

setPlayerStorageValue(cid,7851,1)

setPlayerStorageValue(cid,56,1)

learnSpell(cid,'big explosion',0)

learnSpell(cid,'katsu',0)

learnSpell(cid,'akat impulse',0)

learnSpell(cid,'akatsuki no jutsu',0)

selfSay('big explosion, katsu, akat impulse and akatsuki no jutsu.')

selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 165.')

talk_state = 20

focus = 0

end

end

 

 

 

if talk_state == 11 then

if msgcontains(msg, 'yes') and talk_state == 11 then

buy(cid,6227,1,0)

buy(cid,6272,1,0)

buy(cid,2195,1,0)

setPlayerStorageValue(cid,7852,1)

setPlayerStorageValue(cid,57,1)

learnSpell(cid,'amaterasu',0)

learnSpell(cid,'katon karyuudan',0)

learnSpell(cid,'akat impulse',0)

learnSpell(cid,'akatsuki no jutsu',0)

learnSpell(cid,'mangekyou sharingan',0)

selfSay('Here is your new habilities.')

selfSay('amaterasu, katon karyuudan, mangekyou sharingan, akat impulse and akatsuki no jutsu.')

selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 167.')

talk_state = 20

focus = 0

end

end

 

if talk_state == 12 then

if msgcontains(msg, 'yes') and talk_state == 12 then

buy(cid,6227,1,0)

buy(cid,6272,1,0)

buy(cid,2195,1,0)

setPlayerStorageValue(cid,7853,1)

setPlayerStorageValue(cid,58,1)

learnSpell(cid,'tubarchakra',0)

learnSpell(cid,'sugakra',0)

learnSpell(cid,'akat impulse',0)

learnSpell(cid,'akatsuki no jutsu',0)

selfSay('Here is your new habilities.')

selfSay('tubarchakra, sugakra, akat impulse and akatsuki no jutsu.')

selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 166.')

talk_state = 20

focus = 0

end

end

 

if talk_state == 13 then

if msgcontains(msg, 'yes') and talk_state == 13 then

buy(cid,6227,1,0)

buy(cid,6272,1,0)

buy(cid,2195,1,0)

setPlayerStorageValue(cid,7854,1)

setPlayerStorageValue(cid,59,1)

learnSpell(cid,'chidori nagashi',0)

learnSpell(cid,'cruzadajutsu',0)

learnSpell(cid,'akat impulse',0)

learnSpell(cid,'akatsuki no jutsu',0)

learnSpell(cid,'kazeno tzul',0)

selfSay('Here is your new habilities.')

selfSay('chidori nagashi, cruzadajutsu,kazeno tzul, akat impulse and akatsuki no jutsu.')

selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 163.')

talk_state = 20

focus = 0

end

end

 

 

 

function onCreatureChangeOutfit(creature)

 

end

 

 

function onThink()

if focus > 0 then

x, y, z = creatureGetPosition(focus)

myx, myy, myz = selfGetPosition()

if ((myy-y==0) and (myx-x<=0 and myx-x>=-4)) then

selfTurn(0)

end

if ((myy-y==0) and (myx-x>=0 and myx-x<=4)) then

selfTurn(2)

end

if ((myx-x==0) and (myy-y<=0 and myy-y>=-4)) then

selfTurn(1)

end

if ((myx-x==0) and (myy-y>=0 and myy-y<=4)) then

selfTurn(3)

end

if ((myy-y==-2) and (myx-x>=-1 and myx-x<=1)) then

selfTurn(1)

end

if ((myy-y==2) and (myx-x>=-1 and myx-x<=1)) then

selfTurn(3)

end

if ((myx-x==2) and (myy-y>=-1 and myy-y<=1)) then

selfTurn(2)

end

if ((myx-x==-2) and (myy-y>=-1 and myy-y<=1)) then

selfTurn(0)

end

if ((myy-y==-3) and (myx-x>=-2 and myx-x<=2)) then

selfTurn(1)

end

if ((myy-y==3) and (myx-x>=-2 and myx-x<=2)) then

selfTurn(3)

end

if ((myx-x==3) and (myy-y>=-2 and myy-y<=2)) then

selfTurn(2)

end

if ((myx-x==-3) and (myy-y>=-2 and myy-y<=2)) then

selfTurn(0)

end

if ((myy-y==-4) and (myx-x>=-3 and myx-x<=3)) then

selfTurn(1)

end

if ((myy-y==4) and (myx-x>=-3 and myx-x<=3)) then

selfTurn(3)

end

if ((myx-x==4) and (myy-y>=-3 and myy-y<=3)) then

selfTurn(2)

end

if ((myx-x==-4) and (myy-y>=-3 and myy-y<=3)) then

selfTurn(0)

end

end

if focus == 0 then

randmove = math.random(1,50)

if randmove == 1 then

selfMove(0)

end

if randmove == 2 then

selfMove(1)

end

if randmove == 3 then

selfMove(2)

end

if randmove == 4 then

selfMove(3)

end

end

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

end

end

Link para o comentário
Compartilhar em outros sites

Desculpem ae estar postando novamente mas é que minhas duvidas continuam a vir xP

este é outro script que eu fiz mas novamente da erro <eof>

já mudei ele varias vezes e continua ñ sei mais oque fazer, se alguem puder dar uma olhada e me dizer onde falhei agradeço muito.

 

Script:>

 

focus = 0
talk_start = 0
target = 0
following = false
attacking = false
talk_state = 20
cname = ''
vocation = 0
mainlevel = 400
gstat = 0 -- guild status
grank = '' -- guild rank
gname = '' -- guild name
pname = '' -- name of some other player
maxnamelen = 30
maxranklen = 20
maxnicklen = 20
leaderlevel = 50
NONE = 0
INVITED = 1
MEMBER = 2
VICE = 3
leader = 4
allow_pattern = '^[a-zA-Z0-9 -]+$'

function onThingMove(creature, thing, oldpos, oldstackpos)

end


function onCreatureAppear(creature)

end


function onCreatureDisappear(cid, pos)
. if focus == cid then
. . selfSay('Bye.')
. . 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)
. cname = creatureGetName(cid)
. msg = string.lower(msg)
end

if ((string.find(msg, '(%a*)hi(%a*)')) and (focus == 0)) and getDistanceToCreature(cid) < 4 then
. if getPlayerSex(cid) == 1 or getPlayerSex(cid) == 2 or getPlayerSex(cid) == 17 or getPlayerSex(cid) == 18 or getPlayerSex(cid) == 19 or getPlayerSex(cid) == 20 then
. . selfSay('Hello, ' .. creatureGetName(cid) .. '! So, you want to get in the Akatsuki?')
. . talk_state = 20
. . focus = cid
. . talk_start = os.clock()
. else
. . selfSay('Sorry, but you alredy chose your position. If not, talk to the Admin.')
. . talk_state = 0
. . focus = cid
. end
end

elseif string.find(msg, '(%a*)hi(%a*)') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
. selfSay('Sorry, ' .. cname .. '! I talk to you in a minute.')

elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
. selfSay('Cya, ' .. cname .. '!')
. talk_state = 20
. focus = 0
. talk_start = 0 elseif focus == cid then
. talk_start = os.clock()

. if talk_state == 20 then
. . if msgcontains(msg, 'yes') then -- confirmando decisao
. . . level = getPlayerLevel(cname)
. . end
. end
end
end


if level >= mainlevel then
. selfSay('Great! tell me what member you want to be?')
. talk_state = 1
else
. selfSay('Sorry, you don\'t have all the requeriments to be one Akatsuki member...')
. talk_state = 20

else
. selfSay('So, come back when you have level '.. mainlevel ..'.')
. talk_state = 20
end
end
end

elseif talk_state == 1 then -- telling vilage
. talk_state = 2

if msgcontains(msg, 'pain') then
. selfSay('hum, kill the monster named pain and bring to me his rune. if you have the rune say: pain rune')
. talk_state = 2


elseif msgcontains(msg, 'konan') then
. selfSay('hum, kill the monster named konan and bring to me his rune. if you have the rune say: konan rune')
. talk_state = 2

elseif msgcontains(msg, 'hidan') then
. selfSay('hum, kill the monster named hidan and bring to me his rune. if you have the rune say: hidan rune')
. talk_state = 2


elseif msgcontains(msg, 'tobi') then
. selfSay('hum, kill the monster named tobi and bring to me his rune. if you have the rune say: tobi rune')
. talk_state = 2

elseif msgcontains(msg, 'zetsu') then
. selfSay('hum, kill the monster named zetsu and bring to me his rune. if you have the rune say zetsu rune')
. talk_state = 2

elseif msgcontains(msg, 'sasori') then
. selfSay('hum, kill the monster named sasori and bring to me his rune. if you have the rune say sasori rune')
. talk_state = 2

elseif msgcontains(msg, 'deidara') then
. selfSay('hum, kill the monster named deidara and bring to me his rune. if you have the rune say deidara rune')
. talk_state = 2

elseif msgcontains(msg, 'itachi') then
. selfSay('hum, kill the monster named itachi and bring to me his rune. if you have the rune say itachi rune')
. talk_state = 2

elseif msgcontains(msg, 'kisame') then
. selfSay('hum, kill the monster named kisame and bring to me his rune. if you have the rune say kisame rune')
. talk_state = 2
end

elseif msgcontains(msg, 'kakuzu') then
. selfSay('hum, kill the monster named kakuzu and bring to me his rune. if you have the rune say kakuzu rune')
. talk_state = 2

else
. selfSay('Sorry, this member does not exist')
. vocation = 3
. talk_state = 1
end

elseif talk_state == 2 then -- telling vilage

. if msgcontains(msg, 'pain rune') then
. . selfSay('Very good, let me take the rune! are you sure?')
. . itemstatus = doPlayerRemoveItem(cid,2294)
. . talk_state = 4
. end

. elseif msgcontains(msg, 'konan rune') then
. . selfSay('Very good, let me take the rune! are you sure?')
. . itemstatus = doPlayerRemoveItem(cid,2295)
. . talk_state = 6
. end

. elseif msgcontains(msg, 'hidan rune') then
. . selfSay('Right your son of the b---! are you sure?')
. . itemstatus = doPlayerRemoveItem(cid,2296)
. . talk_state = 7
. end

. elseif msgcontains(msg, 'tobi rune') then
. . selfSay('I\'m with hunger, get out of here! are you sure?')
. . itemstatus = doPlayerRemoveItem(cid,2297)
. . talk_state = 5
. end

. elseif msgcontains(msg, 'zetsu rune') then
. . selfSay('Get out of here! are you sure?')
. . itemstatus = doPlayerRemoveItem(cid,2299)
. . talk_state = 8
. end

. elseif msgcontains(msg, 'sasori rune') then
. . selfSay('Oh my God! You\'ll be and master killer! are you sure')
. . itemstatus = doPlayerRemoveItem(cid,2299)
. . talk_state = 9
. end

. elseif msgcontains(msg, 'deidara rune') then
. . selfSay('Hmm, i going put fire in your ass! get out of here! are you sure?')
. . itemstatus = doPlayerRemoveItem(cid,2304)
. . talk_state = 10
. end

. elseif msgcontains(msg, 'itachi rune') then
. . selfSay('Humm, Mangekyou Sharingan! don\'t worry i\'m just kidding! are you sure?')
. . itemstatus = doPlayerRemoveItem(cid,2306)
. . talk_state = 11
. end

. elseif msgcontains(msg, 'kisame rune') then
. . selfSay('Humm... are you sure?')
. . itemstatus = doPlayerRemoveItem(cid,2309)
. . talk_state = 12
. end

. elseif msgcontains(msg, 'kakuzu rune') then
. . selfSay('! are you sure?')
. . itemstatus = doPlayerRemoveItem(cid,2312)
. . talk_state = 13
. end

. else
. . selfSay('Sorry, this clan does not exists.')
. . vocation = 0
. . talk_state = 2
. end


elseif talk_state == 4 then -- confirming vocation
. if msgcontains(msg, 'yes') and talk_state == 4 then
. . buy(cid,6227,1,0)
. . buy(cid,6272,1,0)
. . buy(cid,2195,1,0)
. . setPlayerStorageValue(cid,7845,1)
. . setPlayerStorageValue(cid,50,1)
. . learnSpell(cid,'mar de areia',0)
. . learnSpell(cid,'akatsuki final rinnegan no jutsu',0)
. . learnSpell(cid,'akat impulse',0)
. . learnSpell(cid,'akatsuki no jutsu',0)
. . learnSpell(cid,'rinnegan',0)
. . selfSay('Here is your new habilities.')
. . selfSay('mar de areia, akatsuki final rinnegan no jutsu, akat impulse, akatsuki no jutsu and rinnegan.')
. . selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 161')
. . talk_state = 20
. . focus = 0
. end
end

if talk_state == 5 then
. if msgcontains(msg, 'yes') and talk_state == 5 then
. . buy(cid,6227,1,0)
. . buy(cid,6272,1,0)
. . buy(cid,2195,1,0)
. . setPlayerStorageValue(cid,7846,1)
. . setPlayerStorageValue(cid,51,1)
. . learnSpell(cid,'dragao de chakra',0)
. . learnSpell(cid,'suiton tsunami no jutsu',0)
. . learnSpell(cid,'akat impulse',0)
. . learnSpell(cid,'akatsuki no jutsu',0)
. . selfSay('Here is your new habilities.')
. . selfSay('dragao de chakra, suiton tsunami no jutsu, akat impulse and akatsuki no jutsu.')
. . selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 168')
. . talk_state = 20
. . focus = 0
. end
end

if talk_state == 6 then
. if msgcontains(msg, 'yes') and talk_state == 6 then
. . buy(cid,6227,1,0)
. . buy(cid,6272,1,0)
. . buy(cid,2195,1,0)
. . setPlayerStorageValue(cid,7847,1)
. . setPlayerStorageValue(cid,52,1)
. . selfSay('Here is your new habilities.')
. . selfSay('ritual jashin, sugakra, akat impulse and akatsuki no jutsu.')
. . selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 170')
. . learnSpell(cid,'ritual jashin',0)
. . learnSpell(cid,'akat impulse',0)
. . learnSpell(cid,'akatsuki no jutsu',0)
. . learnSpell(cid,'sugakra',0)
. . talk_state = 20
. . focus = 0
. end
end

if talk_state == 7 then
. if msgcontains(msg, 'yes') and talk_state == 7 then
. . buy(cid,6227,1,0)
. . buy(cid,6272,1,0)
. . buy(cid,2195,1,0)
. . setPlayerStorageValue(cid,7848,1)
. . setPlayerStorageValue(cid,53,1)
. . selfSay('Here is your new habilities.')
. . selfSay('amaterasu, katon karyuudan, mangekyou sharingan, akat impulse and akatsuki no jutsu.')
. . selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 164')
. . learnSpell(cid,'amaterasu',0)
. . learnSpell(cid,'katon karyuudan',0)
. . learnSpell(cid,'akat impulse',0)
. . learnSpell(cid,'akatsuki no jutsu',0)
. . learnSpell(cid,'mangekyou sharingan',0)
. . talk_state = 20
. . focus = 0
. end
end

if talk_state == 8 then
. if msgcontains(msg, 'yes') and talk_state == 8 then
. . buy(cid,6227,1,0)
. . buy(cid,6272,1,0)
. . buy(cid,2195,1,0)
. . setPlayerStorageValue(cid,7849,1)
. . setPlayerStorageValue(cid,54,1)
. . learnSpell(cid,'camuflate',0)
. . learnSpell(cid,'zetsu gan no jutsu',0)
. . learnSpell(cid,'akat impulse',0)
. . learnSpell(cid,'akatsuki no jutsu',0)
. . learnSpell(cid,'corda de mil metros',0)
. . selfSay('Here is your new habilities.')
. . selfSay('camuflate, zetsu gan no jutsu, corda de mil metros, akat impulse and akatsuki no jutsu.')
. . selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 169.')
. . talk_state = 20
. . focus = 0
. end
end

if talk_state == 9 then
. if msgcontains(msg, 'yes') and talk_state == 9 then
. . buy(cid,6227,1,0)
. . buy(cid,6272,1,0)
. . buy(cid,2195,1,0)
. . setPlayerStorageValue(cid,7850,1)
. . setPlayerStorageValue(cid,55,1)
. . learnSpell(cid,'akat impulse',0)
. . learnSpell(cid,'akatsuki no jutsu',0)
. . learnSpell(cid,'sabaku sousou',0)
. . learnSpell(cid,'corda de mil metros',0)
. . selfSay('Here is your new habilities.')
. . selfSay('sabaku sousou, corda de mil metros, akat impulse and akatsuki no jutsu.')
. . selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 162.')
. . talk_state = 20
. . focus = 0
. end
end

if talk_state == 10 then
. if msgcontains(msg, 'yes') and talk_state == 10 then
. . buy(cid,6227,1,0)
. . buy(cid,6272,1,0)
. . buy(cid,2195,1,0)
. . setPlayerStorageValue(cid,7851,1)
. . setPlayerStorageValue(cid,56,1)
. . learnSpell(cid,'big explosion',0)
. . learnSpell(cid,'katsu',0)
. . learnSpell(cid,'akat impulse',0)
. . learnSpell(cid,'akatsuki no jutsu',0)
. . selfSay('big explosion, katsu, akat impulse and akatsuki no jutsu.')
. . selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 165.')
. . talk_state = 20
. . focus = 0
. end
end


if talk_state == 11 then
. if msgcontains(msg, 'yes') and talk_state == 11 then
. . buy(cid,6227,1,0)
. . buy(cid,6272,1,0)
. . buy(cid,2195,1,0)
. . setPlayerStorageValue(cid,7852,1)
. . setPlayerStorageValue(cid,57,1)
. . learnSpell(cid,'amaterasu',0)
. . learnSpell(cid,'katon karyuudan',0)
. . learnSpell(cid,'akat impulse',0)
. . learnSpell(cid,'akatsuki no jutsu',0)
. . learnSpell(cid,'mangekyou sharingan',0)
. . selfSay('Here is your new habilities.')
. . selfSay('amaterasu, katon karyuudan, mangekyou sharingan, akat impulse and akatsuki no jutsu.')
. . selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 167.')
. . talk_state = 20
. . focus = 0
. end
end

if talk_state == 12 then
. if msgcontains(msg, 'yes') and talk_state == 12 then
. . buy(cid,6227,1,0)
. . buy(cid,6272,1,0)
. . buy(cid,2195,1,0)
. . setPlayerStorageValue(cid,7853,1)
. . setPlayerStorageValue(cid,58,1)
. . learnSpell(cid,'tubarchakra',0)
. . learnSpell(cid,'sugakra',0)
. . learnSpell(cid,'akat impulse',0)
. . learnSpell(cid,'akatsuki no jutsu',0)
. . selfSay('Here is your new habilities.')
. . selfSay('tubarchakra, sugakra, akat impulse and akatsuki no jutsu.')
. . selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 166.')
. . talk_state = 20
. . focus = 0
. end
end

if talk_state == 13 then
. if msgcontains(msg, 'yes') and talk_state == 13 then
. . buy(cid,6227,1,0)
. . buy(cid,6272,1,0)
. . buy(cid,2195,1,0)
. . setPlayerStorageValue(cid,7854,1)
. . setPlayerStorageValue(cid,59,1)
. . learnSpell(cid,'chidori nagashi',0)
. . learnSpell(cid,'cruzadajutsu',0)
. . learnSpell(cid,'akat impulse',0)
. . learnSpell(cid,'akatsuki no jutsu',0)
. . learnSpell(cid,'kazeno tzul',0)
. . selfSay('Here is your new habilities.')
. . selfSay('chidori nagashi, cruzadajutsu,kazeno tzul, akat impulse and akatsuki no jutsu.')
. . selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 163.')
. . talk_state = 20
. . focus = 0
. end
end



function onCreatureChangeOutfit(creature)

end


function onThink()
. if focus > 0 then
. . x, y, z = creatureGetPosition(focus)
. . myx, myy, myz = selfGetPosition()
. . if ((myy-y==0) and (myx-x<=0 and myx-x>=-4)) then
. . . selfTurn(0)
. . end
. . if ((myy-y==0) and (myx-x>=0 and myx-x<=4)) then
. . . selfTurn(2)
. . end
. . if ((myx-x==0) and (myy-y<=0 and myy-y>=-4)) then
. . . selfTurn(1)
. . end
. . if ((myx-x==0) and (myy-y>=0 and myy-y<=4)) then
. . . selfTurn(3)
. . end
. . if ((myy-y==-2) and (myx-x>=-1 and myx-x<=1)) then
. . . selfTurn(1)
. . end
. . if ((myy-y==2) and (myx-x>=-1 and myx-x<=1)) then
. . . selfTurn(3)
. . end
. . if ((myx-x==2) and (myy-y>=-1 and myy-y<=1)) then
. . . selfTurn(2)
. . end
. . if ((myx-x==-2) and (myy-y>=-1 and myy-y<=1)) then
. . . selfTurn(0)
. . end
. . if ((myy-y==-3) and (myx-x>=-2 and myx-x<=2)) then
. . . selfTurn(1)
. . end
. . if ((myy-y==3) and (myx-x>=-2 and myx-x<=2)) then
. . . selfTurn(3)
. . end
. . if ((myx-x==3) and (myy-y>=-2 and myy-y<=2)) then
. . . selfTurn(2)
. . end
. . if ((myx-x==-3) and (myy-y>=-2 and myy-y<=2)) then
. . . selfTurn(0)
. . end
. . if ((myy-y==-4) and (myx-x>=-3 and myx-x<=3)) then
. . . selfTurn(1)
. . end
. . if ((myy-y==4) and (myx-x>=-3 and myx-x<=3)) then
. . . selfTurn(3)
. . end
. . if ((myx-x==4) and (myy-y>=-3 and myy-y<=3)) then
. . . selfTurn(2)
. . end
. . if ((myx-x==-4) and (myy-y>=-3 and myy-y<=3)) then
. . . selfTurn(0)
. . end
. end
. if focus == 0 then
. . randmove = math.random(1,50)
. if randmove == 1 then
. . selfMove(0)
. end
. if randmove == 2 then
. . selfMove(1)
. end
. if randmove == 3 then
. . selfMove(2)
. end
. if randmove == 4 then
. . selfMove(3)
. end
end
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
end
end

 

 

o script acima não funciona, serve apenas para vc comparar e entender o cascateamento, abre if, fecha if, elseif...

vou comentar alguns pontos com alguns erros que encontrei

 

143eve9.jpg

não se abre elseif depois de um end em mesmo nível

 

307n5tu.jpg

vários end, todos no nível 0... estão simplesmente finalizando NADA

 

2ai1weu.jpg

 

 

ilzs0i.jpg

na primeira imagem, temos um bloco de elseif sendo desenvolvido com perfeição, aí chega no fim, vc usa um elseif depois de um end

já na segunda imagem, o bloco está INTEIRO errado

 

a programação vai funcionar basicamente assim:

nível 0
nível 0
nível 0
nível 0
[b]IF ..... THEN[/b]
  nível 1
  nível 1
  nível 1
  nível 1
  [b]IF ... THEN[/b]
     nível 2
     nível 2
     nível 2
     nível 2
  [b]ELSE IF ... THEN [/b]
     nível 2
     nível 2
     nível 2
  [b]END[/b]
  nível 1
  nível 1
  nível 1
  nível 1
[b]ELSE[/b]
  nível 1
  nível 1
  nível 1
[b]END[/b]

 

seu script sem erros de EOF ficaria assim

focus = 0
talk_start = 0
target = 0
following = false
attacking = false
talk_state = 20
cname = ''
vocation = 0
mainlevel = 400
gstat = 0 -- guild status
grank = '' -- guild rank
gname = '' -- guild name
pname = '' -- name of some other player
maxnamelen = 30
maxranklen = 20
maxnicklen = 20
leaderlevel = 50
NONE = 0
INVITED = 1
MEMBER = 2
VICE = 3
leader = 4
allow_pattern = '^[a-zA-Z0-9 -]+$'

function onThingMove(creature, thing, oldpos, oldstackpos) end
function onCreatureAppear(creature)						end
function onCreatureTurn(creature)						  end
function onCreatureChangeOutfit(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 onCreatureDisappear(cid, pos)
if focus == cid then
	selfSay('Bye.')
	focus = 0
	talk_start = 0
end
end

function onCreatureSay(cid, type, msg)
cname = creatureGetName(cid)
msg = string.lower(msg)
if ((string.find(msg, '(%a*)hi(%a*)')) and (focus == 0)) and getDistanceToCreature(cid) < 4 then
	if getPlayerSex(cid) == 1 or getPlayerSex(cid) == 2 or getPlayerSex(cid) == 17 or getPlayerSex(cid) == 18 or getPlayerSex(cid) == 19 or getPlayerSex(cid) == 20 then
		selfSay('Hello, ' .. creatureGetName(cid) .. '! So, you want to get in the Akatsuki?')
		talk_state = 20
		focus = cid
		talk_start = os.clock()
	else
		selfSay('Sorry, but you alredy chose your position. If not, talk to the Admin.')
		talk_state = 20
		focus = cid
	end
end

elseif string.find(msg, '(%a*)hi(%a*)') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
	selfSay('Sorry, ' .. cname .. '! I talk to you in a minute.')

elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 and focus == cid then
	selfSay('Cya, ' .. cname .. '!')
	talk_state = 0
	focus = 0
	talk_start = 0
elseif focus == cid then
	talk_start = os.clock()
	if talk_state == 20 and msgcontains(msg, 'yes') then
		if getPlayerLevel(cname) >= mainlevel then
			selfSay('Great! tell me what member you want to be?')
			talk_state = 1
		else
			selfSay('Sorry, you don\'t have all the requeriments to be one Akatsuki member...')
			selfSay('So, come back when you have level '.. mainlevel ..'.')
			talk_state = 20
		end

	elseif talk_state == 1 then -- telling vilage
		talk_state = 2

		if msgcontains(msg, 'pain') then
			selfSay('hum, kill the monster named pain and bring to me his rune. if you have the rune say: pain rune')
			talk_state = 2


		elseif msgcontains(msg, 'konan') then
			selfSay('hum, kill the monster named konan and bring to me his rune. if you have the rune say: konan rune')
			talk_state = 2

		elseif msgcontains(msg, 'hidan') then
			selfSay('hum, kill the monster named hidan and bring to me his rune. if you have the rune say: hidan rune')
			talk_state = 2

		elseif msgcontains(msg, 'tobi') then
			selfSay('hum, kill the monster named tobi and bring to me his rune. if you have the rune say: tobi rune')
			talk_state = 2

		elseif msgcontains(msg, 'zetsu') then
			selfSay('hum, kill the monster named zetsu and bring to me his rune. if you have the rune say zetsu rune')
			talk_state = 2

		elseif msgcontains(msg, 'sasori') then
			selfSay('hum, kill the monster named sasori and bring to me his rune. if you have the rune say sasori rune')
			talk_state = 2

		elseif msgcontains(msg, 'deidara') then
			selfSay('hum, kill the monster named deidara and bring to me his rune. if you have the rune say deidara rune')
			talk_state = 2

		elseif msgcontains(msg, 'itachi') then
			selfSay('hum, kill the monster named itachi and bring to me his rune. if you have the rune say itachi rune')
			talk_state = 2

		elseif msgcontains(msg, 'kisame') then
			selfSay('hum, kill the monster named kisame and bring to me his rune. if you have the rune say kisame rune')
			talk_state = 2

		elseif msgcontains(msg, 'kakuzu') then
			selfSay('hum, kill the monster named kakuzu and bring to me his rune. if you have the rune say kakuzu rune')
			talk_state = 2

		else
			selfSay('Sorry, this member does not exist')
			vocation = 3
			talk_state = 1
		end

	elseif talk_state == 2 then -- telling vilage
		if msgcontains(msg, 'pain rune') then
			selfSay('Very good, let me take the rune! are you sure?')
			itemstatus = doPlayerRemoveItem(cid,2294)
			talk_state = 4

		elseif msgcontains(msg, 'konan rune') then
			selfSay('Very good, let me take the rune! are you sure?')
			itemstatus = doPlayerRemoveItem(cid,2295)
			talk_state = 6

		elseif msgcontains(msg, 'hidan rune') then
			selfSay('Right your son of the b---! are you sure?')
			itemstatus = doPlayerRemoveItem(cid,2296)
			talk_state = 7

		elseif msgcontains(msg, 'tobi rune') then
			selfSay('I\'m with hunger, get out of here! are you sure?')
			itemstatus = doPlayerRemoveItem(cid,2297)
			talk_state = 5

		elseif msgcontains(msg, 'zetsu rune') then
			selfSay('Get out of here! are you sure?')
			itemstatus = doPlayerRemoveItem(cid,2299)
			talk_state = 8

		elseif msgcontains(msg, 'sasori rune') then
			selfSay('Oh my God! You\'ll be and master killer! are you sure')
			itemstatus = doPlayerRemoveItem(cid,2299)
			talk_state = 9

		elseif msgcontains(msg, 'deidara rune') then
			selfSay('Hmm, i going put fire in your ass! get out of here! are you sure?')
			itemstatus = doPlayerRemoveItem(cid,2304)
			talk_state = 10

		elseif msgcontains(msg, 'itachi rune') then
			selfSay('Humm, Mangekyou Sharingan! don\'t worry i\'m just kidding! are you sure?')
			itemstatus = doPlayerRemoveItem(cid,2306)
			talk_state = 11

		elseif msgcontains(msg, 'kisame rune') then
			selfSay('Humm... are you sure?')
			itemstatus = doPlayerRemoveItem(cid,2309)
			talk_state = 12

		elseif msgcontains(msg, 'kakuzu rune') then
			selfSay('! are you sure?')
			itemstatus = doPlayerRemoveItem(cid,2312)
			talk_state = 13

		else
			selfSay('Sorry, this clan does not exists.')
			vocation = 0
			talk_state = 2
		end


	elseif talk_state == 4 then -- confirming vocation
		if msgcontains(msg, 'yes') and talk_state == 4 then
			buy(cid,6227,1,0)
			buy(cid,6272,1,0)
			buy(cid,2195,1,0)
			setPlayerStorageValue(cid,7845,1)
			setPlayerStorageValue(cid,50,1)
			learnSpell(cid,'mar de areia',0)
			learnSpell(cid,'akatsuki final rinnegan no jutsu',0)
			learnSpell(cid,'akat impulse',0)
			learnSpell(cid,'akatsuki no jutsu',0)
			learnSpell(cid,'rinnegan',0)
			selfSay('Here is your new habilities.')
			selfSay('mar de areia, akatsuki final rinnegan no jutsu, akat impulse, akatsuki no jutsu and rinnegan.')
			selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 161')
			talk_state = 20
			focus = 0
		end
	end

	if talk_state == 5 then
		if msgcontains(msg, 'yes') and talk_state == 5 then
			buy(cid,6227,1,0)
			buy(cid,6272,1,0)
			buy(cid,2195,1,0)
			setPlayerStorageValue(cid,7846,1)
			setPlayerStorageValue(cid,51,1)
			learnSpell(cid,'dragao de chakra',0)
			learnSpell(cid,'suiton tsunami no jutsu',0)
			learnSpell(cid,'akat impulse',0)
			learnSpell(cid,'akatsuki no jutsu',0)
			selfSay('Here is your new habilities.')
			selfSay('dragao de chakra, suiton tsunami no jutsu, akat impulse and akatsuki no jutsu.')
			selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 168')
			talk_state = 20
			focus = 0
		end
	end

	if talk_state == 6 then
		if msgcontains(msg, 'yes') and talk_state == 6 then
			buy(cid,6227,1,0)
			buy(cid,6272,1,0)
			buy(cid,2195,1,0)
			setPlayerStorageValue(cid,7847,1)
			setPlayerStorageValue(cid,52,1)
			selfSay('Here is your new habilities.')
			selfSay('ritual jashin, sugakra, akat impulse and akatsuki no jutsu.')
			selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 170')
			learnSpell(cid,'ritual jashin',0)
			learnSpell(cid,'akat impulse',0)
			learnSpell(cid,'akatsuki no jutsu',0)
			learnSpell(cid,'sugakra',0)
			talk_state = 20
			focus = 0
		end
	end

	if talk_state == 7 then
		if msgcontains(msg, 'yes') and talk_state == 7 then
			buy(cid,6227,1,0)
			buy(cid,6272,1,0)
			buy(cid,2195,1,0)
			setPlayerStorageValue(cid,7848,1)
			setPlayerStorageValue(cid,53,1)
			selfSay('Here is your new habilities.')
			selfSay('amaterasu, katon karyuudan, mangekyou sharingan, akat impulse and akatsuki no jutsu.')
			selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 164')
			learnSpell(cid,'amaterasu',0)
			learnSpell(cid,'katon karyuudan',0)
			learnSpell(cid,'akat impulse',0)
			learnSpell(cid,'akatsuki no jutsu',0)
			learnSpell(cid,'mangekyou sharingan',0)
			talk_state = 20
			focus = 0
		end
	end

	if talk_state == 8 then
		if msgcontains(msg, 'yes') and talk_state == 8 then
			buy(cid,6227,1,0)
			buy(cid,6272,1,0)
			buy(cid,2195,1,0)
			setPlayerStorageValue(cid,7849,1)
			setPlayerStorageValue(cid,54,1)
			learnSpell(cid,'camuflate',0)
			learnSpell(cid,'zetsu gan no jutsu',0)
			learnSpell(cid,'akat impulse',0)
			learnSpell(cid,'akatsuki no jutsu',0)
			learnSpell(cid,'corda de mil metros',0)
			selfSay('Here is your new habilities.')
			selfSay('camuflate, zetsu gan no jutsu, corda de mil metros, akat impulse and akatsuki no jutsu.')
			selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 169.')
			talk_state = 20
			focus = 0
		end
	end

	if talk_state == 9 then
		if msgcontains(msg, 'yes') and talk_state == 9 then
			buy(cid,6227,1,0)
			buy(cid,6272,1,0)
			buy(cid,2195,1,0)
			setPlayerStorageValue(cid,7850,1)
			setPlayerStorageValue(cid,55,1)
			learnSpell(cid,'akat impulse',0)
			learnSpell(cid,'akatsuki no jutsu',0)
			learnSpell(cid,'sabaku sousou',0)
			learnSpell(cid,'corda de mil metros',0)
			selfSay('Here is your new habilities.')
			selfSay('sabaku sousou, corda de mil metros, akat impulse and akatsuki no jutsu.')
			selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 162.')
			talk_state = 20
			focus = 0
		end
	end

	if talk_state == 10 then
		if msgcontains(msg, 'yes') and talk_state == 10 then
			buy(cid,6227,1,0)
			buy(cid,6272,1,0)
			buy(cid,2195,1,0)
			setPlayerStorageValue(cid,7851,1)
			setPlayerStorageValue(cid,56,1)
			learnSpell(cid,'big explosion',0)
			learnSpell(cid,'katsu',0)
			learnSpell(cid,'akat impulse',0)
			learnSpell(cid,'akatsuki no jutsu',0)
			selfSay('big explosion, katsu, akat impulse and akatsuki no jutsu.')
			selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 165.')
			talk_state = 20
			focus = 0
		end
	end

	if talk_state == 11 then
		if msgcontains(msg, 'yes') and talk_state == 11 then
			buy(cid,6227,1,0)
			buy(cid,6272,1,0)
			buy(cid,2195,1,0)
			setPlayerStorageValue(cid,7852,1)
			setPlayerStorageValue(cid,57,1)
			learnSpell(cid,'amaterasu',0)
			learnSpell(cid,'katon karyuudan',0)
			learnSpell(cid,'akat impulse',0)
			learnSpell(cid,'akatsuki no jutsu',0)
			learnSpell(cid,'mangekyou sharingan',0)
			selfSay('Here is your new habilities.')
			selfSay('amaterasu, katon karyuudan, mangekyou sharingan, akat impulse and akatsuki no jutsu.')
			selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 167.')
			talk_state = 20
			focus = 0
		end
	end

	if talk_state == 12 then
		if msgcontains(msg, 'yes') and talk_state == 12 then
			buy(cid,6227,1,0)
			buy(cid,6272,1,0)
			buy(cid,2195,1,0)
			setPlayerStorageValue(cid,7853,1)
			setPlayerStorageValue(cid,58,1)
			learnSpell(cid,'tubarchakra',0)
			learnSpell(cid,'sugakra',0)
			learnSpell(cid,'akat impulse',0)
			learnSpell(cid,'akatsuki no jutsu',0)
			selfSay('Here is your new habilities.')
			selfSay('tubarchakra, sugakra, akat impulse and akatsuki no jutsu.')
			selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 166.')
			talk_state = 20
			focus = 0
		end
	end

	if talk_state == 13 then
		if msgcontains(msg, 'yes') and talk_state == 13 then
			buy(cid,6227,1,0)
			buy(cid,6272,1,0)
			buy(cid,2195,1,0)
			setPlayerStorageValue(cid,7854,1)
			setPlayerStorageValue(cid,59,1)
			learnSpell(cid,'chidori nagashi',0)
			learnSpell(cid,'cruzadajutsu',0)
			learnSpell(cid,'akat impulse',0)
			learnSpell(cid,'akatsuki no jutsu',0)
			learnSpell(cid,'kazeno tzul',0)
			selfSay('Here is your new habilities.')
			selfSay('chidori nagashi, cruzadajutsu,kazeno tzul, akat impulse and akatsuki no jutsu.')
			selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 163.')
			talk_state = 20
			focus = 0
		end
	end
end
end

function onThink()
if focus > 0 then
	x, y, z = creatureGetPosition(focus)
	myx, myy, myz = selfGetPosition()
		if ((myy-y==0) and (myx-x<=0 and myx-x>=-4)) then
			selfTurn(0)
		end
		if ((myy-y==0) and (myx-x>=0 and myx-x<=4)) then
			selfTurn(2)
		end
		if ((myx-x==0) and (myy-y<=0 and myy-y>=-4)) then
			selfTurn(1)
		end
		if ((myx-x==0) and (myy-y>=0 and myy-y<=4)) then
			selfTurn(3)
		end
		if ((myy-y==-2) and (myx-x>=-1 and myx-x<=1)) then
			selfTurn(1)
		end
		if ((myy-y==2) and (myx-x>=-1 and myx-x<=1)) then
			selfTurn(3)
		end
		if ((myx-x==2) and (myy-y>=-1 and myy-y<=1)) then
			selfTurn(2)
		end
		if ((myx-x==-2) and (myy-y>=-1 and myy-y<=1)) then
			selfTurn(0)
		end
		if ((myy-y==-3) and (myx-x>=-2 and myx-x<=2)) then
			selfTurn(1)
		end
		if ((myy-y==3) and (myx-x>=-2 and myx-x<=2)) then
			selfTurn(3)
		end
		if ((myx-x==3) and (myy-y>=-2 and myy-y<=2)) then
			selfTurn(2)
		end
		if ((myx-x==-3) and (myy-y>=-2 and myy-y<=2)) then
			selfTurn(0)
		end
		if ((myy-y==-4) and (myx-x>=-3 and myx-x<=3)) then
			selfTurn(1)
		end
		if ((myy-y==4) and (myx-x>=-3 and myx-x<=3)) then
			selfTurn(3)
		end
		if ((myx-x==4) and (myy-y>=-3 and myy-y<=3)) then
			selfTurn(2)
		end
		if ((myx-x==-4) and (myy-y>=-3 and myy-y<=3)) then
			selfTurn(0)
		end
	end
	if focus == 0 then
		randmove = math.random(1,50)
		if randmove == 1 then
			selfMove(0)
		end
		if randmove == 2 then
			selfMove(1)
		end
		if randmove == 3 then
			selfMove(2)
		end
		if randmove == 4 then
			selfMove(3)
		end
	end
	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
end

 

se houver algum erro após isso foi falha na programação

 

se quiser o script com os alinhamentos para comparar, segue abaixo

focus = 0
talk_start = 0
target = 0
following = false
attacking = false
talk_state = 20
cname = ''
vocation = 0
mainlevel = 400
gstat = 0 -- guild status
grank = '' -- guild rank
gname = '' -- guild name
pname = '' -- name of some other player
maxnamelen = 30
maxranklen = 20
maxnicklen = 20
leaderlevel = 50
NONE = 0
INVITED = 1
MEMBER = 2
VICE = 3
leader = 4
allow_pattern = '^[a-zA-Z0-9 -]+$'

function onThingMove(creature, thing, oldpos, oldstackpos) end
function onCreatureAppear(creature)						end
function onCreatureTurn(creature)						  end
function onCreatureChangeOutfit(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 onCreatureDisappear(cid, pos)
. if focus == cid then
. . selfSay('Bye.')
. . focus = 0
. . talk_start = 0
. end
end

function onCreatureSay(cid, type, msg)
. cname = creatureGetName(cid)
. msg = string.lower(msg)
. if ((string.find(msg, '(%a*)hi(%a*)')) and (focus == 0)) and getDistanceToCreature(cid) < 4 then
. . if getPlayerSex(cid) == 1 or getPlayerSex(cid) == 2 or getPlayerSex(cid) == 17 or getPlayerSex(cid) == 18 or getPlayerSex(cid) == 19 or getPlayerSex(cid) == 20 then
. . . selfSay('Hello, ' .. creatureGetName(cid) .. '! So, you want to get in the Akatsuki?')
. . . talk_state = 20
. . . focus = cid
. . . talk_start = os.clock()
. . else
. . . selfSay('Sorry, but you alredy chose your position. If not, talk to the Admin.')
. . . talk_state = 20
. . . focus = cid
. . end
. end

. elseif string.find(msg, '(%a*)hi(%a*)') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
. . selfSay('Sorry, ' .. cname .. '! I talk to you in a minute.')

. elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 and focus == cid then
. . selfSay('Cya, ' .. cname .. '!')
. . talk_state = 0
. . focus = 0
. . talk_start = 0
. elseif focus == cid then
. . talk_start = os.clock()
. . if talk_state == 20 and msgcontains(msg, 'yes') then
. . . if getPlayerLevel(cname) >= mainlevel then
. . . . selfSay('Great! tell me what member you want to be?')
. . . . talk_state = 1
. . . else
. . . . selfSay('Sorry, you don\'t have all the requeriments to be one Akatsuki member...')
. . . . selfSay('So, come back when you have level '.. mainlevel ..'.')
. . . . talk_state = 20
. . . end

. . elseif talk_state == 1 then -- telling vilage
. . . talk_state = 2

. . . if msgcontains(msg, 'pain') then
. . . . selfSay('hum, kill the monster named pain and bring to me his rune. if you have the rune say: pain rune')
. . . . talk_state = 2


. . . elseif msgcontains(msg, 'konan') then
. . . . selfSay('hum, kill the monster named konan and bring to me his rune. if you have the rune say: konan rune')
. . . . talk_state = 2

. . . elseif msgcontains(msg, 'hidan') then
. . . . selfSay('hum, kill the monster named hidan and bring to me his rune. if you have the rune say: hidan rune')
. . . . talk_state = 2

. . . elseif msgcontains(msg, 'tobi') then
. . . . selfSay('hum, kill the monster named tobi and bring to me his rune. if you have the rune say: tobi rune')
. . . . talk_state = 2

. . . elseif msgcontains(msg, 'zetsu') then
. . . . selfSay('hum, kill the monster named zetsu and bring to me his rune. if you have the rune say zetsu rune')
. . . . talk_state = 2

. . . elseif msgcontains(msg, 'sasori') then
. . . . selfSay('hum, kill the monster named sasori and bring to me his rune. if you have the rune say sasori rune')
. . . . talk_state = 2

. . . elseif msgcontains(msg, 'deidara') then
. . . . selfSay('hum, kill the monster named deidara and bring to me his rune. if you have the rune say deidara rune')
. . . . talk_state = 2

. . . elseif msgcontains(msg, 'itachi') then
. . . . selfSay('hum, kill the monster named itachi and bring to me his rune. if you have the rune say itachi rune')
. . . . talk_state = 2

. . . elseif msgcontains(msg, 'kisame') then
. . . . selfSay('hum, kill the monster named kisame and bring to me his rune. if you have the rune say kisame rune')
. . . . talk_state = 2

. . . elseif msgcontains(msg, 'kakuzu') then
. . . . selfSay('hum, kill the monster named kakuzu and bring to me his rune. if you have the rune say kakuzu rune')
. . . . talk_state = 2

. . . else
. . . . selfSay('Sorry, this member does not exist')
. . . . vocation = 3
. . . . talk_state = 1
. . . end

. . elseif talk_state == 2 then -- telling vilage
. . . if msgcontains(msg, 'pain rune') then
. . . . selfSay('Very good, let me take the rune! are you sure?')
. . . . itemstatus = doPlayerRemoveItem(cid,2294)
. . . . talk_state = 4

. . . elseif msgcontains(msg, 'konan rune') then
. . . . selfSay('Very good, let me take the rune! are you sure?')
. . . . itemstatus = doPlayerRemoveItem(cid,2295)
. . . . talk_state = 6

. . . elseif msgcontains(msg, 'hidan rune') then
. . . . selfSay('Right your son of the b---! are you sure?')
. . . . itemstatus = doPlayerRemoveItem(cid,2296)
. . . . talk_state = 7

. . . elseif msgcontains(msg, 'tobi rune') then
. . . . selfSay('I\'m with hunger, get out of here! are you sure?')
. . . . itemstatus = doPlayerRemoveItem(cid,2297)
. . . . talk_state = 5

. . . elseif msgcontains(msg, 'zetsu rune') then
. . . . selfSay('Get out of here! are you sure?')
. . . . itemstatus = doPlayerRemoveItem(cid,2299)
. . . . talk_state = 8

. . . elseif msgcontains(msg, 'sasori rune') then
. . . . selfSay('Oh my God! You\'ll be and master killer! are you sure')
. . . . itemstatus = doPlayerRemoveItem(cid,2299)
. . . . talk_state = 9

. . . elseif msgcontains(msg, 'deidara rune') then
. . . . selfSay('Hmm, i going put fire in your ass! get out of here! are you sure?')
. . . . itemstatus = doPlayerRemoveItem(cid,2304)
. . . . talk_state = 10

. . . elseif msgcontains(msg, 'itachi rune') then
. . . . selfSay('Humm, Mangekyou Sharingan! don\'t worry i\'m just kidding! are you sure?')
. . . . itemstatus = doPlayerRemoveItem(cid,2306)
. . . . talk_state = 11

. . . elseif msgcontains(msg, 'kisame rune') then
. . . . selfSay('Humm... are you sure?')
. . . . itemstatus = doPlayerRemoveItem(cid,2309)
. . . . talk_state = 12

. . . elseif msgcontains(msg, 'kakuzu rune') then
. . . . selfSay('! are you sure?')
. . . . itemstatus = doPlayerRemoveItem(cid,2312)
. . . . talk_state = 13

. . . else
. . . . selfSay('Sorry, this clan does not exists.')
. . . . vocation = 0
. . . . talk_state = 2
. . . end


. . elseif talk_state == 4 then -- confirming vocation
. . . if msgcontains(msg, 'yes') and talk_state == 4 then
. . . . buy(cid,6227,1,0)
. . . . buy(cid,6272,1,0)
. . . . buy(cid,2195,1,0)
. . . . setPlayerStorageValue(cid,7845,1)
. . . . setPlayerStorageValue(cid,50,1)
. . . . learnSpell(cid,'mar de areia',0)
. . . . learnSpell(cid,'akatsuki final rinnegan no jutsu',0)
. . . . learnSpell(cid,'akat impulse',0)
. . . . learnSpell(cid,'akatsuki no jutsu',0)
. . . . learnSpell(cid,'rinnegan',0)
. . . . selfSay('Here is your new habilities.')
. . . . selfSay('mar de areia, akatsuki final rinnegan no jutsu, akat impulse, akatsuki no jutsu and rinnegan.')
. . . . selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 161')
. . . . talk_state = 20
. . . . focus = 0
. . . end
. . end

. . if talk_state == 5 then
. . . if msgcontains(msg, 'yes') and talk_state == 5 then
. . . . buy(cid,6227,1,0)
. . . . buy(cid,6272,1,0)
. . . . buy(cid,2195,1,0)
. . . . setPlayerStorageValue(cid,7846,1)
. . . . setPlayerStorageValue(cid,51,1)
. . . . learnSpell(cid,'dragao de chakra',0)
. . . . learnSpell(cid,'suiton tsunami no jutsu',0)
. . . . learnSpell(cid,'akat impulse',0)
. . . . learnSpell(cid,'akatsuki no jutsu',0)
. . . . selfSay('Here is your new habilities.')
. . . . selfSay('dragao de chakra, suiton tsunami no jutsu, akat impulse and akatsuki no jutsu.')
. . . . selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 168')
. . . . talk_state = 20
. . . . focus = 0
. . . end
. . end

. . if talk_state == 6 then
. . . if msgcontains(msg, 'yes') and talk_state == 6 then
. . . . buy(cid,6227,1,0)
. . . . buy(cid,6272,1,0)
. . . . buy(cid,2195,1,0)
. . . . setPlayerStorageValue(cid,7847,1)
. . . . setPlayerStorageValue(cid,52,1)
. . . . selfSay('Here is your new habilities.')
. . . . selfSay('ritual jashin, sugakra, akat impulse and akatsuki no jutsu.')
. . . . selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 170')
. . . . learnSpell(cid,'ritual jashin',0)
. . . . learnSpell(cid,'akat impulse',0)
. . . . learnSpell(cid,'akatsuki no jutsu',0)
. . . . learnSpell(cid,'sugakra',0)
. . . . talk_state = 20
. . . . focus = 0
. . . end
. . end

. . if talk_state == 7 then
. . . if msgcontains(msg, 'yes') and talk_state == 7 then
. . . . buy(cid,6227,1,0)
. . . . buy(cid,6272,1,0)
. . . . buy(cid,2195,1,0)
. . . . setPlayerStorageValue(cid,7848,1)
. . . . setPlayerStorageValue(cid,53,1)
. . . . selfSay('Here is your new habilities.')
. . . . selfSay('amaterasu, katon karyuudan, mangekyou sharingan, akat impulse and akatsuki no jutsu.')
. . . . selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 164')
. . . . learnSpell(cid,'amaterasu',0)
. . . . learnSpell(cid,'katon karyuudan',0)
. . . . learnSpell(cid,'akat impulse',0)
. . . . learnSpell(cid,'akatsuki no jutsu',0)
. . . . learnSpell(cid,'mangekyou sharingan',0)
. . . . talk_state = 20
. . . . focus = 0
. . . end
. . end

. . if talk_state == 8 then
. . . if msgcontains(msg, 'yes') and talk_state == 8 then
. . . . buy(cid,6227,1,0)
. . . . buy(cid,6272,1,0)
. . . . buy(cid,2195,1,0)
. . . . setPlayerStorageValue(cid,7849,1)
. . . . setPlayerStorageValue(cid,54,1)
. . . . learnSpell(cid,'camuflate',0)
. . . . learnSpell(cid,'zetsu gan no jutsu',0)
. . . . learnSpell(cid,'akat impulse',0)
. . . . learnSpell(cid,'akatsuki no jutsu',0)
. . . . learnSpell(cid,'corda de mil metros',0)
. . . . selfSay('Here is your new habilities.')
. . . . selfSay('camuflate, zetsu gan no jutsu, corda de mil metros, akat impulse and akatsuki no jutsu.')
. . . . selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 169.')
. . . . talk_state = 20
. . . . focus = 0
. . . end
. . end

. . if talk_state == 9 then
. . . if msgcontains(msg, 'yes') and talk_state == 9 then
. . . . buy(cid,6227,1,0)
. . . . buy(cid,6272,1,0)
. . . . buy(cid,2195,1,0)
. . . . setPlayerStorageValue(cid,7850,1)
. . . . setPlayerStorageValue(cid,55,1)
. . . . learnSpell(cid,'akat impulse',0)
. . . . learnSpell(cid,'akatsuki no jutsu',0)
. . . . learnSpell(cid,'sabaku sousou',0)
. . . . learnSpell(cid,'corda de mil metros',0)
. . . . selfSay('Here is your new habilities.')
. . . . selfSay('sabaku sousou, corda de mil metros, akat impulse and akatsuki no jutsu.')
. . . . selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 162.')
. . . . talk_state = 20
. . . . focus = 0
. . . end
. . end

. . if talk_state == 10 then
. . . if msgcontains(msg, 'yes') and talk_state == 10 then
. . . . buy(cid,6227,1,0)
. . . . buy(cid,6272,1,0)
. . . . buy(cid,2195,1,0)
. . . . setPlayerStorageValue(cid,7851,1)
. . . . setPlayerStorageValue(cid,56,1)
. . . . learnSpell(cid,'big explosion',0)
. . . . learnSpell(cid,'katsu',0)
. . . . learnSpell(cid,'akat impulse',0)
. . . . learnSpell(cid,'akatsuki no jutsu',0)
. . . . selfSay('big explosion, katsu, akat impulse and akatsuki no jutsu.')
. . . . selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 165.')
. . . . talk_state = 20
. . . . focus = 0
. . . end
. . end

. . if talk_state == 11 then
. . . if msgcontains(msg, 'yes') and talk_state == 11 then
. . . . buy(cid,6227,1,0)
. . . . buy(cid,6272,1,0)
. . . . buy(cid,2195,1,0)
. . . . setPlayerStorageValue(cid,7852,1)
. . . . setPlayerStorageValue(cid,57,1)
. . . . learnSpell(cid,'amaterasu',0)
. . . . learnSpell(cid,'katon karyuudan',0)
. . . . learnSpell(cid,'akat impulse',0)
. . . . learnSpell(cid,'akatsuki no jutsu',0)
. . . . learnSpell(cid,'mangekyou sharingan',0)
. . . . selfSay('Here is your new habilities.')
. . . . selfSay('amaterasu, katon karyuudan, mangekyou sharingan, akat impulse and akatsuki no jutsu.')
. . . . selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 167.')
. . . . talk_state = 20
. . . . focus = 0
. . . end
. . end

. . if talk_state == 12 then
. . . if msgcontains(msg, 'yes') and talk_state == 12 then
. . . . buy(cid,6227,1,0)
. . . . buy(cid,6272,1,0)
. . . . buy(cid,2195,1,0)
. . . . setPlayerStorageValue(cid,7853,1)
. . . . setPlayerStorageValue(cid,58,1)
. . . . learnSpell(cid,'tubarchakra',0)
. . . . learnSpell(cid,'sugakra',0)
. . . . learnSpell(cid,'akat impulse',0)
. . . . learnSpell(cid,'akatsuki no jutsu',0)
. . . . selfSay('Here is your new habilities.')
. . . . selfSay('tubarchakra, sugakra, akat impulse and akatsuki no jutsu.')
. . . . selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 166.')
. . . . talk_state = 20
. . . . focus = 0
. . . end
. . end

. . if talk_state == 13 then
. . . if msgcontains(msg, 'yes') and talk_state == 13 then
. . . . buy(cid,6227,1,0)
. . . . buy(cid,6272,1,0)
. . . . buy(cid,2195,1,0)
. . . . setPlayerStorageValue(cid,7854,1)
. . . . setPlayerStorageValue(cid,59,1)
. . . . learnSpell(cid,'chidori nagashi',0)
. . . . learnSpell(cid,'cruzadajutsu',0)
. . . . learnSpell(cid,'akat impulse',0)
. . . . learnSpell(cid,'akatsuki no jutsu',0)
. . . . learnSpell(cid,'kazeno tzul',0)
. . . . selfSay('Here is your new habilities.')
. . . . selfSay('chidori nagashi, cruzadajutsu,kazeno tzul, akat impulse and akatsuki no jutsu.')
. . . . selfSay('/makesay ' .. creatureGetName(cid) .. ',!cmot3416 163.')
. . . . talk_state = 20
. . . . focus = 0
. . . end
. . end
. end
end

function onThink()
. if focus > 0 then
. . x, y, z = creatureGetPosition(focus)
. . myx, myy, myz = selfGetPosition()
. . . if ((myy-y==0) and (myx-x<=0 and myx-x>=-4)) then
. . . . selfTurn(0)
. . . end
. . . if ((myy-y==0) and (myx-x>=0 and myx-x<=4)) then
. . . . selfTurn(2)
. . . end
. . . if ((myx-x==0) and (myy-y<=0 and myy-y>=-4)) then
. . . . selfTurn(1)
. . . end
. . . if ((myx-x==0) and (myy-y>=0 and myy-y<=4)) then
. . . . selfTurn(3)
. . . end
. . . if ((myy-y==-2) and (myx-x>=-1 and myx-x<=1)) then
. . . . selfTurn(1)
. . . end
. . . if ((myy-y==2) and (myx-x>=-1 and myx-x<=1)) then
. . . . selfTurn(3)
. . . end
. . . if ((myx-x==2) and (myy-y>=-1 and myy-y<=1)) then
. . . . selfTurn(2)
. . . end
. . . if ((myx-x==-2) and (myy-y>=-1 and myy-y<=1)) then
. . . . selfTurn(0)
. . . end
. . . if ((myy-y==-3) and (myx-x>=-2 and myx-x<=2)) then
. . . . selfTurn(1)
. . . end
. . . if ((myy-y==3) and (myx-x>=-2 and myx-x<=2)) then
. . . . selfTurn(3)
. . . end
. . . if ((myx-x==3) and (myy-y>=-2 and myy-y<=2)) then
. . . . selfTurn(2)
. . . end
. . . if ((myx-x==-3) and (myy-y>=-2 and myy-y<=2)) then
. . . . selfTurn(0)
. . . end
. . . if ((myy-y==-4) and (myx-x>=-3 and myx-x<=3)) then
. . . . selfTurn(1)
. . . end
. . . if ((myy-y==4) and (myx-x>=-3 and myx-x<=3)) then
. . . . selfTurn(3)
. . . end
. . . if ((myx-x==4) and (myy-y>=-3 and myy-y<=3)) then
. . . . selfTurn(2)
. . . end
. . . if ((myx-x==-4) and (myy-y>=-3 and myy-y<=3)) then
. . . . selfTurn(0)
. . . end
. . end
. . if focus == 0 then
. . . randmove = math.random(1,50)
. . . if randmove == 1 then
. . . . selfMove(0)
. . . end
. . . if randmove == 2 then
. . . . selfMove(1)
. . . end
. . . if randmove == 3 then
. . . . selfMove(2)
. . . end
. . . if randmove == 4 then
. . . . selfMove(3)
. . . end
. . end
. . 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
end

 

versão 'compacta' do script:

npcVars = {focus = 0,talk_start = 0,talk_state = 20,cname = '',mainLevel = 400,foundMember = 0,removeRuneId = 0}
allowedSex = {1,2,17,18,19,20}
memberList = {'pain','konan','hidan','tobi','zetsu','sasori','deidara','itachi','kisame','kakuzu'}
vocationsCmot = {[4] = 161,[5] = 168,[6] = 170,[7] = 164,[8] = 169,[9] = 162,[10] = 165,[11] = 167,[12] = 166,[13] = 163}
itemList = {6227,6272,2195}
baseStorages = {7841,46}
takeRuneList = {
{'pain rune',2294,4},
{'konan rune',2295,6},
{'hidan rune',2296,7},
{'tobi rune',2297,5},
{'zetsu rune',2298,8},
{'sasori rune',2299,9},
{'deidara rune',2304,10},
{'itachi rune',2306,11},
{'kisame rune',2309,12},
{'kakuzu rune',2312,13},
}
vocationsSkills = {
  [4] = { 'mar de areia','akatsuki final rinnegan no jutsu',akat impulse','akatsuki no jutsu','rinnegan'},
  [5] = { 'dragao de chakra','suiton tsunami no jutsu','akat impulse','akatsuki no jutsu'},
  [6] = { 'ritual jashin','akat impulse','akatsuki no jutsu','sugakra'},
  [7] = { 'amaterasu','katon karyuudan','akat impulse','akatsuki no jutsu','mangekyou sharingan'},
  [8] = { 'camuflate','zetsu gan no jutsu','akat impulse','akatsuki no jutsu','corda de mil metros'},
  [9] = { 'akat impulse','akatsuki no jutsu','sabaku sousou','corda de mil metros'},
  [10] = { 'big explosion','katsu','akat impulse','akatsuki no jutsu'},
  [11] = { 'amaterasu','katon karyuudan','akat impulse','akatsuki no jutsu','mangekyou sharingan'},
  [12] = { 'tubarchakra','sugakra','akat impulse','akatsuki no jutsu'},
  [13] = { 'chidori nagashi','cruzadajutsu','akat impulse','akatsuki no jutsu','kazeno tzul'}
}

function onThingMove(creature, thing, oldpos, oldstackpos) end
function onCreatureAppear(creature)						end
function onCreatureTurn(creature)						  end
function onCreatureChangeOutfit(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 isInArray(t,v) if type(t) == "table" and v then for k,var in pairs(t) do if var == v then return 1 end end end end

function onCreatureDisappear(cid, pos)
  if npcVars.focus == cid then
  selfSay('Bye.')
  npcVars.focus = 0
  npcVars.talk_start = 0
  end
end

function onCreatureSay(cid, type, msg)
  npcVars.cname = creatureGetName(cid)
  msg = string.lower(msg)
  if ((string.find(msg, '(%a*)hi(%a*)')) and (npcVars.focus == 0)) and getDistanceToCreature(cid) < 4 then
  if isInArray(allowedSex,getPlayerSex(cid)) then
	 selfSay('Hello, ' .. npcVars.cname .. '! So, you want to get in the Akatsuki?')
	 npcVars.talk_state = 20
	 npcVars.focus = cid
	 npcVars.talk_start = os.clock()
  else
	 selfSay('Sorry, but you alredy chose your position. If not, talk to the Admin.')
	 npcVars.talk_state = 20
	 npcVars.focus = cid
  end
  end

  elseif string.find(msg, '(%a*)hi(%a*)') and (npcVars.focus ~= cid) and getDistanceToCreature(cid) < 4 then
  selfSay('Sorry, ' .. npcVars.cname .. '! I talk to you in a minute.')

  elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 and npcVars.focus == cid then
  selfSay('Cya, ' .. npcVars.cname .. '!')
  npcVars.talk_state = 0
  npcVars.focus = 0
  npcVars.talk_start = 0
  elseif npcVars.focus == cid then
  npcVars.talk_start = os.clock()
  if npcVars.talk_state == 20 and msgcontains(msg, 'yes') then
	 if getPlayerLevel(npcVars.cname) >= npcVars.mainLevel then
		selfSay('Great! tell me what member you want to be?')
		npcVars.talk_state = 1
	 else
		selfSay('Sorry, you don\'t have all the requeriments to be one Akatsuki member...')
		selfSay('So, come back when you have level '.. npcVars.mainLevel ..'.')
		npcVars.talk_state = 20
	 end

  elseif npcVars.talk_state == 1 then
	 npcVars.talk_state = 2
	 for i=1,#memberList do 
		if msgcontains(msg, memberList[i]) then
		   selfSay('hum, kill the monster named '..memberList[i]..' and bring to me his rune. if you have the rune say: '..memberList[i]..' rune')
		   npcVars.foundMember = 1
		end
	 end
	 if npcVars.foundMember == 0 then
		selfSay('Sorry, this member does not exist')
		npcVars.talk_state = 1
	 end

  elseif npcVars.talk_state == 2 then
	 npcVars.foundMember = 0
	 for i=1,#takeRuneList do
		if msgcontains(msg, takeRuneList[i][1]) then
		   selfSay('Very good, let me take the rune! are you sure?')
		   npcVars.removeRuneId = takeRuneList[i][2]
		   npcVars.talk_state = takeRuneList[i][3]
		   npcVars.foundMember = 1
		end
	 end
	 if npcVars.foundMember == 0 then
		selfSay('Sorry, this clan does not exists.')
		npcVars.talk_state = 2
	 end

  elseif 
	 (npcVars.talk_state > 3) and
	 (npcVars.talk_state < 14) and
	 (msgcontains(msg,'yes')) and
	 (doPlayerRemoveItem(cid,npcVars.removeRuneId)) then
	 makeMyVocation(npcVars.talk_state)
  end
  end
end


function makeMyVocation(voc)
  for i=1,3 do buy(cid,itemList[i],1,0) end
  for i=1,2 do setPlayerStorageValue(cid,baseStorages[i]+voc,1) end
  mySpells = vocationSpells[voc]
  spellList = mySpells[1]
  for i=1,5 do
  learnSpell(cid,mySpells[i],0)
  if i> 1 then spellList = spellList..', '..mySpells[i]
  end
  selfSay('Here is your new habilities.')
  selfSay(spellList..'.')
  selfSay('/makesay ' .. npcVars.cname .. ',!cmot3416 '..vocationsCmot[voc])
  npcVars.talk_state = 20
  npcVars.focus = 0
  end
end

function onThink()
  if npcVars.focus > 0 then
  x, y, z = creatureGetPosition(npcVars.focus)
  myx, myy, myz = selfGetPosition()
  if ((myy-y==0) and (myx-x<=0 and myx-x>=-4)) then selfTurn(0)
  elseif ((myy-y==0) and (myx-x>=0 and myx-x<=4)) then selfTurn(2)
  elseif ((myx-x==0) and (myy-y<=0 and myy-y>=-4)) then selfTurn(1)
  elseif ((myx-x==0) and (myy-y>=0 and myy-y<=4)) then selfTurn(3)
  elseif ((myy-y==-2) and (myx-x>=-1 and myx-x<=1)) then selfTurn(1)
  elseif ((myy-y==2) and (myx-x>=-1 and myx-x<=1)) then selfTurn(3)
  elseif ((myx-x==2) and (myy-y>=-1 and myy-y<=1)) then selfTurn(2)
  elseif ((myx-x==-2) and (myy-y>=-1 and myy-y<=1)) then selfTurn(0)
  elseif ((myy-y==-3) and (myx-x>=-2 and myx-x<=2)) then selfTurn(1)
  elseif ((myy-y==3) and (myx-x>=-2 and myx-x<=2)) then selfTurn(3)
  elseif ((myx-x==3) and (myy-y>=-2 and myy-y<=2)) then selfTurn(2)
  elseif ((myx-x==-3) and (myy-y>=-2 and myy-y<=2)) then selfTurn(0)
  elseif ((myy-y==-4) and (myx-x>=-3 and myx-x<=3)) then selfTurn(1)
  elseif ((myy-y==4) and (myx-x>=-3 and myx-x<=3)) then selfTurn(3)
  elseif ((myx-x==4) and (myy-y>=-3 and myy-y<=3)) then selfTurn(2)
  elseif ((myx-x==-4) and (myy-y>=-3 and myy-y<=3)) then selfTurn(0)
  end
  end
  if npcVars.focus == 0 then selfMove(math.random(0,4)) end
  if (os.clock() - npcVars.talk_start) > 45 then
  if npcVars.focus > 0 then
  selfSay('Next Please...')
  npcVars.focus = 0
  end
  if npcVars.focus ~= 0 and getDistanceToCreature(npcVars.focus) > 5 then 
  selfSay('Good bye then.')
  npcVars.focus = 0
  end
end

Editado por brainless
Link para o comentário
Compartilhar em outros sites

xii então nm vo mais fazer o npc do tipo que pega os itens em troca de voc, pq aki os dois deram erro :/

então vlws ae toda a ajuda cara.

 

Duvida sanada podem fechar o topico.

Link para o comentário
Compartilhar em outros sites

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