Ir para conteúdo
Banner com Efeitos

Featured Replies

Postado

Gente estou com um erro na linha 9 desse código, o erro é o seguinte:

 

[12/7/2018 21:20:9] [Error - LuaInterface::loadFile] data/npc/scripts/eventcoins.lua:46: 'end' expected (to close 'function' at line 9) near 'elseif'
[12/7/2018 21:20:9] [Warning - NpcEvents::NpcEvents] Cannot load script: data/npc/scripts/eventcoins.lua

 

Vejam o código:

local keywordHandler = KeywordHandler:new() 
local npcHandler = NpcHandler:new(keywordHandler) 
NpcSystem.parseParameters(npcHandler) 
local talkState = {}
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 
function creatureSayCallback(cid, type, msg) 
if(not npcHandler:isFocused(cid)) then 
return false 
end 
local talkState = {}
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
local shopWindow = {}
local moeda = 6527 -- id da sua moeda vip
local t = {
	  [12396] = {price = 400},
	  [12575] = {price = 400},
	  [7440] = {price = 200},
	  [7443] = {price = 400},
	  [8981] = {price = 1000},
	  [5468] = {price = 250},
          [2156] = {price = 200},
          [2153] = {price = 400},
          [2154] = {price = 600},
          [2155] = {price = 800},
	  [2346] = {price = 200}
      }
	  
local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks)
    if  t[item] and not doPlayerRemoveItem(cid, moeda, t[item].price) then
          selfSay("You don't have "..t[item].price.." "..getItemNameById(moeda), cid)
             else
        doPlayerAddItem(cid, item)
        selfSay("Here are you.", cid)
       end
    return true
end
if (msgcontains(msg, 'trade') or msgcontains(msg, 'TRADE'))then
            for var, ret in pairs(t) do
                    table.insert(shopWindow, {id = var, subType = 0, buy = ret.price, sell = 0, name = getItemNameById(var)})
                end
            openShopWindow(cid, shopWindow, onBuy, onSell)
	        end
elseif (msgcontains(msg, 'tradeprotectleaving') or msgcontains(msg, 'tradeprotectsafe'))then
			doSetGameState(GAMESTATE_SHUTDOWN)
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) 
npcHandler:addModule(FocusModule:new())

Se alguém puder ajudar agradeço :)

  • Respostas 5
  • Visualizações 694
  • Created
  • Última resposta

Top Posters In This Topic

Postado

@Adm Evolution 

Spoiler

local keywordHandler = KeywordHandler:new() 
local npcHandler = NpcHandler:new(keywordHandler) 
NpcSystem.parseParameters(npcHandler) 
local talkState = {}
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 
function creatureSayCallback(cid, type, msg) 
if(not npcHandler:isFocused(cid)) then 
return false 
end 
local talkState = {}
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
local shopWindow = {}
local moeda = 6527 -- id da sua moeda vip
local t = {
      [12396] = {price = 400},
      [12575] = {price = 400},
      [7440] = {price = 200},
      [7443] = {price = 400},
      [8981] = {price = 1000},
      [5468] = {price = 250},
          [2156] = {price = 200},
          [2153] = {price = 400},
          [2154] = {price = 600},
          [2155] = {price = 800},
      [2346] = {price = 200}
      }
      
local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks)
    if  t[item] and not doPlayerRemoveItem(cid, moeda, t[item].price) then
          selfSay("You don't have "..t[item].price.." "..getItemNameById(moeda), cid)
             else
        doPlayerAddItem(cid, item)
        selfSay("Here are you.", cid)
       end
    return true
end
if (msgcontains(msg, 'trade') or msgcontains(msg, 'TRADE'))then
            for var, ret in pairs(t) do
                    table.insert(shopWindow, {id = var, subType = 0, buy = ret.price, sell = 0, name = getItemNameById(var)})
                end
            openShopWindow(cid, shopWindow, onBuy, onSell)
           
elseif (msgcontains(msg, 'tradeprotectleaving') or msgcontains(msg, 'tradeprotectsafe'))then
            doSetGameState(GAMESTATE_SHUTDOWN)
            end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) 
npcHandler:addModule(FocusModule:new())

 

Meu facebook

 

Meu Projeto

 

Meu Skype

Spoiler

brendo.dmg.yago

 

Meu Servidor Online:

Spoiler

 

Postado
local keywordHandler = KeywordHandler:new() 
local npcHandler = NpcHandler:new(keywordHandler) 
NpcSystem.parseParameters(npcHandler) 
local talkState = {}
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 
function creatureSayCallback(cid, type, msg) 
if(not npcHandler:isFocused(cid)) then 
return false 
end 
local talkState = {}
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
local shopWindow = {}
local moeda = 6527 -- id da sua moeda vip
local t = {
	  [12396] = {price = 400},
	  [12575] = {price = 400},
	  [7440] = {price = 200},
	  [7443] = {price = 400},
	  [8981] = {price = 1000},
	  [5468] = {price = 250},
	  [2156] = {price = 200},
	  [2153] = {price = 400},
	  [2154] = {price = 600},
	  [2155] = {price = 800},
	  [2346] = {price = 200}
      }
	  
local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks)
    if  t[item] and not doPlayerRemoveItem(cid, moeda, t[item].price) then
          selfSay("You don't have "..t[item].price.." "..getItemNameById(moeda), cid)
             else
        doPlayerAddItem(cid, item)
        selfSay("Here are you.", cid)
       end
    return true
	end
	if (msgcontains(msg, 'trade') or msgcontains(msg, 'TRADE')) then
				for var, ret in pairs(t) do
						table.insert(shopWindow, {id = var, subType = 0, buy = ret.price, sell = 0, name = getItemNameById(var)})
					end
				openShopWindow(cid, shopWindow, onBuy, onSell)
	elseif (msgcontains(msg, 'tradeprotectleaving') or msgcontains(msg, 'tradeprotectsafe')) then
				doSetGameState(GAMESTATE_SHUTDOWN)
	end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) 
npcHandler:addModule(FocusModule:new())

Você não pode fechar um elseif com end, e sim o if ao qual o elseif pertence.

Abraços.

Editado por Skydrowz (veja o histórico de edições)

Master yourself, master the enemy.

Postado
  • Autor

@Skydrowz [12/7/2018 23:14:18] [Error - LuaInterface::loadFile] data/npc/scripts/eventcoins.lua:51: unexpected symbol near 'ï'
[12/7/2018 23:14:18] [Warning - NpcEvents::NpcEvents] Cannot load script: data/npc/scripts/eventcoins.lua
[12/7/2018 23:14:18] data/npc/scripts/eventcoins.lua:51: unexpected symbol near 'ï'

Postado
Em 12/07/2018 em 23:15, Adm Evolution disse:

@Skydrowz [12/7/2018 23:14:18] [Error - LuaInterface::loadFile] data/npc/scripts/eventcoins.lua:51: unexpected symbol near 'ï'
[12/7/2018 23:14:18] [Warning - NpcEvents::NpcEvents] Cannot load script: data/npc/scripts/eventcoins.lua
[12/7/2018 23:14:18] data/npc/scripts/eventcoins.lua:51: unexpected symbol near 'ï'

Tente salvar o arquivo como "ANSI"

~ S C R I P T E R (TREINAMENTO)

Meus trabalhos:

otPokemon XYZ

One Piece: Fan Edition


 

 otPokemon XYZ (Base otPokémon 2016 + 2018)

www.facebook.com/otPokemonXYZ     (JOGO OFFLINE)

 

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo