Greetings Otland!
I'am trying to do a bridge with a lever, but as you already maybe know, most of the bridge levers don't check if there is a player at the bridge, so if someone use the lever at the same time as the player is on the bridge, that player will be stuck in the lava / water.
And I want that the lever won't be able to be pulled if there is a player at the bridge.
To edit this "Check if player is on bridge"
I am not sure if this is the right way to do it but
correct me if I am wrong.
another thing I have been thinking about, is that this script shall check every 2 min if there is a creature at the bridge, if not, the bridge shall be removed and the lever turned back as normal
I'am trying to do a bridge with a lever, but as you already maybe know, most of the bridge levers don't check if there is a player at the bridge, so if someone use the lever at the same time as the player is on the bridge, that player will be stuck in the lava / water.
And I want that the lever won't be able to be pulled if there is a player at the bridge.
Code:
local b = {
{x=9848, y=9849, z=11},
{x=9848, y=9848, z=11},
{x=9848, y=9847, z=11},
{x=9848, y=9846, z=11},
{x=9848, y=9845, z=11},
{x=9848, y=9844, z=11},
{x=9848, y=9843, z=11}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local k, v = item.uid, item.itemid
if k == 1015 then
for i = 1, 7 do
doRemoveItem(getTileItemById(b[i], v == 1945 and 598 or 1284).uid)
doCreateItem(v == 1945 and 1284 or 598, 1, b[i])
end
else
doPlayerSendTextMessage(cid, "You can't do that right now")
end
doTransformItem(k, tonumber("194".. (v == 1945 and 6 or 5)))
return TRUE
end
To edit this "Check if player is on bridge"
Code:
local b = {
{x=9848, y=9849, z=11},
{x=9848, y=9848, z=11},
{x=9848, y=9847, z=11},
{x=9848, y=9846, z=11},
{x=9848, y=9845, z=11},
{x=9848, y=9844, z=11},
{x=9848, y=9843, z=11}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local k, v = item.uid, item.itemid
for i = 1, 7 do
local player = getThingfromPos(b[i])
if (player > 0 and isCreature(player) == TRUE) then
doPlayerSendTextMessage(cid, "You can't do that right now")
else
if k == 1015 then
for i = 1, 7 do
doRemoveItem(getTileItemById(b[i], v == 1945 and 598 or 1284).uid)
doCreateItem(v == 1945 and 1284 or 598, 1, b[i])
end
doTransformItem(k, tonumber("194".. (v == 1945 and 6 or 5)))
end
return TRUE
end
I am not sure if this is the right way to do it but
another thing I have been thinking about, is that this script shall check every 2 min if there is a creature at the bridge, if not, the bridge shall be removed and the lever turned back as normal
Last edited: