adrenyslopez
Member
- Joined
- Dec 22, 2015
- Messages
- 201
- Reaction score
- 15
someone help me to pass this scripts to onUse? let it be by clicking please
Lua:
local config = {
[10804] = {position = Position(33686, 31599, 14)}
}
local MaliceTimer = MoveEvent()
function MaliceTimer.onStepIn(creature, item, position, fromPosition)
local player = creature:getPlayer()
if not player then
return false
end
for index, value in pairs(config) do
if item.actionid == index then
if(item.actionid == 10804)then
if(player:getStorageValue(69805) > os.time())then
creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have faced this boss in the last 20 hours.\nNext time date: " .. os.date("%d/%b/%Y - %X", creature:getStorageValue(69805))..".")
player:teleportTo(fromPosition, true)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
return false
end
end
doSendMagicEffect(player:getPosition(), CONST_ME_TELEPORT)
player:teleportTo(value.position)
doSendMagicEffect(value.position, CONST_ME_TELEPORT)
end
end
end
MaliceTimer:type("stepin")
for index, value in pairs(config) do
MaliceTimer:aid(index)
end
MaliceTimer:register()
function mathtime(table)
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