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

Script for kick character

Lais Prad

Disgusting Scammer
Joined
Apr 12, 2017
Messages
153
Solutions
6
Reaction score
15
Hello, an script to give storage for player with minutes, and when minutes gone the player are kicked from room if he was in a room.

Dont is for kick all in room, just the player with the storage

tfs 1.3

thanks
 
Solution
i think thats it

LUA:
local config =
{
  duration = 20*60,
  exitPos = Position(xx, xx, x), -- teleport poss
  centerRoomPosition = Position(xx, xx, xx), -- room center
  exitMessage = "Your time has been expired!"

}

local function doKickPlayer(cid)
  local player = Player(cid)
  if not player then
    return
  end
    player:teleportTo(config.exitPos)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, config.exitMessage)
 
end
function onStepIn(creature, item, position, fromPosition)
    local specs = Game.getSpectators(config.centerRoomPosition, false, false, 20, 20, 20, 20)
    local count = 0
    for i = 1, #specs do
        local spectator = specs[i]
        if spectator:isPlayer()  then
            count = count + 1
        end...
I really don't know how to set it with 1.3 try: or if someone know edit for you please
.
LUA:
local config = {
   storage = 58344,
  cooldown = 60,
  fromPos = {x= ,y= ,z= },
  toPos = {x= ,y= ,z= }
  }

function onThink(cid, interval)
    local player = Player(cid)
        player:getStorageValue(config.storage) >= os.time() then
        addEvent(Templo, config.cooldown * 100, player:getId())
        player:sendTextMessage(TALKTYPE_ORANGE_1, "Voce ja tem acesso.")
      end
    end
    return true
   end

function Templo(cid)
  local player = Player(cid)
    if not player then
        return
    end
for _, pid in ipairs(getPlayersOnline()) do
   if isInArea(getPlayerPosition(pid), config.fromPos, config.toPos) and player:getStorageValue(config.storage) < os.time() then
  player:teleportTo(getPlayerMasterPos(pid))
end
end
end
 
Last edited:
I really don't know how to set it with 1.3 try: or if someone know edit for you please
.
LUA:
local config = {
   storage = 58344,
  cooldown = 60,
  fromPos = {x= ,y= ,z= },
  toPos = {x= ,y= ,z= }
  }

function onThink(cid, interval)
    local player = Player(cid)
        player:getStorageValue(config.storage) >= os.time() then
        addEvent(Templo, config.cooldown * 100, player:getId())
        player:sendTextMessage(TALKTYPE_ORANGE_1, "Voce ja tem acesso.")
      end
    end
    return true
   end

function Templo(cid)
  local player = Player(cid)
    if not player then
        return
    end
for _, pid in ipairs(getPlayersOnline()) do
   if isInArea(getPlayerPosition(pid), config.fromPos, config.toPos)
  player:teleportTo(getPlayerMasterPos(cid))
end
end
end

I think this will kick all players, not only one per one.. hmm,
 
Could you explain it more? Fast, please. I'm a little busy.


It'll fit into a boss room. The player goes on the teleport and will be able to stay in the room for only 20 minutes. After spending 20 minutes this player will be kiked, if the same is still inside the room. The script can not kick another player if it still has time. Example: I entered now, I will have 20 minutes to be kicked, but already there is a player inside with 5 minutes remaining, I can not be kicked at the same time as what was already there, I have to have my 20 minutes.
 
LUA:
local config =
{
  duration = 20*60,
  exitPos = Position(100, 200, 7)
}

local function doKickPlayer(cid)
  local player = Player(cid)
  if not player then
    return
  end
  player:teleportTo(exitPos)
end

-- addEvent(doKickPlayer, config.duration * 1000, myPlayer:getId())

It will teleport the player to exitPos after 20 minutes if you use the addEvent(...).


Regards,
River.
 
LUA:
local config =
{
  duration = 20*60,
  exitPos = Position(100, 200, 7)
}

local function doKickPlayer(cid)
  local player = Player(cid)
  if not player then
    return
  end
  player:teleportTo(exitPos)
end

-- addEvent(doKickPlayer, config.duration * 1000, myPlayer:getId())

It will teleport the player to exitPos after 20 minutes if you use the addEvent(...).


Regards,
River.
Try

Code:
local config =
{
  duration = 20*60,
 
}


local function doKickPlayer(cid)
  local player = Player(cid)
  if not player then
    return
  end
  player:teleportTo({x = xxxx, y = xxxx, z = x})
end

function onStepIn(cid)
    local player = Player(cid)
    if not player then
        return true
    end
    addEvent(doKickPlayer, config.duration * 1000, player:getId())
  player:say('Expired Time!', TALKTYPE_MONSTER_SAY)

end

movements
Code:
<movevent event="StepIn" actionid="xxx" script="xxxx.lua" />

