Ryxan
Spanish Crew
Credits:
[AFK SYSTEM]
Working for TFS 0.3.+
First:
Open "Talkactions Folder" in the (Talkaction.xml) add:
XML:
Second: Open your Talkaction Folder/Script, and create new: "afk.lua" and copy and paste this.
AFK.LUA
If you want to change the Message:
..
REMEMBER:
/commands:
Sreenshoots:
Thanks,
Yours Ryxan.
Damadgerz
JDB
Ryxan
[AFK SYSTEM]
Working for TFS 0.3.+
First:
Open "Talkactions Folder" in the (Talkaction.xml) add:
XML:
Code:
<talkaction words="!afk" event="script" value="afk.lua"/>
Second: Open your Talkaction Folder/Script, and create new: "afk.lua" and copy and paste this.
AFK.LUA
Code:
local time = 3 -- Seconds
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
local storage = 38417
function onSay(cid, words, param, channel)
local afkCheck = getPlayerStorageValue(cid, storage)
if(param == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
return TRUE
end
if (param == "on") then
if (afkCheck == -1) then
if (isPlayer(cid) == TRUE) then
doSendAnimatedText(getPlayerPosition(cid),"AFK", math.random(01,255))
end
say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000, cid)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You are now AFK.")
doCreatureSetNoMove(cid, true)
setPlayerStorageValue(cid, storage, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are already AFK.")
end
elseif (param == "off") then
stopEvent(say_events[getPlayerGUID(cid)])
say_events[getPlayerGUID(cid)] = nil
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Welcome Back!")
doCreatureSetNoMove(cid, false)
setPlayerStorageValue(cid, storage, -1)
end
return TRUE
end
If you want to change the Message:
Code:
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[SIZE="2"][FONT="Arial Black"][FONT="Comic Sans MS"][I][COLOR="Red"]Write here![/COLOR][/I][/FONT][/FONT][/SIZE].")
REMEMBER:
/commands:
Code:
1-!afk on [SIZE="2"][I](For Start the Script)[/I][/SIZE]
2-!afk off [SIZE="2"][I](For Stop the Script)[/I][/SIZE]
Sreenshoots:
Thanks,
Yours Ryxan.
Last edited: