• 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!

TFS 1.X+ Monster invisible.

OTcreator

Active Member
Joined
Feb 14, 2022
Messages
425
Solutions
1
Reaction score
44
Is it possible for the monster the player is attacking to perform invisibility for 5 seconds if the player's IP is zero or to make him perform invisibility every 15 minutes after attacking him ?
 
Lua:
-- Example CreatureScript for TFS

local targetTimers = {}  -- Table to store timers for each player

function onCreatureAppear(creature)
  -- This function is called when the monster becomes visible
  -- You may want to reset any timers or conditions here
end

function onCreatureAttack(creature, target)
  -- Check if the attacker is a player
  if creature:isPlayer() then
    local playerGUID = creature:getGuid()

    -- Check if there is an existing timer for the player
    if targetTimers[playerGUID] then
      -- If the player has been attacking the same creature for 15 minutes, drop the target
      if targetTimers[playerGUID] + 900000 <= os.time() then
        creature:setTarget(nil)
        creature:sendCancelMessage("You have been attacking the same creature for 15 minutes. Your target has been dropped.")
      end
    else
      -- If no timer exists, create one
      targetTimers[playerGUID] = os.time()
    end
  end
end

i guess this is for trainers anti -afk?
 
Lua:
-- Example CreatureScript for TFS

local targetTimers = {}  -- Table to store timers for each player

function onCreatureAppear(creature)
  -- This function is called when the monster becomes visible
  -- You may want to reset any timers or conditions here
end

function onCreatureAttack(creature, target)
  -- Check if the attacker is a player
  if creature:isPlayer() then
    local playerGUID = creature:getGuid()

    -- Check if there is an existing timer for the player
    if targetTimers[playerGUID] then
      -- If the player has been attacking the same creature for 15 minutes, drop the target
      if targetTimers[playerGUID] + 900000 <= os.time() then
        creature:setTarget(nil)
        creature:sendCancelMessage("You have been attacking the same creature for 15 minutes. Your target has been dropped.")
      end
    else
      -- If no timer exists, create one
      targetTimers[playerGUID] = os.time()
    end
  end
end

i guess this is for trainers anti -afk?
i guess this is for trainers anti -afk?
Yes you right. I will try this script, thank you!
 
u can use movements script or something or even add it in action to teleport player outside the trainers after 15min ;p
just make sure to kill timer if he leaves and make it no logout zone
 
Back
Top