• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Afk On/Off System

Cheeze1

Banned User
Joined
Mar 7, 2012
Messages
54
Reaction score
0
Location
IM OTLAND BIGGEST GAY WHORE!!
Yo Otland today iam gonna show my afk on / off system hope you enjoy...
First Go to data/talkaction/talkaction.xml there.. put
PHP:
<talkaction words="!afk;/commands" event="script" value="afk.lua"/>
Then go to data/talkaction/scripts
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
You can also change the speed of "afk on" and change text too :P Hope you like it :) your cheeze1
 
Back
Top