Ir para conteúdo

[Encerrado] NPC BUGANDO


RAJADAO

Posts Recomendados

BOA NOITE, estou com o seguinte erro no meu npc que vende bps de runas, ja tentei mas nao resolve, aparece o seguinte erro nos logs:

Se alguém souber o que fazer, ajudaria muito, obrigado.

Segue anexo o script 

 

[Error - LuaInterface::loadFile] data/npc/scripts/runenpc.lua:194: 'end' expected (to close 'if' at line 161) near '' 
[Warning - NpcEvents::NpcEvents] Cannot load script: data/npc/scripts/runenpc.lua 
data/npc/scripts/runenpc.lua:194: 'end' expected (to close 'if' at line 161) near '' 

runenpc.lua

Link para o comentário
Compartilhar em outros sites

Tenta assim 

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
function onCreatureAppear(cid)				npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) 			npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) 	npcHandler:onCreatureSay(cid, type, msg) end
function onThink() 						npcHandler:onThink() end
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

if msgcontains(msg, 'bp of ultimate healing') then
	npcHandler:say('Do you want to buy a backpack of ultimate healing rune for 3000 gold coins?')
	talk_state = 1
	
		elseif msgcontains(msg, 'yes') and talk_state == 1 then
			if getPlayerMoney(cid) >= 3000 then
				blue_bp = doPlayerAddItem(cid, 2002, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doPlayerRemoveMoney(cid, 3000)
				npcHandler:say('Thank you for buying.')
				talk_state = 0
			else
				npcHandler:say('You don\'t have enough money.')
				talk_state = 0
			end
	end
	
if msgcontains(msg, 'bp of sudden death') then
	npcHandler:say('Do you want to buy a backpack of sudden death rune for 6000 gold coins?')
	talk_state = 2
	
		elseif msgcontains(msg, 'yes') and talk_state == 2 then
			if getPlayerMoney(cid) >= 5500 then
				grey_bp = doPlayerAddItem(cid, 2003, 1)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doPlayerRemoveMoney(cid, 5500)
				npcHandler:say('Thank you for buying.')
				talk_state = 0
			else
				npcHandler:say('You don\'t have enough money.')
				talk_state = 0
			end
	end	
	
if msgcontains(msg, 'bp of heavy magic missile') then
	npcHandler:say('Do you want to buy a backpack of heavy magic missile rune for 2000 gold coins?')
	talk_state = 3
	
		elseif msgcontains(msg, 'yes') and talk_state == 3 then
			if getPlayerMoney(cid) >= 2000 then
				purple1_bp = doPlayerAddItem(cid, 2001, 1)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doPlayerRemoveMoney(cid, 2000)
				npcHandler:say('Thank you for buying.')
				talk_state = 0
			else
				npcHandler:say('You don\'t have enough money.')
				talk_state = 0
			end
	end

if msgcontains(msg, 'bp of great fireball') then
	npcHandler:say('Do you want to buy a backpack of great fireball rune for 3000 gold coins?')
	talk_state = 4
	
		elseif msgcontains(msg, 'yes') and talk_state == 4 then
			if getPlayerMoney(cid) >= 3000 then
				red_bp = doPlayerAddItem(cid, 2000, 1)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doPlayerRemoveMoney(cid, 3000)
				npcHandler:say('Thank you for buying.')
				talk_state = 0
			else
				npcHandler:say('You don\'t have enough money.')
				talk_state = 0
			end
	end

if msgcontains(msg, 'bp of explosion') or msgcontains(msg, 'bp of explo') then
	npcHandler:say('Do you want to buy a backpack of explosion rune for 4000 gold coins?')
	talk_state = 5
	
		elseif msgcontains(msg, 'yes') and talk_state == 5 then
			if getPlayerMoney(cid) >= 4000 then
				purple2_bp = doPlayerAddItem(cid, 2001, 1)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doPlayerRemoveMoney(cid, 4000)
				npcHandler:say('Thank you for buying.')
				talk_state = 0
			else
				npcHandler:say('You don\'t have enough money.')
				talk_state = 0
			end
			end
			

 

Link para o comentário
Compartilhar em outros sites

3 horas atrás, Bennyyw disse:

Tenta assim 


local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
function onCreatureAppear(cid)				npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) 			npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) 	npcHandler:onCreatureSay(cid, type, msg) end
function onThink() 						npcHandler:onThink() end
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

