Ir para conteúdo
  • 0

Problemas Com Npc


andre899

Pergunta

Fala galerinha, o erro é o seguinte

 

Aparece isso no meu exe

 

[10/11/2012 07:32:47] [Error - LuaScriptInterface::loadFile] data/npc/scripts/donation shop.lua:42: '}' expected (to close '{' at line 38) near '{'[10/11/2012 07:32:47] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/donation shop.lua

[10/11/2012 07:32:47] data/npc/scripts/donation shop.lua:42: '}' expected (to close '{' at line 38) near '{'

 

Aki ta o script do NPC

 

<?xml version="1.0" encoding="UTF-8"?><npc name="Donation Shop" script="donation shop.lua" walkinterval="2000000000" author="" contact="">

<health now="150" max="150"/>

<look type="147" head="114" body="94" legs="19" feet="0" addons="3" corpse="2212"/>

<parameters>

<parameter key="message_greet" value="Greetings |PLAYERNAME|. I sell lots of donation stuff! Take a look at the donation list when you {trade} with me" />

</parameters>

</npc>

 

 

Aki o lib do NPC

 

for i, v in pairs(focuses) do if(v == cid) then

table.remove(focuses, i)

break

end

end

end

local function lookAtFocus()

for i, v in pairs(focuses) do

if(isPlayer(v)) then

doNpcSetCreatureFocus(v)

return

end

end

doNpcSetCreatureFocus(0)

end

 

local itemWindow = {

 

{id=8924, subType=0, buy=1, sell=0, name="HellForged Axe", Bpoints = 5, Spoints = 2}, --Goldnuggets

{id=8930, subType=0, buy=1, sell=0, name="Emerald Sword", Bpoints = 5, Spoints = 2} --Donated Wand

{id=7450, subType=0, buy=1, sell=0, name="VIP Club", Bpoints = 8, Spoints = 0} --Donated Wand

{id=11360, subType=0, buy=1, sell=0, name="Undead Staff", Bpoints = 5, Spoints = 2} --Donated Wand

{id=7435, subType=0, buy=1, sell=0, name="VIP Axe", Bpoints = 8, Spoints = 0} --Donated Wand

{id=8928, subType=0, buy=1, sell=0, name="Obsidian Trucheon", Bpoints = 5, Spoints = 2} --Donated Wand

{id=8851, subType=0, buy=1, sell=0, name="Royal Crassbow", Bpoints = 5, Spoints = 2} --Donated Wand

{id=7368, subType=0, buy=1, sell=0, name="Assasin Star", Bpoints = 5, Spoints = 2} --Donated Wand

{id=6529, subType=0, buy=1, sell=0, name="Infernal Bolt", Bpoints = 5, Spoints = 2} --Donated Wand

{id=12568, subType=0, buy=1, sell=0, name="Vip Master Armor", Bpoints = 8, Spoints = 0} --Donated Wand

{id=8888, subType=0, buy=1, sell=0, name="Master Archers", Bpoints = 5, Spoints = 2} --Donated Wand

{id=8866, subType=0, buy=1, sell=0, name="Serpent Coat", Bpoints = 5, Spoints = 2} --Donated Wand

{id=2494, subType=0, buy=1, sell=0, name="Demon Armor", Bpoints = 4, Spoints = 2} --Donated Wand

{id=7366, subType=0, buy=1, sell=0, name="War star", Bpoints = 6, Spoints = 2} --Donated Wand

{id=12606, subType=0, buy=1, sell=0, name="VIP Helmet", Bpoints = 8, Spoints = 0} --Donated Wand

{id=12605, subType=0, buy=1, sell=0, name="VIP Shield", Bpoints = 10, Spoints = 0} --Donated Wand

{id=11686, subType=0, buy=1, sell=0, name="VIP Armor", Bpoints = 10, Spoints = 0} --Donated Wand

{id=12604, subType=0, buy=1, sell=0, name="VIP Coat", Bpoints = 8, Spoints = 2} --Donated Wand

{id=11113, subType=0, buy=1, sell=0, name="Crystal Boots", Bpoints = 5, Spoints = 2} --Donated Wand

{id=12607, subType=0, buy=1, sell=0, name="VIP Boots", Bpoints = 8, Spoints = 0} --Donated Wand

{id=11113, subType=0, buy=1, sell=0, name="Crystal Boots", Bpoints = 5, Spoints = 2} --Donated Wand

{id=2640, subType=0, buy=1, sell=0, name="Pair Of Soft Boots", Bpoints = 6, Spoints = 2} --Donated Wand

}

 