and put the actionid in the entrance teleport
 
Try

Code:
local config =
{
  duration = 20*60,
 
}


local function doKickPlayer(cid)
  local player = Player(cid)
  if not player then
    return
  end
  player:teleportTo({x = xxxx, y = xxxx, z = x})
end

function onStepIn(cid)
    local player = Player(cid)
    if not player then
        return true
    end
    addEvent(doKickPlayer, config.duration * 1000, player:getId())
  player:say('Expired Time!', TALKTYPE_MONSTER_SAY)

end

movements
Code:
<movevent event="StepIn" actionid="xxx" script="xxxx.lua" />

and put the actionid in the entrance teleport


Hello.

I think this would work.


Add this to a file script data/movements/scripts/dungeonEntrance.lua (the file name is dungeonEntrance.lua, also, don't forget to edit the config):

LUA:
local config =
{
  duration = 20*60, -- in seconds
  dungeonPos = Position(500, 700, 8), -- Position to dungeon
  exitPos = Position(100, 200, 7), -- Position of kick
  exitMessage = "Your time has been expired!" -- Message of kick
}


local function doKickPlayer(cid)
  local player = Player(cid)
  if not player then
    return
  end

  if player:teleportTo(exitPos) then
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, exitMessage)
  end
end

function onStepIn(creature, item, position, fromPosition)
  if not creature:isPlayer() then
    return true
  end

  -- Teleport to dungeon position and start to count the time for kick to exitPos automatically
  if creature:teleportTo(dungeonPos) then
    addEvent(doKickPlayer, config.duration * 1000, creature:getId())
  end
  return true
end


Add this to movements.xml:

Code:
<movement event="StepIn" actionid="7777" script="dungeonEntrance.lua" />


Then, go to your map, and add the action id 7777 on the teleport id (DO NOT SET THE POSITION OF TELEPORT THERE). Save your map, and it's done.


Regards,
River.
 
Last edited:
Hello guys, but if the player dont was on room? He will be teleported too, I want one for he teleport only if her was on room.. and teleport only he, if in this room have anothers players, the players will stay, only tp this player who have entered into teleport
 
I can't understand how it works.

The player A enter into the dungeon.
But there was also the player B on the dungeon before.

But only player A entered by the teleport, right?
So, even if player A is on same area of B, only player A will be teleported (kicked), because only player A entered on dungeon by the teleport, the player B do not.

The script is correct.
You don't need to check any area if you want only the players who entered on dungeon by the teleport.


Take a look on the last post.
I added the teleport position to your dungeon/room and an explaination on how to make it works.


Regards,
River.
 
Last edited:
i think thats it

LUA:
local config =
{
  duration = 20*60,
  exitPos = Position(xx, xx, x), -- teleport poss
  centerRoomPosition = Position(xx, xx, xx), -- room center
  exitMessage = "Your time has been expired!"

}

local function doKickPlayer(cid)
  local player = Player(cid)
  if not player then
    return
  end
    player:teleportTo(config.exitPos)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, config.exitMessage)
 
end
function onStepIn(creature, item, position, fromPosition)
    local specs = Game.getSpectators(config.centerRoomPosition, false, false, 20, 20, 20, 20)
    local count = 0
    for i = 1, #specs do
        local spectator = specs[i]
        if spectator:isPlayer()  then
            count = count + 1
        end
    end
    if (count > xx) then -- max players
   check = addEvent(doKickPlayer, config.duration * 1000, creature:getId())
    end
end

function onStepOut(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player or player:isInGhostMode() then
        return true
    end
    return stopEvent(check, cid)
end

in teleport to leave
add action id xxx
Code:
    <movevent event="StepOut" actionid="xxx" script="xxx.lua" />
 
Last edited:
Solution
i think thats it

LUA:
local config =
{
  duration = 20*60,
  exitPos = Position(xx, xx, x), -- teleport poss
  centerRoomPosition = Position(xx, xx, xx), -- room center
  exitMessage = "Your time has been expired!"

}

local function doKickPlayer(cid)
  local player = Player(cid)
  if not player then
    return
  end
    player:teleportTo(config.exitPos)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, config.exitMessage)
 
end
function onStepIn(creature, item, position, fromPosition)
    local specs = Game.getSpectators(config.centerRoomPosition, false, false, 20, 20, 20, 20)
    local count = 0
    for i = 1, #specs do
        local spectator = specs[i]
        if spectator:isPlayer()  then
            count = count + 1
        end
    end
    if (count > xx) then -- max players
   addEvent(doKickPlayer, config.duration * 1000, creature:getId())
 
    end
end

If I enter in teleport and leave in seconds, go to depot thais, the script will teleport me too, because there will have another player inside... understand? wired

PS. If we put an check in teleport to leave there?
 
Back
Top