bolachapanco
Member
How to create a script that when pulling the lever for 4 player is moved to a coordinate and after one hour is moved again to another coordinate.
I tried this without success
LUA:
local config = {
hunt = {
name = "Hunt Cloak",
position = Position(31923, 32363, 7),
maxHuntTime = 30 * 60
},
requiredLevel = 250,
playerPositions = {
{pos = Position(32348, 32362, 8), teleport = Position(31923, 32363, 7), effect = CONST_ME_TELEPORT},
{pos = Position(32348, 32363, 8), teleport = Position(31923, 32363, 7), effect = CONST_ME_TELEPORT},
{pos = Position(32348, 32364, 8), teleport = Position(31923, 32363, 7), effect = CONST_ME_TELEPORT},
{pos = Position(32348, 32365, 8), teleport = Position(31923, 32363, 7), effect = CONST_ME_TELEPORT}
},
exit = Position(33621, 31427, 10),
storage = Storage.HuntPay.HuntTimerCloack
}
local huntCloakLever = Action()
function huntCloakLever.onUse(player, item, fromPosition, target, toPosition, isHotkey)
local storageValue = getPlayerStorageValue(player, config.storage)
if storageValue <= 0 then
doTeleportThing(player, config.hunt.position)
doPlayerSendTextMessage(player, MESSAGE_EVENT_ADVANCE, "You are participating in the hunt.")
setPlayerStorageValue(player, config.storage, os.time() + config.hunt.maxHuntTime)
addEvent(function()
doTeleportThing(player, config.exit)
doPlayerSendTextMessage(player, MESSAGE_EVENT_ADVANCE, "Your time for hunting has ended. You were teleported.")
setPlayerStorageValue(player, config.storage, 0)
end, config.hunt.maxHuntTime * 1000)
else
doPlayerSendTextMessage(player, MESSAGE_EVENT_ADVANCE, "You are already participating in the hunt.")
end
return true
end
huntCloakLever:position({x = 32348, y = 32361, z = 8})
huntCloakLever:register()
I tried this without success