--{id=5785, subType=0, buy=1, sell=0, name="10P", Bpoints = 10, Spoints = 5},

--{id=5785, subType=0, buy=0, sell=1, name="5P", Bpoints = 10, Spoints = 5}

 

local items = {}

for _, item in ipairs(itemWindow) do

items[item.id] = {

buyPrice = item.buy,

sellPrice = item.sell,

subType = item.subType,

realName = item.name,

Bpoints = item.Bpoints or 0,

Spoints = item.Spoints or 0

}

end

 

local function getPlayerMoney(cid)

return getAccountPremiumPoints(cid)

end

 

local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks)

if(items[item] == nil) then

selfSay("Ehm.. sorry... this shouldn't be there, I'm not selling it.", cid)

return

end

 

if(getPlayerMoney(cid) >= amount * items[item].Bpoints) then

if(getPlayerFreeCap(cid) >= getItemWeightById(item,amount)) then

local new_item = doCreateItemEx(item, amount)

local received_item = doPlayerAddItemEx(cid, new_item)

if received_item == RETURNVALUE_NOERROR then

selfSay("Thanks for the money!", cid)

doAccountRemovePremiumPoints(cid, amount * items[item].Bpoints)

else

selfSay("You have no space for this item!", cid)

end

else

selfSay("You can't carry this!", cid)

end

else

selfSay("Buy more premium points at {www.goblinsfoe.no-ip.org}", cid)

end

end

 

local onSell = function(cid, item, subType, amount, ignoreCap, inBackpacks)

if(items[item] == nil) then

selfSay("Ehm.. sorry... this shouldn't be there, I'm not buying it.", cid)

end

 

if(subType < 1) then

subType = -1

end

if(doPlayerRemoveItem(cid, item, amount, subType)) then

doAccountAddPremiumPoints(cid, items[item].Spoints * amount)

selfSay("Here you are.", cid)

else

selfSay("No item, no deal.", cid)

end

end

 

function onCreatureAppear(cid)

end

 

function onCreatureDisappear(cid)

if(isFocused(cid)) then

selfSay("Hmph!")

removeFocus(cid)

if(isPlayer(cid)) then --Be sure he's online

closeShopWindow(cid)

end

end

end

 

function onCreatureSay(cid, type, msg)

if((msg == "hi") and not (isFocused(cid))) then

selfSay("Welcome, ".. getCreatureName(cid) ..".", cid, true)

selfSay("Do you want to see my {wares}?", cid)

addFocus(cid)

elseif((isFocused(cid)) and (msg == "wares" or msg == "trade")) then

selfSay("Pretty nice, right?", cid)

openShopWindow(cid, itemWindow, onBuy, onSell)

elseif((isFocused(cid)) and (msg == "bye" or msg == "goodbye" or msg == "cya")) then

selfSay("Goodbye!", cid, true)

closeShopWindow(cid)

removeFocus(cid)

end

end

 

function onPlayerCloseChannel(cid)

if(isFocused(cid)) then

selfSay("Hmph!")

closeShopWindow(cid)

removeFocus(cid)

end

end

 

function onPlayerEndTrade(cid)

selfSay("It was a pleasure doing business with you.", cid)

end

 

function onThink()

