Postado Julho 19, 2017 7 anos Galera, Alguem Pode me ajudar tentei aki mais n consegui, queria colocar meu torneio para o player ganha a grana dos player que entraram exemplo: eu entro pago 20 hds, o Tibiaking entra mais 20hds, esses hds ficariam como o premio de quem ganhasse , ae quem clicasse na porta pegaria os 40 hds (no total) como o premio , alguem ai pode me ajudar?? SCRIPT NPC: 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 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) <= 149 then -- selfSay('Desculpa, apenas players level 150+ 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) doPlayerSendTextMessage(cid, 21, "Bem Vindo a sala de espera do torneio +150") doSendMagicEffect(getPlayerPosition(cid), 21) else selfSay('Você não tem dinheiro suficiente.', cid) end else selfSay('Até mais.', cid) talkState[talkUser] = 0 end end if getPlayerLevel(cid) >= 150 then -- selfSay('Desculpa, apenas players level 150- podem ir no torneio de Kanto!', cid) return true end if msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then if os.date("%X") < torneiomary.startHour1mary or os.date("%X") > torneiomary.endHour1mary then if os.date("%X") < torneiomary.startHour2mary or os.date("%X") > torneiomary.endHour2mary then if os.date("%X") < torneiomary.startHour3mary or os.date("%X") > torneiomary.endHour3mary then if os.date("%X") < torneiomary.startHour4mary or os.date("%X") > torneiomary.endHour4mary then if os.date("%X") < torneiomary.startHour5mary or os.date("%X") > torneiomary.endHour5mary then selfSay('Não está na hora do torneio...', cid) return true end end end end end if doPlayerRemoveMoney(cid, torneiomary.pricemary) then doTeleportThing(cid, torneiomary.waitPlacemary) doPlayerSendTextMessage(cid, 21, "Bem Vindo a sala de esperada do torneio -150") doSendMagicEffect(getPlayerPosition(cid), 21) else end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) SCRIPT PORTA Spoiler function onUse(cid, item, fromPosition, itemEx, toPosition) local pos = {x = 1310, y = 1728, z = 7} -- if #getCreatureSummons(cid) <= 1 then -- doPlayerSendCancel(cid, "Volte seu pokemon.") -- return true -- else if getPlayerGroupId(cid) >= 5 then doBroadcastMessage("o "..getCreatureName(cid).." esta tentando ganhar o torneioilegalmente") return true end if #getPlayersInArea(torneio.area) > 1 then doPlayerSendTextMessage(cid, 20 ,"Voce precisa derrotar todos os treinadores para passar na porta.") return true end doTeleportThing(cid, pos) doBroadcastMessage("[Torneio] Parabens ao treinador "..getCreatureName(cid).." foi o ganhador do torneio de johto 150+ de hoje, verifique o RANK em nosso site: www.otpMysterious.ddns.net!") doPlayerSave(cid) doPlayerAddItem(cid, torneio.awardTournament, torneio.awardAmount) doPlayerAddItem(cid,2160,2) addTopt(cid,1) doPlayerSendTextMessage(cid,22,"You Advanced In Torneios Vencidos") return true end -- end LIB: Spoiler torneio = { awardTournament = 2152, awardAmount = 150, playerTemple = {x = 1227, y = 1755, z = 7}, tournamentFight = {x = 1309, y = 1752, z = 7}, area = {fromx = 1278, fromy = 1729, fromz = 7, tox = 1338, toy = 1778, toz= 7}, waitPlace = {x = 1304, y = 1787, z = 7}, waitArea = {fromx = 1293, fromy = 1780, fromz = 7, tox = 1315, toy = 1795, toz= 7}, startHour1 = "08:45:00", endHour1 = "09:00:00", startHour2 = "12:15:00", endHour2 = "12:30:00", startHour3 = "18:45:00", endHour3 = "19:00:00", startHour4 = "22:45:00", endHour4 = "23:00:00", startHour5 = "01:45:00", endHour5 = "02:00:00", price = 200000, revivePoke = 12344, } 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 UP Editado Julho 20, 2017 7 anos por MarshMelloow (veja o histórico de edições)
Postado Julho 20, 2017 7 anos Poste também a lib desse sistema, pois esta faltando informações. Seu servidor responde bem a globalstorage? Te ajudei? Clique em Gostei ! ²²²d¬¬b²²² "She's got a smile that it seems to me...." ♪♪
Postado Julho 20, 2017 7 anos Autor 57 minutos atrás, luangop disse: Poste também a lib desse sistema, pois esta faltando informações. Seu servidor responde bem a globalstorage? Sim esponde sim topico atualizado lib no post
Postado Julho 20, 2017 7 anos Solução NPC: 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 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) <= 149 then -- selfSay('Desculpa, apenas players level 150+ 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) doPlayerSendTextMessage(cid, 21, "Bem Vindo a sala de espera do torneio +150") if getGlobalStorageValue(844564) < 0 then atualPremio = 0 else atualPremio = getGlobalStorageValue(844564) end setGlobalStorageValue(844564, atualPremio + 1) doSendMagicEffect(getPlayerPosition(cid), 21) else selfSay('Você não tem dinheiro suficiente.', cid) end else selfSay('Até mais.', cid) talkState[talkUser] = 0 end end if getPlayerLevel(cid) >= 150 then -- selfSay('Desculpa, apenas players level 150- podem ir no torneio de Kanto!', cid) return true end if msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then if os.date("%X") < torneiomary.startHour1mary or os.date("%X") > torneiomary.endHour1mary then if os.date("%X") < torneiomary.startHour2mary or os.date("%X") > torneiomary.endHour2mary then if os.date("%X") < torneiomary.startHour3mary or os.date("%X") > torneiomary.endHour3mary then if os.date("%X") < torneiomary.startHour4mary or os.date("%X") > torneiomary.endHour4mary then if os.date("%X") < torneiomary.startHour5mary or os.date("%X") > torneiomary.endHour5mary then selfSay('Não está na hora do torneio...', cid) return true end end end end end if doPlayerRemoveMoney(cid, torneiomary.pricemary) then doTeleportThing(cid, torneiomary.waitPlacemary) doPlayerSendTextMessage(cid, 21, "Bem Vindo a sala de esperada do torneio -150") if getGlobalStorageValue(844565) < 0 then atualPremiu = 0 else atualPremiu = getGlobalStorageValue(844565) end setGlobalStorageValue(844565, atualPremiu + 1) doSendMagicEffect(getPlayerPosition(cid), 21) else end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) PORTA 150+: Spoiler function onUse(cid, item, fromPosition, itemEx, toPosition) local pos = {x = 1310, y = 1728, z = 7} -- if #getCreatureSummons(cid) <= 1 then -- doPlayerSendCancel(cid, "Volte seu pokemon.") -- return true -- else if getPlayerGroupId(cid) >= 5 then doBroadcastMessage("o "..getCreatureName(cid).." esta tentando ganhar o torneioilegalmente") return true end if #getPlayersInArea(torneio.area) > 1 then doPlayerSendTextMessage(cid, 20 ,"Voce precisa derrotar todos os treinadores para passar na porta.") return true end doTeleportThing(cid, pos) doBroadcastMessage("[Torneio] Parabens ao treinador "..getCreatureName(cid).." foi o ganhador do torneio de johto 150+ de hoje, verifique o RANK em nosso site: www.otpMysterious.ddns.net!") doPlayerSave(cid) --doPlayerAddItem(cid, torneio.awardTournament, torneio.awardAmount) local atualPremioo = getGlobalStorageValue(844564) doPlayerAddMoney(cid, atualPremioo * 20000) setGlobalStorageValue(844564, -1) addTopt(cid,1) doPlayerSendTextMessage(cid,22,"You Advanced In Torneios Vencidos") return true end -- end PORTA 150-: Spoiler function onUse(cid, item, fromPosition, itemEx, toPosition) local pos = {x = 1310, y = 1728, z = 7} -- if #getCreatureSummons(cid) <= 1 then -- doPlayerSendCancel(cid, "Volte seu pokemon.") -- return true -- else if getPlayerGroupId(cid) >= 5 then doBroadcastMessage("o "..getCreatureName(cid).." esta tentando ganhar o torneioilegalmente") return true end if #getPlayersInArea(torneio.area) > 1 then doPlayerSendTextMessage(cid, 20 ,"Voce precisa derrotar todos os treinadores para passar na porta.") return true end doTeleportThing(cid, pos) doBroadcastMessage("[Torneio] Parabens ao treinador "..getCreatureName(cid).." foi o ganhador do torneio de johto 150- de hoje, verifique o RANK em nosso site: www.otpMysterious.ddns.net!") doPlayerSave(cid) --doPlayerAddItem(cid, torneio.awardTournament, torneio.awardAmount) local atualPremiuu = getGlobalStorageValue(844565) doPlayerAddMoney(cid, atualPremiuu * 20000) setGlobalStorageValue(844565, -1) addTopt(cid,1) doPlayerSendTextMessage(cid,22,"You Advanced In Torneios Vencidos") return true end -- end Editado Julho 20, 2017 7 anos por luangop (veja o histórico de edições) Te ajudei? Clique em Gostei ! ²²²d¬¬b²²² "She's got a smile that it seems to me...." ♪♪
Postado Julho 20, 2017 7 anos Autor 17 minutos atrás, luangop disse: NPC: Mostrar conteúdo oculto 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) <= 149 then -- selfSay('Desculpa, apenas players level 150+ 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) doPlayerSendTextMessage(cid, 21, "Bem Vindo a sala de espera do torneio +150") if getGlobalStorageValue(844564) < 0 then atualPremio = 0 else atualPremio = getGlobalStorageValue(844564) end setGlobalStorageValue(844564, atualPremio + 1) doSendMagicEffect(getPlayerPosition(cid), 21) else selfSay('Você não tem dinheiro suficiente.', cid) end else selfSay('Até mais.', cid) talkState[talkUser] = 0 end end if getPlayerLevel(cid) >= 150 then -- selfSay('Desculpa, apenas players level 150- podem ir no torneio de Kanto!', cid) return true end if msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then if os.date("%X") < torneiomary.startHour1mary or os.date("%X") > torneiomary.endHour1mary then if os.date("%X") < torneiomary.startHour2mary or os.date("%X") > torneiomary.endHour2mary then if os.date("%X") < torneiomary.startHour3mary or os.date("%X") > torneiomary.endHour3mary then if os.date("%X") < torneiomary.startHour4mary or os.date("%X") > torneiomary.endHour4mary then if os.date("%X") < torneiomary.startHour5mary or os.date("%X") > torneiomary.endHour5mary then selfSay('Não está na hora do torneio...', cid) return true end end end end end if doPlayerRemoveMoney(cid, torneiomary.pricemary) then doTeleportThing(cid, torneiomary.waitPlacemary) doPlayerSendTextMessage(cid, 21, "Bem Vindo a sala de esperada do torneio -150") if getGlobalStorageValue(844565) < 0 then atualPremiu = 0 else atualPremiu = getGlobalStorageValue(844565) end setGlobalStorageValue(844565, atualPremiu + 1) doSendMagicEffect(getPlayerPosition(cid), 21) else end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) PORTA 150+: Mostrar conteúdo oculto function onUse(cid, item, fromPosition, itemEx, toPosition) local pos = {x = 1310, y = 1728, z = 7} -- if #getCreatureSummons(cid) <= 1 then -- doPlayerSendCancel(cid, "Volte seu pokemon.") -- return true -- else if getPlayerGroupId(cid) >= 5 then doBroadcastMessage("o "..getCreatureName(cid).." esta tentando ganhar o torneioilegalmente") return true end if #getPlayersInArea(torneio.area) > 1 then doPlayerSendTextMessage(cid, 20 ,"Voce precisa derrotar todos os treinadores para passar na porta.") return true end doTeleportThing(cid, pos) doBroadcastMessage("[Torneio] Parabens ao treinador "..getCreatureName(cid).." foi o ganhador do torneio de johto 150+ de hoje, verifique o RANK em nosso site: www.otpMysterious.ddns.net!") doPlayerSave(cid) --doPlayerAddItem(cid, torneio.awardTournament, torneio.awardAmount) local atualPremioo = getGlobalStorageValue(844564) doPlayerAddMoney(cid, atualPremioo * 20000) setGlobalStorageValue(844564, -1) addTopt(cid,1) doPlayerSendTextMessage(cid,22,"You Advanced In Torneios Vencidos") return true end -- end PORTA 150-: Ocultar conteúdo function onUse(cid, item, fromPosition, itemEx, toPosition) local pos = {x = 1310, y = 1728, z = 7} -- if #getCreatureSummons(cid) <= 1 then -- doPlayerSendCancel(cid, "Volte seu pokemon.") -- return true -- else if getPlayerGroupId(cid) >= 5 then doBroadcastMessage("o "..getCreatureName(cid).." esta tentando ganhar o torneioilegalmente") return true end if #getPlayersInArea(torneio.area) > 1 then doPlayerSendTextMessage(cid, 20 ,"Voce precisa derrotar todos os treinadores para passar na porta.") return true end doTeleportThing(cid, pos) doBroadcastMessage("[Torneio] Parabens ao treinador "..getCreatureName(cid).." foi o ganhador do torneio de johto 150- de hoje, verifique o RANK em nosso site: www.otpMysterious.ddns.net!") doPlayerSave(cid) --doPlayerAddItem(cid, torneio.awardTournament, torneio.awardAmount) local atualPremiuu = getGlobalStorageValue(844565) doPlayerAddMoney(cid, atualPremiuu * 20000) setGlobalStorageValue(844565, -1) addTopt(cid,1) doPlayerSendTextMessage(cid,22,"You Advanced In Torneios Vencidos") return true end -- end Funcionou mais ele n entrega 20hds do ganhador ele entrega 2hds so
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.