falls13
New Member
- Joined
- Nov 3, 2015
- Messages
- 29
- Reaction score
- 1
tfs 0 3 6
local monster = {"demon", {x = 1, y = 1, z = 1}}
local timetoremove = {2, "min"}
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if getCreatureByName(monster[1]) then return true end
local m = doCreateMonster(monster[1], monster[2])
addEvent(function() if isMonster(m) then doRemoveCreature(m) end end, mathtime(timetoremove) * 1000)
return true
end
function mathtime(table) -- by dwarfer
local unit = {"sec", "min", "hour", "day"}
for i, v in pairs(unit) do
if v == table[2] then
return table[1](60^(v == unit[4] and 2 or i-1))(v == unit[4] and 24 or 1)
end
end
return error("Bad declaration in mathtime function.")
end
local monster = {"demon", {x = 1, y = 1, z = 1}}
local timetoremove = {2, "min"}
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if getCreatureByName(monster[1]) then return true end
local m = doCreateMonster(monster[1], monster[2])
addEvent(function() if isMonster(m) then doRemoveCreature(m) end end, mathtime(timetoremove) * 1000)
return true
end
function mathtime(table) -- by dwarfer
local unit = {"sec", "min", "hour", "day"}
for i, v in pairs(unit) do
if v == table[2] then
return table[1](60^(v == unit[4] and 2 or i-1))(v == unit[4] and 24 or 1)
end
end
return error("Bad declaration in mathtime function.")
end