for i, focus in pairs(focuses) do

if(not isCreature(focus)) then

removeFocus(focus)

else

local distance = getDistanceTo(focus) or -1

if((distance > 4) or (distance == -1)) then

selfSay("Hmph!")

closeShopWindow(focus)

removeFocus(focus)

end

end

end

lookAtFocus()

end

 

 

 

Por Favor, alguem poderia me ajudar a arrumar esse bug?

Link para o comentário
Compartilhar em outros sites

1 resposta a esta questão

Posts Recomendados

  • 0

faltou as virgulas na tabela

 

local itemWindow = {
{id=8924, subType=0, buy=1, sell=0, name="HellForged Axe", Bpoints = 5, Spoints = 2}, --Goldnuggets"]
{id=8930, subType=0, buy=1, sell=0, name="Emerald Sword", Bpoints = 5, Spoints = 2}, --Donated Wand"]
{id=7450, subType=0, buy=1, sell=0, name="VIP Club", Bpoints = 8, Spoints = 0}, --Donated Wand"]
{id=11360, subType=0, buy=1, sell=0, name="Undead Staff", Bpoints = 5, Spoints = 2}, --Donated Wand"]
{id=7435, subType=0, buy=1, sell=0, name="VIP Axe", Bpoints = 8, Spoints = 0}, --Donated Wand"]
{id=8928, subType=0, buy=1, sell=0, name="Obsidian Trucheon", Bpoints = 5, Spoints = 2}, --Donated Wand"]
{id=8851, subType=0, buy=1, sell=0, name="Royal Crassbow", Bpoints = 5, Spoints = 2}, --Donated Wand"]
{id=7368, subType=0, buy=1, sell=0, name="Assasin Star", Bpoints = 5, Spoints = 2}, --Donated Wand"]
{id=6529, subType=0, buy=1, sell=0, name="Infernal Bolt", Bpoints = 5, Spoints = 2}, --Donated Wand"]
{id=12568, subType=0, buy=1, sell=0, name="Vip Master Armor", Bpoints = 8, Spoints = 0}, --Donated Wand"]
{id=8888, subType=0, buy=1, sell=0, name="Master Archers", Bpoints = 5, Spoints = 2}, --Donated Wand"]
{id=8866, subType=0, buy=1, sell=0, name="Serpent Coat", Bpoints = 5, Spoints = 2}, --Donated Wand"]
{id=2494, subType=0, buy=1, sell=0, name="Demon Armor", Bpoints = 4, Spoints = 2}, --Donated Wand"]
{id=7366, subType=0, buy=1, sell=0, name="War star", Bpoints = 6, Spoints = 2}, --Donated Wand"]
{id=12606, subType=0, buy=1, sell=0, name="VIP Helmet", Bpoints = 8, Spoints = 0}, --Donated Wand"]
{id=12605, subType=0, buy=1, sell=0, name="VIP Shield", Bpoints = 10, Spoints = 0}, --Donated Wand"]
{id=11686, subType=0, buy=1, sell=0, name="VIP Armor", Bpoints = 10, Spoints = 0}, --Donated Wand"]
{id=12604, subType=0, buy=1, sell=0, name="VIP Coat", Bpoints = 8, Spoints = 2}, --Donated Wand"]
{id=11113, subType=0, buy=1, sell=0, name="Crystal Boots", Bpoints = 5, Spoints = 2}, --Donated Wand"]
{id=12607, subType=0, buy=1, sell=0, name="VIP Boots", Bpoints = 8, Spoints = 0}, --Donated Wand"]
{id=11113, subType=0, buy=1, sell=0, name="Crystal Boots", Bpoints = 5, Spoints = 2}, --Donated Wand"]
{id=2640, subType=0, buy=1, sell=0, name="Pair Of Soft Boots", Bpoints = 6, Spoints = 2} --Donated Wand"]
}

Link para o comentário
Compartilhar em outros sites

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