--[[
<Afk> for TFS 0.2+
Idea by Damadgerz
based on shawak's script , changez by damadgerz
Fixed by the Sync
]]--
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),"afk", 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, "Command param required.")
return true
end
if param == "on" then
if(isPlayer(cid) == TRUE) and (getPlayerStorageValue(cid, 9876) == -1) then
doSendAnimatedText(getPlayerPosition(cid),"afk", math.random(01,255))
say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000, cid)
doPlayerSetNoMove(cid, TRUE)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"You Now Stated you are (afk).")
setPlayerStorageValue(cid, 9876, 5)
else
doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"You have already stated that you are AFK.")
end
elseif param == "off" then
stopEvent(say_events[getPlayerGUID(cid)])
say_events[getPlayerGUID(cid)] = nil
doPlayerSetNoMove(cid, FALSE)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"You Now stated your are not (afk).")
setPlayerStorageValue(cid, 9876, -1)
end
return TRUE
end