DI

Npc De Report...ajuda Pra Acrecentar Algumas Coisas Rep+ 3 Dias Seguidos

Por Diley007, 14 de mai. de 2012 em Scripts

npc de report
17
3.1k
HisashiitYamagutiH
16 de maio de 2012 às 22:09

Tópico movido para Dúvidas/Pedidos Sanados.

Obs: pelo que eu entendi, o Vodkart resolveu a dúvida de tal usuário no post:

 

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.')
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
setPlayerStorageValue(cid, storage, os.time()+delaytime)
selfSay('Obrigado, nos agradecemos a sua colaboraçao', cid)
f:write(""..getPlayerName(cid).." reported a bug at " .. os.date("%d %B %Y - %X.", os.time()) .."\n "..str..".\n\n----------------------------------------------------------\n")
f:close()
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())

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.')
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
setPlayerStorageValue(cid, storage, os.time()+delaytime)
selfSay('Obrigado, nos agradecemos a sua colaboraçao', cid)
f:write(""..getPlayerName(cid).." reported a bug at " .. os.date("%d %B %Y - %X.", os.time()) .."\n "..str..".\n\n----------------------------------------------------------\n")
f:close()
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())

 

Obrigado por sempre estar ajudando nos Pedidos/Dúvidas sobre Scripting Vodkart.

Diley007D
16 de maio de 2012 às 22:10

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.')
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
setPlayerStorageValue(cid, storage, os.time()+delaytime)
selfSay('Obrigado, nos agradecemos a sua colaboraçao', cid)
f:write(""..getPlayerName(cid).." reported a bug at " .. os.date("%d %B %Y - %X.", os.time()) .."\n "..str..".\n\n----------------------------------------------------------\n")
f:close()
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())

vlw rep+ hj amanha e depois :D