Postado Agosto 19, 2017 7 anos Olá galera do tk,tentei adicionar mais um horario de torneio no meu servidor porém está dando erro 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 if msgcontains(msg, 'torneio') then if getPlayerItemCount(cid, torneio.revivePoke) >= 1 then selfSay('Você não pode entrar no torneio portando revives.', cid) return true end if getPlayerLevel(cid) <= 0 then selfSay('Desculpa, apenas players level 0 podem ir no torneio de Kanto!', cid) return true end selfSay('Para entrar no torneio tem que pagar 20 hundred dollars, vai entrar?', cid) talkState[talkUser] = 2 elseif talkState[talkUser] == 2 then if msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then if os.date("%X") < torneio.startHour1 or os.date("%X") > torneio.endHour1 then if os.date("%X") < torneio.startHour2 or os.date("%X") > torneio.endHour2 then if os.date("%X") < torneio.startHour3 or os.date("%X") > torneio.endHour3 then if os.date("%X") < torneio.startHour4 or os.date("%X") > torneio.endHour4 then if os.date("%X") < torneio.startHour5 or os.date("%X") > torneio.endHour5 then selfSay('Não está na hora do torneio...', cid) return true end end end end if doPlayerRemoveMoney(cid, torneio.price) then doTeleportThing(cid, torneio.waitPlace) else selfSay('Você não tem dinheiro suficiente.', cid) end else selfSay('Até mais.', cid) talkState[talkUser] = 0 end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Script da lib torneio = { awardTournament = 2152, ---moeda usada para entra no torneio-- awardAmount = 150, -- quantidade de moeda que o player vai ganhar ao vencer o torneio-- playerTemple = {x = 1038, y = 1035, z = 7}, --pra onde vai o player quando morrer ?-- tournamentFight = {x = 1229, y = 1778, z = 7}, --centro da arena torneio combate-- {x = 1229, y = 1778, z = 7} area = {fromx = 1203, fromy = 1756, fromz = 7, tox = 1247, toy = 1799, toz= 7},--canto acima direito da arena combate-canto esquerdo abaixo da arena combate-- {x = 1247, y = 1799, z = 7} waitPlace = {x = 1222, y = 1806, z = 7}, --centro da sala de espera-- {x = 1222, y = 1806, z = 7} waitArea = {fromx = 1207, fromy = 1796, fromz = 7, tox = 1236, toy = 1816, toz= 7}, -- {x = 1207, y = 1796, z = 7} | {x = 1236, y = 1816, z = 7} startHour1 = "08:45:00", --horario do aviso?-- endHour1 = "09:00:00",--horario que começa?-- startHour2 = "12:14:00",--horario do aviso?-- endHour2 = "12:29:00",--horario do aviso?-- startHour3 = "18:44:00",--horario do aviso?-- endHour3 = "18:59:00",--horario do aviso?-- startHour4 = "22:44:00",--horario do aviso?-- endHour4 = "22:59:00",--horario do aviso?-- startHour5 = "03:14:00",--horario do aviso?-- endHour5 = "03:29:00",--horario do aviso?-- price = 200000,--valor para entrar no torneio ? 500 dollar no caso-- revivePoke = 12344,--aqui é revive se tiver e se não tiver não precisa mexer-- } function getPlayersInArea(area) local players = {} for x = area.fromx,area.tox do for y = area.fromy,area.toy do for z = area.fromz,area.toz do local m = getTopCreature({x=x, y=y, z=z}).uid if m ~= 1 and isPlayer(m) then table.insert(players, m) end end end end return players end
Postado Agosto 19, 2017 7 anos Diretor 1 minuto atrás, Lokozoido disse: Olá galera do tk,tentei adicionar mais um horario de torneio no meu servidor porém está dando erro 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 if msgcontains(msg, 'torneio') then if getPlayerItemCount(cid, torneio.revivePoke) >= 1 then selfSay('Você não pode entrar no torneio portando revives.', cid) return true end if getPlayerLevel(cid) <= 0 then selfSay('Desculpa, apenas players level 0 podem ir no torneio de Kanto!', cid) return true end selfSay('Para entrar no torneio tem que pagar 20 hundred dollars, vai entrar?', cid) talkState[talkUser] = 2 elseif talkState[talkUser] == 2 then if msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then if os.date("%X") < torneio.startHour1 or os.date("%X") > torneio.endHour1 then if os.date("%X") < torneio.startHour2 or os.date("%X") > torneio.endHour2 then if os.date("%X") < torneio.startHour3 or os.date("%X") > torneio.endHour3 then if os.date("%X") < torneio.startHour4 or os.date("%X") > torneio.endHour4 then if os.date("%X") < torneio.startHour5 or os.date("%X") > torneio.endHour5 then selfSay('Não está na hora do torneio...', cid) return true end end end end if doPlayerRemoveMoney(cid, torneio.price) then doTeleportThing(cid, torneio.waitPlace) else selfSay('Você não tem dinheiro suficiente.', cid) end else selfSay('Até mais.', cid) talkState[talkUser] = 0 end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Script da lib torneio = { awardTournament = 2152, ---moeda usada para entra no torneio-- awardAmount = 150, -- quantidade de moeda que o player vai ganhar ao vencer o torneio-- playerTemple = {x = 1038, y = 1035, z = 7}, --pra onde vai o player quando morrer ?-- tournamentFight = {x = 1229, y = 1778, z = 7}, --centro da arena torneio combate-- {x = 1229, y = 1778, z = 7} area = {fromx = 1203, fromy = 1756, fromz = 7, tox = 1247, toy = 1799, toz= 7},--canto acima direito da arena combate-canto esquerdo abaixo da arena combate-- {x = 1247, y = 1799, z = 7} waitPlace = {x = 1222, y = 1806, z = 7}, --centro da sala de espera-- {x = 1222, y = 1806, z = 7} waitArea = {fromx = 1207, fromy = 1796, fromz = 7, tox = 1236, toy = 1816, toz= 7}, -- {x = 1207, y = 1796, z = 7} | {x = 1236, y = 1816, z = 7} startHour1 = "08:45:00", --horario do aviso?-- endHour1 = "09:00:00",--horario que começa?-- startHour2 = "12:14:00",--horario do aviso?-- endHour2 = "12:29:00",--horario do aviso?-- startHour3 = "18:44:00",--horario do aviso?-- endHour3 = "18:59:00",--horario do aviso?-- startHour4 = "22:44:00",--horario do aviso?-- endHour4 = "22:59:00",--horario do aviso?-- startHour5 = "03:14:00",--horario do aviso?-- endHour5 = "03:29:00",--horario do aviso?-- price = 200000,--valor para entrar no torneio ? 500 dollar no caso-- revivePoke = 12344,--aqui é revive se tiver e se não tiver não precisa mexer-- } function getPlayersInArea(area) local players = {} for x = area.fromx,area.tox do for y = area.fromy,area.toy do for z = area.fromz,area.toz do local m = getTopCreature({x=x, y=y, z=z}).uid if m ~= 1 and isPlayer(m) then table.insert(players, m) end end end end return players end qual é o erro ? Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código. #OpenSource #Programação #Contribuição
Postado Agosto 19, 2017 7 anos Autor [19/08/2017 17:34:57] [Error - LuaScriptInterface::loadFile] datapack/npc/scripts/torneio.lua:62: 'end' expected (to close 'function' at line 11) near '<eof>' [19/08/2017 17:34:57] [Warning - NpcScript::NpcScript] Cannot load script: datapack/npc/scripts/torneio.lua
Postado Agosto 19, 2017 7 anos Diretor 1 minuto atrás, Lokozoido disse: [19/08/2017 17:34:57] [Error - LuaScriptInterface::loadFile] datapack/npc/scripts/torneio.lua:62: 'end' expected (to close 'function' at line 11) near '<eof>' [19/08/2017 17:34:57] [Warning - NpcScript::NpcScript] Cannot load script: datapack/npc/scripts/torneio.lua 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 if msgcontains(msg, 'torneio') then if getPlayerItemCount(cid, torneio.revivePoke) >= 1 then selfSay('Você não pode entrar no torneio portando revives.', cid) return true end if getPlayerLevel(cid) <= 0 then selfSay('Desculpa, apenas players level 0 podem ir no torneio de Kanto!', cid) return true end selfSay('Para entrar no torneio tem que pagar 20 hundred dollars, vai entrar?', cid) talkState[talkUser] = 2 elseif talkState[talkUser] == 2 then if msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then if os.date("%X") < torneio.startHour1 or os.date("%X") > torneio.endHour1 then if os.date("%X") < torneio.startHour2 or os.date("%X") > torneio.endHour2 then if os.date("%X") < torneio.startHour3 or os.date("%X") > torneio.endHour3 then if os.date("%X") < torneio.startHour4 or os.date("%X") > torneio.endHour4 then if os.date("%X") < torneio.startHour5 or os.date("%X") > torneio.endHour5 then selfSay('Não está na hora do torneio...', cid) return true end end end end end if doPlayerRemoveMoney(cid, torneio.price) then doTeleportThing(cid, torneio.waitPlace) else selfSay('Você não tem dinheiro suficiente.', cid) end else selfSay('Até mais.', cid) talkState[talkUser] = 0 end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) a cada if deve conter 1 end Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código. #OpenSource #Programação #Contribuição
Postado Agosto 19, 2017 7 anos Autor 3 minutos atrás, Alexy Brocanello disse: qual é o erro ? Npc tabém some. Agora, Alexy Brocanello disse: 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 if msgcontains(msg, 'torneio') then if getPlayerItemCount(cid, torneio.revivePoke) >= 1 then selfSay('Você não pode entrar no torneio portando revives.', cid) return true end if getPlayerLevel(cid) <= 0 then selfSay('Desculpa, apenas players level 0 podem ir no torneio de Kanto!', cid) return true end selfSay('Para entrar no torneio tem que pagar 20 hundred dollars, vai entrar?', cid) talkState[talkUser] = 2 elseif talkState[talkUser] == 2 then if msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then if os.date("%X") < torneio.startHour1 or os.date("%X") > torneio.endHour1 then if os.date("%X") < torneio.startHour2 or os.date("%X") > torneio.endHour2 then if os.date("%X") < torneio.startHour3 or os.date("%X") > torneio.endHour3 then if os.date("%X") < torneio.startHour4 or os.date("%X") > torneio.endHour4 then if os.date("%X") < torneio.startHour5 or os.date("%X") > torneio.endHour5 then selfSay('Não está na hora do torneio...', cid) return true end end end end end if doPlayerRemoveMoney(cid, torneio.price) then doTeleportThing(cid, torneio.waitPlace) else selfSay('Você não tem dinheiro suficiente.', cid) end else selfSay('Até mais.', cid) talkState[talkUser] = 0 end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Porfavor pode me mostra onde está o erro?
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.