Diley007 1 Postado Maio 17, 2012 Share Postado Maio 17, 2012 tenho npc de report onde o report do player vai pra pasta de txt, mas quero que numere... exemplo: chega 3 player e faz um determinado report, ai la onde for aparecer o report queria que ficasse assim 1 Diley reported a bug at 12 May 2012 - 00:03:40. 2 Lord reported a bug at 12 May 2012 - 00:03:40. 3 Jon reported a bug at 12 May 2012 - 00:03:40. ir numerando Link para o comentário https://xtibia.com/forum/topic/186282-sistema-de-contagem-por-report/ Compartilhar em outros sites More sharing options...
0 Vodkart 1515 Postado Maio 17, 2012 Share Postado Maio 17, 2012 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 local msg = string.lower(msg) local storage = 787544 local delaytime = 120 local a = "data/logs/time1.txt" local f = io.open(a, "a+") local pos = {x = 160, y = 54 , z = 7} if isInArray({"reportar"}, msg) then if (getPlayerStorageValue(cid, storage) <= os.time()) then selfSay('digite o seu report por favor?', cid) talkState[talkUser] = 1 else selfSay('You must wait ' .. getPlayerStorageValue(cid, storage) - os.time() .. ' seconds to report.', cid) talkState[talkUser] = 0 end elseif talkState[talkUser] == 1 then if (string.len(msg) > 10 and string.len(msg) < 90) then npcHandler:say("tem certeza que deseja reportar: "..msg.."? {yes}", cid) selfSay('tem certeza que deseja reportar: '..msg..'? {yes}') str = msg talkState[talkUser] = 2 else selfSay('minimo 10 letras e máximo 90 letras, incluindo espaços', cid) end elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then if getGlobalStorageValue(87954) == -1 then setGlobalStorageValue(87954, 1) end setPlayerStorageValue(cid, storage, os.time()+delaytime) selfSay('Obrigado, nos agradecemos a sua colaboraçao', cid) f:write(""..getGlobalStorageValue(87954).." - "..getPlayerName(cid).." reported a bug at " .. os.date("%d %B %Y - %X.", os.time()) .."\n"..str..".\n\n----------------------------------------------------------\n") f:close() setGlobalStorageValue(87954, getGlobalStorageValue(87954)+1) doTeleportThing(cid, pos) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) elseif msg == "no" and talkState[talkUser] >= 1 then selfSay("tudo bem então.", cid) str = nil talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Link para o comentário https://xtibia.com/forum/topic/186282-sistema-de-contagem-por-report/#findComment-1261141 Compartilhar em outros sites More sharing options...
0 Diley007 1 Postado Maio 17, 2012 Autor Share Postado Maio 17, 2012 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 local msg = string.lower(msg) local storage = 787544 local delaytime = 120 local a = "data/logs/time1.txt" local f = io.open(a, "a+") local pos = {x = 160, y = 54 , z = 7} if isInArray({"reportar"}, msg) then if (getPlayerStorageValue(cid, storage) <= os.time()) then selfSay('digite o seu report por favor?', cid) talkState[talkUser] = 1 else selfSay('You must wait ' .. getPlayerStorageValue(cid, storage) - os.time() .. ' seconds to report.', cid) talkState[talkUser] = 0 end elseif talkState[talkUser] == 1 then if (string.len(msg) > 10 and string.len(msg) < 90) then npcHandler:say("tem certeza que deseja reportar: "..msg.."? {yes}", cid) selfSay('tem certeza que deseja reportar: '..msg..'? {yes}') str = msg talkState[talkUser] = 2 else selfSay('minimo 10 letras e máximo 90 letras, incluindo espaços', cid) end elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then if getGlobalStorageValue(87954) == -1 then setGlobalStorageValue(87954, 1) end setPlayerStorageValue(cid, storage, os.time()+delaytime) selfSay('Obrigado, nos agradecemos a sua colaboraçao', cid) f:write(""..getGlobalStorageValue(87954).." - "..getPlayerName(cid).." reported a bug at " .. os.date("%d %B %Y - %X.", os.time()) .."\n"..str..".\n\n----------------------------------------------------------\n") f:close() setGlobalStorageValue(87954, getGlobalStorageValue(87954)+1) doTeleportThing(cid, pos) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) elseif msg == "no" and talkState[talkUser] >= 1 then selfSay("tudo bem então.", cid) str = nil talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) caraca vei vc sabe tudo, to te devendo 4 REP+ ja Link para o comentário https://xtibia.com/forum/topic/186282-sistema-de-contagem-por-report/#findComment-1261157 Compartilhar em outros sites More sharing options...
0 Vilden 137 Postado Maio 17, 2012 Share Postado Maio 17, 2012 Pelo jeito a dúvida foi resolvida, movido. Link para o comentário https://xtibia.com/forum/topic/186282-sistema-de-contagem-por-report/#findComment-1261164 Compartilhar em outros sites More sharing options...
Pergunta
Diley007 1
tenho npc de report onde o report do player vai pra pasta de txt, mas quero que numere...
exemplo: chega 3 player e faz um determinado report, ai la onde for aparecer o report queria que ficasse assim
1 Diley reported a bug at 12 May 2012 - 00:03:40.
2 Lord reported a bug at 12 May 2012 - 00:03:40.
3 Jon reported a bug at 12 May 2012 - 00:03:40.
ir numerando
Link para o comentário
https://xtibia.com/forum/topic/186282-sistema-de-contagem-por-report/Compartilhar em outros sites
3 respostass a esta questão
Posts Recomendados