Postado Agosto 23, 2014 10 anos está dando esse erro no meu Distro depois de adiciona um NPC erro [23/08/2014 09:48:26] [Error - LuaScriptInterface::loadFile] data/npc/scripts/Lendarios.lua:30: 'end' expected (to close 'function' at line 10) near 'elseif' [23/08/2014 09:48:26] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/Lendarios.lua [23/08/2014 09:48:26] data/npc/scripts/Lendarios.lua:30: 'end' expected (to close 'function' at line 10) near 'elseif' script do npc --// 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 talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid msg = string.lower(msg) --\\ ---- local need = { --item id....quantidade {id = 2145, qt = 25}, } local pokemon = "Moltres" -- nome do poke ----- --// selfSay("olá, você gostaría de compra Algum Pokemon mega evoluido?!", cid) talkState[talkUser] = 2 return true elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then if getPlayerItemCount(cid, need[1].id) < need[1].qt then selfSay("você não tem 25 Diamonds para compra um Pokemon mega evoluido!", cid) talkState[talkUser] = 0 return true end if not addPokeToPlayer(cid, pokemon, 0, -1, "normal", true) then selfSay("voce está com 6 pokemons e não pode fazer a compra do mega Pokemon!", cid) talkState[talkUser] = 0 return true end for i = 1, #need do doPlayerRemoveItem(cid, need[i].id, need[i].qt) end addPokeToPlayer(cid, pokemon, 0, 1, 'normal', true) selfSay("nossa muito bom, obrigado e faça um bom proveito do seu novo pokémon!", cid) talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Postado Agosto 23, 2014 10 anos Tenta: Citar --// 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 talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid msg = string.lower(msg) --\\ ---- local need = { --item id....quantidade {id = 2145, qt = 25}, } local pokemon = "Moltres" -- nome do poke ----- --// selfSay("olá, você gostaría de compra Algum Pokemon mega evoluido?!", cid) talkState[talkUser] = 2 return true end elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then if getPlayerItemCount(cid, need[1].id) < need[1].qt then selfSay("você não tem 25 Diamonds para compra um Pokemon mega evoluido!", cid) talkState[talkUser] = 0 return true end if not addPokeToPlayer(cid, pokemon, 0, -1, "normal", true) then selfSay("voce está com 6 pokemons e não pode fazer a compra do mega Pokemon!", cid) talkState[talkUser] = 0 return true end for i = 1, #need do doPlayerRemoveItem(cid, need.id, need.qt) addPokeToPlayer(cid, pokemon, 0, 1, 'normal', true) selfSay("nossa muito bom, obrigado e faça um bom proveito do seu novo pokémon!", cid) talkState[talkUser] = 0 end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Agosto 23, 2014 10 anos por Alencar123 (veja o histórico de edições)
Postado Agosto 23, 2014 10 anos O problema é na linha 10 que diz: function creatureSayCallback(cid, type, msg) Pelo que eu entendi ele não consegue fazer o Moltres voltar para a pokébola ao comprar ela certo? Tente ver se em outros scripts com a mesma função que é a de vender um pokémon lendário está certo/de outra forma. acho que você deve preencher as palavras entre os parênteses ^-^
Postado Agosto 23, 2014 10 anos Autor Em 23/08/2014 em 13:31, Leviih disse: O problema é na linha 10 que diz: function creatureSayCallback(cid, type, msg) Pelo que eu entendi ele não consegue fazer o Moltres voltar para a pokébola ao comprar ela certo? Tente ver se em outros scripts com a mesma função que é a de vender um pokémon lendário está certo/de outra forma. acho que você deve preencher as palavras entre os parênteses ^-^ Não é isso
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.