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

Lua Movements -> adjust script

tiag0_bn

Well-Known Member
Joined
Dec 8, 2011
Messages
181
Reaction score
50
i need to put a 1min exhausted in stepout to get back stepin.. could someone help me
thx

Lua:
local config1 = {
   timer = 30, -- time in minutes (0.1 = 6 seconds, for easy testing)
   teleport = {x = 32406, y = 32194, z = 7} -- teleport position   
}

kick_player = {}

local function kickPlayer(cid)
   if not isPlayer(cid) then
       return true
   end
   doTeleportThing(cid, config1.teleport)
   return true
end

local function stopKick(cid)
   if stopEvent(kick_player[cid]) then
       if not isPlayer(cid) then
           return true
       end
       doPlayerSendTextMessage(cid, 23, "You will no longer be forcibly logged out.")
   end
   return true
end



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

local config = {
    monsterName = "Trainer Monk", -- Name of Monster
    spawningTileID = 5737, -- Tile ID where monster should spawn
    effectSummon = CONST_ME_FIREATTACK, -- effect that should appear when monster spawns
    positions = {
        [1] = {x = (position.x - 1), y = (position.y - 1), z = position.z},
        [2] = {x = (position.x + 1), y = (position.y - 1), z = position.z},
        [3] = {x = (position.x - 1), y = (position.y + 1), z = position.z},
        [4] = {x = (position.x + 1), y = (position.y + 1), z = position.z}
    }
}

    if not isPlayer(cid) then
        return true
    end

    for i=1, #config.positions do
        if getTileThingByPos(config.positions[i]).itemid == config.spawningTileID then
         doSendMagicEffect(config.positions[i], config.effectSummon)
         doCreateMonster(config.monsterName, config.positions[i])
         kick_player[cid] = addEvent(kickPlayer, config1.timer * 60 * 1000, cid)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Trainer]: If you remain on this tile longer then " .. config1.timer .. " minutes, the system will automatically kick.")
       return true
        end
    end

return true
end

function onStepOut(cid, item, position, fromPosition)
  if(not isPlayer(cid)) then
     return true
end

local config = {
    monsterName = "Trainer Monk", -- Name of Monster
    effectRemove = CONST_ME_POFF, -- effect that should appear when monster is removed
    positions = {
        [1] = {x = (fromPosition.x - 1), y = (fromPosition.y - 1), z = fromPosition.z, stackpos = 253},
        [2] = {x = (fromPosition.x + 1), y = (fromPosition.y - 1), z = fromPosition.z, stackpos = 253},
        [3] = {x = (fromPosition.x - 1), y = (fromPosition.y + 1), z = fromPosition.z, stackpos = 253},
        [4] = {x = (fromPosition.x + 1), y = (fromPosition.y + 1), z = fromPosition.z, stackpos = 253}
    }
}

    if not isPlayer(cid) then
        return true
    end
  
    for i=1, #config.positions do
        if isMonster(getThingFromPos(config.positions[i]).uid) then
            if getCreatureName(getThingFromPos(config.positions[i]).uid) == config.monsterName then
               doRemoveCreature(getThingFromPos(config.positions[i]).uid)
               doSendMagicEffect(config.positions[i], config.effectRemove)
                addEvent(stopKick, 0, cid)
                 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Trainer]: Time train canceled")
      
                return true
            end
        end
    end
  
return true
end
 
Solution
i need to put a 1min exhausted in stepout to get back stepin.. could someone help me
thx

Lua:
local config1 = {
   timer = 30, -- time in minutes (0.1 = 6 seconds, for easy testing)
   teleport = {x = 32406, y = 32194, z = 7} -- teleport position  
}

kick_player = {}

local function kickPlayer(cid)
   if not isPlayer(cid) then
       return true
   end
   doTeleportThing(cid, config1.teleport)
   return true
end

local function stopKick(cid)
   if stopEvent(kick_player[cid]) then
       if not isPlayer(cid) then
           return true
       end
       doPlayerSendTextMessage(cid, 23, "You will no longer be forcibly logged out.")
   end
   return true
end



function onStepIn(cid, item, position, fromPosition)
  if(not...
i need to put a 1min exhausted in stepout to get back stepin.. could someone help me
thx

Lua:
local config1 = {
   timer = 30, -- time in minutes (0.1 = 6 seconds, for easy testing)
   teleport = {x = 32406, y = 32194, z = 7} -- teleport position  
}

kick_player = {}

local function kickPlayer(cid)
   if not isPlayer(cid) then
       return true
   end
   doTeleportThing(cid, config1.teleport)
   return true
end

local function stopKick(cid)
   if stopEvent(kick_player[cid]) then
       if not isPlayer(cid) then
           return true
       end
       doPlayerSendTextMessage(cid, 23, "You will no longer be forcibly logged out.")
   end
   return true
end



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

local config = {
    monsterName = "Trainer Monk", -- Name of Monster
    spawningTileID = 5737, -- Tile ID where monster should spawn
    effectSummon = CONST_ME_FIREATTACK, -- effect that should appear when monster spawns
    positions = {
        [1] = {x = (position.x - 1), y = (position.y - 1), z = position.z},
        [2] = {x = (position.x + 1), y = (position.y - 1), z = position.z},
        [3] = {x = (position.x - 1), y = (position.y + 1), z = position.z},
        [4] = {x = (position.x + 1), y = (position.y + 1), z = position.z}
    }
}

    if not isPlayer(cid) then
        return true
    end

    for i=1, #config.positions do
        if getTileThingByPos(config.positions[i]).itemid == config.spawningTileID then
         doSendMagicEffect(config.positions[i], config.effectSummon)
         doCreateMonster(config.monsterName, config.positions[i])
         kick_player[cid] = addEvent(kickPlayer, config1.timer * 60 * 1000, cid)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Trainer]: If you remain on this tile longer then " .. config1.timer .. " minutes, the system will automatically kick.")
       return true
        end
    end

