Lava Titan
Developer
Need help fixing this script can someone help me?
When i use the item on the floor it says "There is not enought room"
When i use it on floor it should create a teleport for 10 seconds that would tp me to the pos [X:1000 Y:1000 Z:7]
When i use the item on the floor it says "There is not enought room"
When i use it on floor it should create a teleport for 10 seconds that would tp me to the pos [X:1000 Y:1000 Z:7]
LUA:
local exhaust = {
storage = 3333,
duration = 60
}
local config = {
teleport_pos = {x=1000,y=1000,z=7},
distance_effect = CONST_ANI_FIRE,
area_effect = CONST_ME_FIREAREA
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if toPosition.x ~= 65535 and hasProperty(itemEx.uid, CONST_PROP_BLOCKSOLID) == FALSE and itemEx.itemid ~= 1387 then
if (os.time() - getPlayerStorageValue(cid, exhaust.storage)) >= exhaust.duration then
local teleport = doCreateTeleport(1387, config.teleport_pos, toPosition)
doSendDistanceShoot(getPlayerPosition(cid), toPosition, config.distance_effect)
doSendMagicEffect(toPosition, config.area_effect)
setPlayerStorageValue(cid, exhaust.storage, os.time())
addEvent(countdown, 0, {position = toPosition, text = "10"})
addEvent(countdown, 1000, {position = toPosition, text = "9"})
addEvent(countdown, 2000, {position = toPosition, text = "8"})
addEvent(countdown, 3000, {position = toPosition, text = "7"})
addEvent(countdown, 4000, {position = toPosition, text = "6"})
addEvent(countdown, 5000, {position = toPosition, text = "5"})
addEvent(countdown, 6000, {position = toPosition, text = "4"})
addEvent(countdown, 7000, {position = toPosition, text = "3"})
addEvent(countdown, 8000, {position = toPosition, text = "2"})
addEvent(countdown, 9000, {position = toPosition, text = "1"})
addEvent(removePortal, 10000, {pos = getThingPos(teleport)})
else
doPlayerSendCancel(cid, "You cannot use this yet.")
return TRUE
end
else
doPlayerSendCancel(cid, "There is not enough room.")
return TRUE
end
return TRUE
end
function countdown(parameters)
doSendAnimatedText(parameters.position, parameters.text, TEXTCOLOR_RED)
end
function removePortal(parameters)
doRemoveItem(getThingfromPos(parameters.pos).uid)
doSendMagicEffect(parameters.pos, CONST_ME_FIREATTACK)
end