Cheeze1
Banned User
Yo Otland today iam gonna show my afk on / off system hope you enjoy...
First Go to data/talkaction/talkaction.xml there.. put
Then go to data/talkaction/scripts
and make a new lua file called "afk" and put this inside there
You can also change the speed of "afk on" and change text too
Hope you like it
your cheeze1
First Go to data/talkaction/talkaction.xml there.. put
PHP:
<talkaction words="!afk;/commands" event="script" value="afk.lua"/>
and make a new lua file called "afk" and put this inside there
PHP:
--[[
<Afk> for TFS 0.2+
Idea by Damadgerz
based on shawak's script , changez by damadgerz
Fixed by the Sync
]]--
local time = 1 -- 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 ON", math.random(01,255))
end
say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1 / 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 * 1, cid)
doPlayerSetNoMove(cid, false)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"You are now afk.")
setPlayerStorageValue(cid, 9876, 5)
else
doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"You are already 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 are no longer afk.")
setPlayerStorageValue(cid, 9876, -1)
end
return TRUE
end