if msgcontains(msg, 'bp of ultimate healing') then
	npcHandler:say('Do you want to buy a backpack of ultimate healing rune for 3000 gold coins?')
	talk_state = 1
	
		elseif msgcontains(msg, 'yes') and talk_state == 1 then
			if getPlayerMoney(cid) >= 3000 then
				blue_bp = doPlayerAddItem(cid, 2002, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doAddContainerItem(blue_bp, 2273, 1)
				doPlayerRemoveMoney(cid, 3000)
				npcHandler:say('Thank you for buying.')
				talk_state = 0
			else
				npcHandler:say('You don\'t have enough money.')
				talk_state = 0
			end
	end
	
if msgcontains(msg, 'bp of sudden death') then
	npcHandler:say('Do you want to buy a backpack of sudden death rune for 6000 gold coins?')
	talk_state = 2
	
		elseif msgcontains(msg, 'yes') and talk_state == 2 then
			if getPlayerMoney(cid) >= 5500 then
				grey_bp = doPlayerAddItem(cid, 2003, 1)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doAddContainerItem(grey_bp, 2268, 3)
				doPlayerRemoveMoney(cid, 5500)
				npcHandler:say('Thank you for buying.')
				talk_state = 0
			else
				npcHandler:say('You don\'t have enough money.')
				talk_state = 0
			end
	end	
	
if msgcontains(msg, 'bp of heavy magic missile') then
	npcHandler:say('Do you want to buy a backpack of heavy magic missile rune for 2000 gold coins?')
	talk_state = 3
	
		elseif msgcontains(msg, 'yes') and talk_state == 3 then
			if getPlayerMoney(cid) >= 2000 then
				purple1_bp = doPlayerAddItem(cid, 2001, 1)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doAddContainerItem(purple1_bp, 2311, 5)
				doPlayerRemoveMoney(cid, 2000)
				npcHandler:say('Thank you for buying.')
				talk_state = 0
			else
				npcHandler:say('You don\'t have enough money.')
				talk_state = 0
			end
	end

if msgcontains(msg, 'bp of great fireball') then
	npcHandler:say('Do you want to buy a backpack of great fireball rune for 3000 gold coins?')
	talk_state = 4
	
		elseif msgcontains(msg, 'yes') and talk_state == 4 then
			if getPlayerMoney(cid) >= 3000 then
				red_bp = doPlayerAddItem(cid, 2000, 1)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doAddContainerItem(red_bp, 2304, 4)
				doPlayerRemoveMoney(cid, 3000)
				npcHandler:say('Thank you for buying.')
				talk_state = 0
			else
				npcHandler:say('You don\'t have enough money.')
				talk_state = 0
			end
	end

if msgcontains(msg, 'bp of explosion') or msgcontains(msg, 'bp of explo') then
	npcHandler:say('Do you want to buy a backpack of explosion rune for 4000 gold coins?')
	talk_state = 5
	
		elseif msgcontains(msg, 'yes') and talk_state == 5 then
			if getPlayerMoney(cid) >= 4000 then
				purple2_bp = doPlayerAddItem(cid, 2001, 1)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doAddContainerItem(purple2_bp, 2313, 3)
				doPlayerRemoveMoney(cid, 4000)
				npcHandler:say('Thank you for buying.')
				talk_state = 0
			else
				npcHandler:say('You don\'t have enough money.')
				talk_state = 0
			end
			end
			

 

Agora deu esse erro mano:


[Error - LuaInterface::loadFile] data/npc/scripts/runenpc.lua:196: 'end' expected (to close 'function' at line 12) near '' 
[Warning - NpcEvents::NpcEvents] Cannot load script: data/npc/scripts/runenpc.lua 
data/npc/scripts/runenpc.lua:196: 'end' expected (to close 'function' at line 12) near '' 

Link para o comentário
Compartilhar em outros sites

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
function onCreatureAppear(cid)                npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)             npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)     npcHandler:onCreatureSay(cid, type, msg) end
function onThink()                         npcHandler:onThink() end
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end