return true
end

function onStepOut(cid, item, position, fromPosition)
  if(not isPlayer(cid)) then
     return true
end

local config = {
    monsterName = "Trainer Monk", -- Name of Monster
    effectRemove = CONST_ME_POFF, -- effect that should appear when monster is removed
    positions = {
        [1] = {x = (fromPosition.x - 1), y = (fromPosition.y - 1), z = fromPosition.z, stackpos = 253},
        [2] = {x = (fromPosition.x + 1), y = (fromPosition.y - 1), z = fromPosition.z, stackpos = 253},
        [3] = {x = (fromPosition.x - 1), y = (fromPosition.y + 1), z = fromPosition.z, stackpos = 253},
        [4] = {x = (fromPosition.x + 1), y = (fromPosition.y + 1), z = fromPosition.z, stackpos = 253}
    }
}

    if not isPlayer(cid) then
        return true
    end
 
    for i=1, #config.positions do
        if isMonster(getThingFromPos(config.positions[i]).uid) then
            if getCreatureName(getThingFromPos(config.positions[i]).uid) == config.monsterName then
               doRemoveCreature(getThingFromPos(config.positions[i]).uid)
               doSendMagicEffect(config.positions[i], config.effectRemove)
                addEvent(stopKick, 0, cid)
                 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Trainer]: Time train canceled")
     
                return true
            end
        end
    end
 
return true
end
Try this:

Lua:
local config1 = {
    timer = 30, -- time in minutes (0.1 = 6 seconds, for easy testing)
    teleport = {x = 32406, y = 32194, z = 7} -- teleport position   
}

kick_player = {}
exhaust = exhaust or {}

local function kickPlayer(cid)
    if not isPlayer(cid) then
        return true
    end
    doTeleportThing(cid, config1.teleport)
    return true
end

local function stopKick(cid)
    if stopEvent(kick_player[cid]) then
        if not isPlayer(cid) then
            return true
        end
        doPlayerSendTextMessage(cid, 23, "You will no longer be forcibly logged out.")
    end
    return true
end

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

    if exhaust[cid] and (exhaust[cid] > os.time()) then
        doTeleportThing(cid, fromPosition)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You are exhausted.")
        return true
    end

    local config = {
        monsterName = "Trainer Monk", -- Name of Monster
        spawningTileID = 5737, -- Tile ID where monster should spawn
        effectSummon = CONST_ME_FIREATTACK, -- effect that should appear when monster spawns
        positions = {
            [1] = {x = (position.x - 1), y = (position.y - 1), z = position.z},
            [2] = {x = (position.x + 1), y = (position.y - 1), z = position.z},
            [3] = {x = (position.x - 1), y = (position.y + 1), z = position.z},
            [4] = {x = (position.x + 1), y = (position.y + 1), z = position.z}
        }
    }

    for i=1, #config.positions do
        if getTileThingByPos(config.positions[i]).itemid == config.spawningTileID then
            doSendMagicEffect(config.positions[i], config.effectSummon)
            doCreateMonster(config.monsterName, config.positions[i])
            kick_player[cid] = addEvent(kickPlayer, config1.timer * 60 * 1000, cid)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Trainer]: If you remain on this tile longer then " .. config1.timer .. " minutes, the system will automatically kick.")
            return true
        end
    end

    return true
end

function onStepOut(cid, item, position, fromPosition)
    if not isPlayer(cid) then
        return true
    end

    local config = {
        monsterName = "Trainer Monk", -- Name of Monster
        effectRemove = CONST_ME_POFF, -- effect that should appear when monster is removed
        positions = {
            [1] = {x = (fromPosition.x - 1), y = (fromPosition.y - 1), z = fromPosition.z, stackpos = 253},
            [2] = {x = (fromPosition.x + 1), y = (fromPosition.y - 1), z = fromPosition.z, stackpos = 253},
            [3] = {x = (fromPosition.x - 1), y = (fromPosition.y + 1), z = fromPosition.z, stackpos = 253},
            [4] = {x = (fromPosition.x + 1), y = (fromPosition.y + 1), z = fromPosition.z, stackpos = 253}
        }
    }

    for i=1, #config.positions do
        if isMonster(getThingFromPos(config.positions[i]).uid) then
            if getCreatureName(getThingFromPos(config.positions[i]).uid) == config.monsterName then
                doRemoveCreature(getThingFromPos(config.positions[i]).uid)
                doSendMagicEffect(config.positions[i], config.effectRemove)
                addEvent(stopKick, 0, cid)
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Trainer]: Time train canceled")
                break
            end
        end
    end

    exhaust[cid] = os.time() + 60

    return true
end
 
Solution
Back
Top