heres my script:
The problem is, if theres a creature or a player on one of those 4 sqms( jedynka, dwojka, trojka, czworka) then the player that switched the levers gets teleported to NEWPOS, i want only the creature or a player gets teleported thats standing on one of those 4 sqms.
Code:
local tile1pos = {x=32911, y=32209, z=15, stackpos=0}
local tile2pos = {x=32912, y=32209, z=15, stackpos=0}
local tile3pos = {x=32911, y=32210, z=15, stackpos=0}
local tile4pos = {x=32912, y=32210, z=15, stackpos=0}
local lever1pos = {x=32915, y=32215, z=15, stackpos=1}
local lever2pos = {x=32908, y=32207, z=15, stackpos=1}
local jedynka = {x=32911, y=32209, z=15, stackpos=0}
local dwojka = {x=32912, y=32209, z=15, stackpos=0}
local trojka = {x=32911, y=32210, z=15, stackpos=0}
local czworka = {x=32912, y=32210, z=15, stackpos=0}
local newpos = {x=32911, y=32211, z=15}
function onUse(cid, item, frompos, item2, topos)
local tile1 = getThingfromPos(tile1pos)
local tile2 = getThingfromPos(tile2pos)
local tile3 = getThingfromPos(tile3pos)
local tile4 = getThingfromPos(tile4pos)
local lever1 = getThingfromPos(lever1pos)
local lever2 = getThingfromPos(lever2pos)
if (item.itemid == 1945 and tile1.itemid == 598 and tile2.itemid == 598 and tile3.itemid == 598 and tile4.itemid == 598) then
doTransformItem(tile1.uid,407)
doTransformItem(tile2.uid,407)
doTransformItem(tile3.uid,407)
doTransformItem(tile4.uid,407)
doTransformItem(lever1.uid,1946)
doTransformItem(lever2.uid,1946)
elseif (item.itemid == 1946 and tile1.itemid == 407 and tile2.itemid == 407 and tile3.itemid == 407 and tile4.itemid == 407) then
doTransformItem(tile1.uid,598)
doTransformItem(tile2.uid,598)
doTransformItem(tile3.uid,598)
doTransformItem(tile4.uid,598)
doTransformItem(lever1.uid,1945)
doTransformItem(lever2.uid,1945)
jedynka.stackpos = 253
dwojka.stackpos = 253
trojka.stackpos = 253
czworka.stackpos = 253
if getThingFromPos(jedynka).itemid > 0 or getThingFromPos(dwojka).itemid > 0 or getThingFromPos(trojka).itemid > 0 or getThingFromPos(czworka).itemid > 0 then
doTeleportThing(cid, newpos)
end
end
return 1
end
The problem is, if theres a creature or a player on one of those 4 sqms( jedynka, dwojka, trojka, czworka) then the player that switched the levers gets teleported to NEWPOS, i want only the creature or a player gets teleported thats standing on one of those 4 sqms.