if msgcontains(msg, 'bp of ultimate healing') then
    npcHandler:say('Do you want to buy a backpack of ultimate healing rune for 3000 gold coins?')
    talk_state = 1
    
        elseif msgcontains(msg, 'yes') and talk_state == 1 then
            if getPlayerMoney(cid) >= 3000 then
                blue_bp = doPlayerAddItem(cid, 2002, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doPlayerRemoveMoney(cid, 3000)
                npcHandler:say('Thank you for buying.')
                talk_state = 0
            else
                npcHandler:say('You don\'t have enough money.')
                talk_state = 0
            end
    end
    
if msgcontains(msg, 'bp of sudden death') then
    npcHandler:say('Do you want to buy a backpack of sudden death rune for 6000 gold coins?')
    talk_state = 2
    
        elseif msgcontains(msg, 'yes') and talk_state == 2 then
            if getPlayerMoney(cid) >= 5500 then
                grey_bp = doPlayerAddItem(cid, 2003, 1)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doPlayerRemoveMoney(cid, 5500)
                npcHandler:say('Thank you for buying.')
                talk_state = 0
            else
                npcHandler:say('You don\'t have enough money.')
                talk_state = 0
            end
    end    
    
if msgcontains(msg, 'bp of heavy magic missile') then
    npcHandler:say('Do you want to buy a backpack of heavy magic missile rune for 2000 gold coins?')
    talk_state = 3
    
        elseif msgcontains(msg, 'yes') and talk_state == 3 then
            if getPlayerMoney(cid) >= 2000 then
                purple1_bp = doPlayerAddItem(cid, 2001, 1)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doPlayerRemoveMoney(cid, 2000)
                npcHandler:say('Thank you for buying.')
                talk_state = 0
            else
                npcHandler:say('You don\'t have enough money.')
                talk_state = 0
            end
    end

if msgcontains(msg, 'bp of great fireball') then
    npcHandler:say('Do you want to buy a backpack of great fireball rune for 3000 gold coins?')
    talk_state = 4
    
        elseif msgcontains(msg, 'yes') and talk_state == 4 then
            if getPlayerMoney(cid) >= 3000 then
                red_bp = doPlayerAddItem(cid, 2000, 1)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doPlayerRemoveMoney(cid, 3000)
                npcHandler:say('Thank you for buying.')
                talk_state = 0
            else
                npcHandler:say('You don\'t have enough money.')
                talk_state = 0
            end
    end

if msgcontains(msg, 'bp of explosion') or msgcontains(msg, 'bp of explo') then
    npcHandler:say('Do you want to buy a backpack of explosion rune for 4000 gold coins?')
    talk_state = 5
    
        elseif msgcontains(msg, 'yes') and talk_state == 5 then
            if getPlayerMoney(cid) >= 4000 then
                purple2_bp = doPlayerAddItem(cid, 2001, 1)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doPlayerRemoveMoney(cid, 4000)
                npcHandler:say('Thank you for buying.')
                talk_state = 0
            else
                npcHandler:say('You don\'t have enough money.')
                talk_state = 0
            end
            end
    end        

 

Link para o comentário
Compartilhar em outros sites

8 horas atrás, Bennyyw disse:

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
function onCreatureAppear(cid)                npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)             npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)     npcHandler:onCreatureSay(cid, type, msg) end
function onThink()                         npcHandler:onThink() end
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end

