• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction A little funny <afk> script

Mapper

Fippex's Avatar

Join Date: Jan 2009
Location: Sweden ofc ;)
Posts: 462
Reputation: Fippex has a spectacular aura aboutFippex has a spectacular aura aboutFippex has a spectacular aura about

Add to Fippex's Reputation

Send a message via MSN to Fippex

Could u make it so when you are moving it goes off? and if you havn't been moving for more then X minutes it goes on?

Would be awsome if so!
 
@up

Lua:
function onThink(interval, lastExecution, thinkInterval)
for _, pid in ipairs(getPlayersOnline()) do
    if getPlayerIdleTime(pid) > 1 * 1000 * 60 then
         doSendAnimatedText(getCreaturePosition(pid), "AFK", TEXTCOLOR_WHITE)
    end
end
return TRUE
end

PHP:
<globalevent name="afk" interval="1" event="script" value="afk.lua"/>
 
@up

Lua:
function onThink(interval, lastExecution, thinkInterval)
for _, pid in ipairs(getPlayersOnline()) do
    if getPlayerIdleTime(pid) > 1 * 1000 * 60 then
         doSendAnimatedText(getCreaturePosition(pid), "AFK", TEXTCOLOR_WHITE)
    end
end
return TRUE
end

PHP:
<globalevent name="afk" interval="1" event="script" value="afk.lua"/>


thats for moving and standing stilL?
 
Haha xD

Nice script btw :)

hehe(thought no onr got it)

Mapper




Fippex's Avatar

Join Date: Jan 2009
Location: Sweden ofc ;)
Posts: 462
Reputation: Fippex has a spectacular aura aboutFippex has a spectacular aura aboutFippex has a spectacular aura about

Add to Fippex's Reputation

Send a message via MSN to Fippex

Could u make it so when you are moving it goes off? and if you havn't been moving for more then X minutes it goes on?

Would be awsome if so!
srry i was away for 5 days so didnt saw any posts ,anyway i guess arthec just answerd u
 
Looks great.
Can you edit it so that you can only say afk "on once? AND if your character takes a step afk "off automatically activates?

That'd make this script PERFECT!

Red
 
function?

@up

Lua:
function onThink(interval, lastExecution, thinkInterval)
for _, pid in ipairs(getPlayersOnline()) do
    if getPlayerIdleTime(pid) > 1 * 1000 * 60 then
         doSendAnimatedText(getCreaturePosition(pid), "AFK", TEXTCOLOR_WHITE)
    end
end
return TRUE
end

PHP:
<globalevent name="afk" interval="1" event="script" value="afk.lua"/>

is function getPlayerIdleTime registered under 0.3.4pl2 ?
if its not, is it possible to do it? how would it be?

thanks :)
 
Lua:
--[[ 
    <Afk> for TFS 0.2+
    
    Idea 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)
        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
            doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"You Now stated your are not (afk).")
           setPlayerStorageValue(cid, 9876, -1)
    end
    return TRUE
end

This way if you say !afk "on repeadtly instead of it Spamming Afk above ur head really fast itll send

Code:
You have already stated that you are AFK.
 
Back
Top