• 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 Moveevents - train room - HELP

tiag0_bn

Well-Known Member
Joined
Dec 8, 2011
Messages
181
Reaction score
50
good morning, I'm using the script below and I need a simple adjustment when I kick and add an exhaust

i need:

creaturescript on death remove fuction kick.
exausted 15s for return tile.
Clean tile spawningTileID, player (config1.teleport) or itens in tile(clean possible or config1.teleport)...


possible
kick the player who killed the monster?

movements

Lua:
local config1 = {
   timer = 60, -- 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)
                return true
            end
        end
    end
 
return true
end

Creaturescript
Lua:
function onLogout(cid)
local fromPosition = getPlayerPosition(cid)
local config = {
    monsterName = "Trainer Monk", -- Name of Monsters
    effectRemove = CONST_ME_POFF,
    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)
            end
        end
    end
return true
end
 
Last edited:
Back
Top