tiag0_bn
Active Member
- Joined
- Dec 8, 2011
- Messages
- 180
- Reaction score
- 47
i need to put a 1min exhausted in stepout to get back stepin.. could someone help me
thx
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