darkmu
Well-Known Member
Recently I got this script from the forum, but I would like to know if it is possible to adapt it so that I cannot move or be pulled, can someone help me?
!afk talkaction tfs 1.3
Hello guy, im in need of an !afk script, wich when used, it auto messages: afk :D plzz
otland.net
Lua:
local config = {
msg = 'AFK',
interval = 3000, -- in ms, 1000 ms = 1 s
storage = 12345 -- empty storage
}
local function sendAfkMessage(pid, startPos)
local player = Player(pid)
if not player then
return
end
if player:getStorageValue(config.storage) ~= 1 then
return
end
if player:getPosition() ~= startPos then
return player:toggleAFK()
end
local dir = player:getDirection()
player:setDirection(dir < 3 and dir + 1 or 0)
player:say(config.msg, TALKTYPE_MONSTER_SAY)
mayNotMove(player,true)
return addEvent(sendAfkMessage, config.interval, player.uid, startPos)
end
function Player:toggleAFK()
if self:getStorageValue(config.storage) ~= 1 then
self:setStorageValue(config.storage, 1)
self:sendCancelMessage('You have enabled AFK mode.')
sendAfkMessage(self.uid, self:getPosition())
else
self:setStorageValue(config.storage, 0)
self:sendCancelMessage('You have disabled AFK mode.')
end
end
function onSay(player, words, param)
player:toggleAFK()
return false
end