Use esse.
Na xml da talk:
<talkaction words="!afk" event="script" access="5" value="afk.lua"/>
crie o afk.lua na pasta data/talkaction/script
local time = 5 -- 1 = 1 sec, 2 = 2 sec, ...
local say_events = {}
local function SayText(cid)
if isPlayer(cid) == TRUE then
if say_events[getPlayerGUID(cid)] ~= nil then
if isPlayer(cid) == TRUE then
doSendAnimatedText(getPlayerPosition(cid),"Ausente!", math.random(01,255))
end
say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000 / 2, cid)
end
end
return TRUE
end
function onSay(cid, words, param, channel)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Utilize '!afk on'
para ligar e '!afk off' para desligar.")
return true
end
if param == "on" then
if isPlayer(cid) == TRUE then
doSendAnimatedText(getPlayerPosition(cid),"Ausente!", math.random(01,255))
end
say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000, cid)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você está em modo 'Afk'.")
elseif param == "off" then
stopEvent(say_events[getPlayerGUID(cid)])
say_events[getPlayerGUID(cid)] = nil
doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você não está mais em modo
'Afk'.")
end
return TRUE
end
--[[
local function hora ()
if isPlayer(cid) == TRUE then
doPlayerSendCancel(cid,"S\ão: "..os.date("%X")..".")
addEvent(hora, 1000)
end
end
]]




info
Grupo: Campones
Registrado: 29/08/11
Posts: 4
Reputação: 0
Char no Tibia: [ADM] Forever
Galera, acho que estou postando na area correta..O meu !afk on está bugado, o player usa !afk on e fica parado, travado sem sair do lugar, porem alem disso ele pode pegar PK e os outros players nao podem ataca-lo, gostaria de saber pelo menos como faço para excluir esse sistema, pois no talkactions.xml nao tem nada com words=!afk e no scripts do talkactions eu ja exclui o afk.lua e nada..o que eu faço? ai está meu afk.lua, porem mesmo eu excluindo ele, continua o sistema !afk on bugado
local function doSendAutoMessage(cid, pos)
local FRASES = {"Away!", "AFK!", "No here!"}
local TEMPO = 5
local npos = getThingPos(cid)
if (isCreature(cid) == TRUE) then
if (pos.x == npos.x) and (pos.y == npos.y) and (pos.z == npos.z) then
doSendAnimatedText(pos, FRASES[math.random(#FRASES)], 5914)
doSendMagicEffect(pos, 59)
addEvent(doSendAutoMessage, TEMPO*1000, cid, npos)
end
end
end
function onSay(cid, words, param)
pos = getThingPos(cid)
doSendAnimatedText(pos, FRASES[math.random(#FRASES)], 5914)
doSendMagicEffect(pos, 59)
addEvent(doSendAutoMessage, TEMPO*1000, cid, pos)
doPlayerSendCancel(cid, "You are in 'Afk' mode.")
return TRUE
end