if msgcontains(msg, 'bp of ultimate healing') then
    npcHandler:say('Do you want to buy a backpack of ultimate healing rune for 3000 gold coins?')
    talk_state = 1
    
        elseif msgcontains(msg, 'yes') and talk_state == 1 then
            if getPlayerMoney(cid) >= 3000 then
                blue_bp = doPlayerAddItem(cid, 2002, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doAddContainerItem(blue_bp, 2273, 1)
                doPlayerRemoveMoney(cid, 3000)
                npcHandler:say('Thank you for buying.')
                talk_state = 0
            else
                npcHandler:say('You don\'t have enough money.')
                talk_state = 0
            end
    end
    
if msgcontains(msg, 'bp of sudden death') then
    npcHandler:say('Do you want to buy a backpack of sudden death rune for 6000 gold coins?')
    talk_state = 2
    
        elseif msgcontains(msg, 'yes') and talk_state == 2 then
            if getPlayerMoney(cid) >= 5500 then
                grey_bp = doPlayerAddItem(cid, 2003, 1)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doAddContainerItem(grey_bp, 2268, 3)
                doPlayerRemoveMoney(cid, 5500)
                npcHandler:say('Thank you for buying.')
                talk_state = 0
            else
                npcHandler:say('You don\'t have enough money.')
                talk_state = 0
            end
    end    
    
if msgcontains(msg, 'bp of heavy magic missile') then
    npcHandler:say('Do you want to buy a backpack of heavy magic missile rune for 2000 gold coins?')
    talk_state = 3
    
        elseif msgcontains(msg, 'yes') and talk_state == 3 then
            if getPlayerMoney(cid) >= 2000 then
                purple1_bp = doPlayerAddItem(cid, 2001, 1)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doAddContainerItem(purple1_bp, 2311, 5)
                doPlayerRemoveMoney(cid, 2000)
                npcHandler:say('Thank you for buying.')
                talk_state = 0
            else
                npcHandler:say('You don\'t have enough money.')
                talk_state = 0
            end
    end

if msgcontains(msg, 'bp of great fireball') then
    npcHandler:say('Do you want to buy a backpack of great fireball rune for 3000 gold coins?')
    talk_state = 4
    
        elseif msgcontains(msg, 'yes') and talk_state == 4 then
            if getPlayerMoney(cid) >= 3000 then
                red_bp = doPlayerAddItem(cid, 2000, 1)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doAddContainerItem(red_bp, 2304, 4)
                doPlayerRemoveMoney(cid, 3000)
                npcHandler:say('Thank you for buying.')
                talk_state = 0
            else
                npcHandler:say('You don\'t have enough money.')
                talk_state = 0
            end
    end

if msgcontains(msg, 'bp of explosion') or msgcontains(msg, 'bp of explo') then
    npcHandler:say('Do you want to buy a backpack of explosion rune for 4000 gold coins?')
    talk_state = 5
    
        elseif msgcontains(msg, 'yes') and talk_state == 5 then
            if getPlayerMoney(cid) >= 4000 then
                purple2_bp = doPlayerAddItem(cid, 2001, 1)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doAddContainerItem(purple2_bp, 2313, 3)
                doPlayerRemoveMoney(cid, 4000)
                npcHandler:say('Thank you for buying.')
                talk_state = 0
            else
                npcHandler:say('You don\'t have enough money.')
                talk_state = 0
            end
            end
    end        

 

Nada mano.. 

[Error - LuaInterface::loadFile] data/npc/scripts/runenpc.lua:195: 'end' expected (to close 'function' at line 12) near '' 
[Warning - NpcEvents::NpcEvents] Cannot load script: data/npc/scripts/runenpc.lua 
data/npc/scripts/runenpc.lua:195: 'end' expected (to close 'function' at line 12) near ''

Link para o comentário
Compartilhar em outros sites

  • 7 months later...
A questão neste suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...