Thorn
Spriting since 2013
hello guys, im using tfs 1.3 and i got this script from otx global, but it has a bug and i have no idea how to fix it
if the person uses the key in the shrine (key in his bp) it dissapears, but if the player put the key in the ground and use it on the shrine, the key remains in the floor :S
is there anyway to fix this? making the key dissapear or making imopssible to use it from the ground? :S
if the person uses the key in the shrine (key in his bp) it dissapears, but if the player put the key in the ground and use it on the shrine, the key remains in the floor :S
is there anyway to fix this? making the key dissapear or making imopssible to use it from the ground? :S
Code:
local function isPlayerInArea(fromPos, toPos)
for _x = fromPos.x, toPos.x do
for _y = fromPos.y, toPos.y do
for _z = fromPos.z, toPos.z do
creature = getTopCreature({x = _x, y = _y, z = _z})
if (isPlayer(creature.uid)) then
return true
end
end
end
end
return false
end
function onUse(cid, item, fromPosition, itemEx)
local player = Player(cid)
if not player then
return true
end
if(item.itemid == 22607) then
if(itemEx.itemid == 22641) then
if player:getStorageValue(1) and not isPlayerInArea({x = 545, y = 1689, z = 12, stackpos = 255}, {x = 564, y = 1704, z = 12, stackpos = 255}) then
pos1 = {x = 633, y = 1724, z = getCreaturePosition(cid).z}
pos2 = {x = 634, y = 1724, z = getCreaturePosition(cid).z}
pos3 = {x = 635, y = 1724, z = getCreaturePosition(cid).z}
pos4 = {x = 636, y = 1724, z = getCreaturePosition(cid).z}
pos5 = {x = 637, y = 1724, z = getCreaturePosition(cid).z}
if(isPlayer(getTopCreature(pos1).uid)) then
if(isPlayer(getTopCreature(pos2).uid)) then
if(isPlayer(getTopCreature(pos3).uid)) then
if(isPlayer(getTopCreature(pos4).uid)) then
if(isPlayer(getTopCreature(pos5).uid)) then
doTeleportThing(getTopCreature(pos1).uid, {x = 554, y = 1703, z = 12})
doTeleportThing(getTopCreature(pos2).uid, {x = 554, y = 1703, z = 12})
doTeleportThing(getTopCreature(pos3).uid, {x = 554, y = 1703, z = 12})
doTeleportThing(getTopCreature(pos4).uid, {x = 554, y = 1703, z = 12})
doTeleportThing(getTopCreature(pos5).uid, {x = 554, y = 1703, z = 12})
-- doSummonCreature("prince drazzak", {x=33528, y=32333, z=12})
local monster = Game.createMonster("Jiren", Position(554, 1695, 12))
monster:setReward(true)
doRemoveItem(item.uid, 1)
end
end
end
end
end
end
end
end
return true
end