• 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

Code:
function onThink(cid, interval)
	if (getPlayerIdleTime(cid) > 5 * 1000 * 60) then
		doSendAnimatedText(getCreaturePosition(cid), "AFK!", TEXTCOLOR_WHITE)
	end
	return true
end

Xd?


Grrr...
 
Any Idea To Make It Random Coulours? Not Just White :p

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
 
Lua:
    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 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 Now Stated you are (afk).")
     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).")
    end
    return TRUE
end
 
try this :)
Lua:
--[[ 
    <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
 
Ey one thing, PLAYERS DOING THAT, CAN BLOCK PEOPLE ON DP!
BE CAREFULL!
 
can that script update so when someOne Msg the Afk player

it say that player seems to be Afk
 
Why does it say command param required, instead of afk?
 
Back
Top Bottom