meu velho, no npc você não usa "param", você usa "msg"!
Script Npc De Reports...tem Como Ajudar ?
Por Diley007, 10 de mai. de 2012 em Scripts
info
Grupo: Herói
Registrado: 20/05/10
Posts: 3.4k
Reputação: +1.5k
Gênero: Masculino

info
Grupo: Artesão
Registrado: 17/01/12
Posts: 137
Reputação: -1
Char no Tibia: Nao Tenho

meu velho, no npc você não usa "param", você usa "msg"!
entao nao tem como ?
meu velho, no npc você não usa "param", você usa "msg"!
entao nao tem como ?
n tem como fazer um npc, que vc fala "hi" e ele te pergunte algo e sua resposta va para o "data/logs/reports" ????
info
Grupo: Herói
Registrado: 20/05/10
Posts: 3.4k
Reputação: +1.5k
Gênero: Masculino

meu velho, no npc você não usa "param", você usa "msg"!
entao nao tem como ?
meu velho, no npc você não usa "param", você usa "msg"!
entao nao tem como ?
n tem como fazer um npc, que vc fala "hi" e ele te pergunte algo e sua resposta va para o "data/logs/reports" ????
tem sim, já já eu faço amiguinho
info
Grupo: Artesão
Registrado: 17/01/12
Posts: 137
Reputação: -1
Char no Tibia: Nao Tenho

meu velho, no npc você não usa "param", você usa "msg"!
entao nao tem como ?
meu velho, no npc você não usa "param", você usa "msg"!
entao nao tem como ?
n tem como fazer um npc, que vc fala "hi" e ele te pergunte algo e sua resposta va para o "data/logs/reports" ????
tem sim, já já eu faço amiguinho
vlw vei REP+
info
Grupo: Herói
Registrado: 20/05/10
Posts: 3.4k
Reputação: +1.5k
Gênero: Masculino

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/reports.txt"
local f = io.open(a, "a+")
if isInArray({"report","bug","reportar"}, msg) then
if (getPlayerStorageValue(cid, storage) <= os.time()) then
npcHandler:say("diga a mensagem que você quer reportar por favor!", cid)
talkState[talkUser] = 1
else
npcHandler:say("You must wait " .. getPlayerStorageValue(cid, storage) - os.time() .. " seconds to report.", cid)
talkState[talkUser] = 0
end
elseif talkState[talkUser] == 1 then
setPlayerStorageValue(cid, storage, os.time()+delaytime)
npcHandler:say("Your report has been received successfully!", cid)
f:write(""..getPlayerName(cid).." reported a bug at " .. os.date("%d %B %Y - %X.", os.time()) .."\n "..msg..".\n\n----------------------------------------------------------\n")
f:close()
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
info
Grupo: Artesão
Registrado: 17/01/12
Posts: 137
Reputação: -1
Char no Tibia: Nao Tenho

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/reports.txt" local f = io.open(a, "a+") if isInArray({"report","bug","reportar"}, msg) then if (getPlayerStorageValue(cid, storage) <= os.time()) then npcHandler:say("diga a mensagem que você quer reportar por favor!", cid) talkState[talkUser] = 1 else npcHandler:say("You must wait " .. getPlayerStorageValue(cid, storage) - os.time() .. " seconds to report.", cid) talkState[talkUser] = 0 end elseif talkState[talkUser] == 1 then setPlayerStorageValue(cid, storage, os.time()+delaytime) npcHandler:say("Your report has been received successfully!", cid) f:write(""..getPlayerName(cid).." reported a bug at " .. os.date("%d %B %Y - %X.", os.time()) .."\n "..msg..".\n\n----------------------------------------------------------\n") f:close() talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
OMG vlw




info
Grupo: Artesão
Registrado: 17/01/12
Posts: 137
Reputação: -1
Char no Tibia: Nao Tenho
fiquei em duvida entre pedidos de script e npc... se essa nao for a area pesso desculpas e movam por favor...
esse e o script de report, bom eu quero fazer um npc de reports, onde o player fala "hi" e depois escreve o report, e esse report va para data/logs/reports.txt (como mostrado em vermelho) REP+ pra quem ajudar
OBS: a intençao nao e fazer um npc de reports mais usar o sistema de reports, so que preciso do npc
data/talkactions/script
function onSay(cid, words, param, channel)
local storage = 6707
local delaytime = 120
local a = "data/logs/reports.txt"
local f = io.open(a, "a+")
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
return true
end
local exhaust = exhaustion.get(cid, storage)
if(not exhaust) then
exhaustion.set(cid, storage, delaytime)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your report has been received successfully!")
f:write(""..getPlayerName(cid).." reported a bug at " .. os.date("%d %B %Y - %X.", os.time()) .."\n"..param.." [x=..getPlayerPosition(cid).x..", y="..getPlayerPosition(cid).y..", z="..getPlayerPosition(cid).z..].\n\n----------------------------------------------------------\n")
f:close()
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You must wait " .. exhaustion.get(cid, storage) .. " seconds to report.")
end
return TRUE
end
data/talkactions
<talkaction log="yes" words="/player report" filter="word-spaced" event="script" value="playereport.lua"/>