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())
DI
Sistema De Contagem Por Report...
Por Diley007, 17 de mai. de 2012 em Scripts
sistema de contagem por repor
4
756
info
Grupo: Herói
Registrado: 20/05/10
Posts: 3.4k
Reputação: +1.5k
Gênero: Masculino

17 de maio de 2012 às 13:07
info
Grupo: Artesão
Registrado: 17/01/12
Posts: 137
Reputação: -1
Char no Tibia: Nao Tenho

17 de maio de 2012 às 13:34
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




info
Grupo: Artesão
Registrado: 17/01/12
Posts: 137
Reputação: -1
Char no Tibia: Nao Tenho
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