Hello pals! I've a problem with a script i try to make, is just a lever that when is pushed player, object or w/e thing that is place over those tile will teleport to his place, the problem that I found is that give me a error when there isn't place something over the tile something that is bugging me xD, so in conclusion I just want to know if someone is kind enough to give me a help.
This is the script:
This work but if one tile dont have player give error:
I know that this means that a object/player was not found in the tiles, but i don't know how to solve since i'm not a scripter, just search for some script and try to make this but was not perfect xD
Thanks in advance.
PS; Sorry for my english.
PS2; Also I don't want to force player to need a team of x player, just push lever and player go tped.
This is the script:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8 = {x=1104,y=948,z=6, stackpos=253}, {x=1105,y=948,z=6, stackpos=253}, {x=1106,y=948,z=6, stackpos=253}, {x=1107,y=948,z=6, stackpos=253}, {x=1109,y=948,z=6, stackpos=253}, {x=1110,y=948,z=6, stackpos=253}, {x=1111,y=948,z=6, stackpos=253}, {x=1112,y=948,z=6, stackpos=253}
local newpos1, newpos2, newpos3, newpos4, newpos5, newpos6, newpos7, newpos8 = {x=1103,y=956,z=7}, {x=1103,y=959,z=7}, {x=1105,y=954,z=7}, {x=1105,y=961,z=7}, {x=1110,y=954,z=7}, {x=1110,y=961,z=7}, {x=1112,y=956,z=7}, {x=1112,y=959,z=7}
local thing = getThingFromPos
if item.itemid == 1945 then
doTeleportThing(thing(pos1).uid, newpos1)
doTeleportThing(thing(pos2).uid, newpos2)
doTeleportThing(thing(pos3).uid, newpos3)
doTeleportThing(thing(pos4).uid, newpos4)
doTeleportThing(thing(pos5).uid, newpos5)
doTeleportThing(thing(pos6).uid, newpos6)
doTeleportThing(thing(pos7).uid, newpos7)
doTeleportThing(thing(pos8).uid, newpos8)
end
return TRUE
end
This work but if one tile dont have player give error:
Code:
[24/7/2011 7:28:21] data/actions/scripts/palanca.lua:onUse
[24/7/2011 7:28:21] Description:
[24/7/2011 7:28:21] (luaDoTeleportThing) Thing not found
I know that this means that a object/player was not found in the tiles, but i don't know how to solve since i'm not a scripter, just search for some script and try to make this but was not perfect xD
Thanks in advance.
PS; Sorry for my english.
PS2; Also I don't want to force player to need a team of x player, just push lever and player go tped.