Paulix
Active Member
- Joined
- Sep 13, 2012
- Messages
- 151
- Solutions
- 8
- Reaction score
- 36
I have the following script, that blocks a certain area once a player goes in
but if someone throws something above the walkable rock, it remove this item instead, and when it creates another rock it gets 2, making it glitch the next time someone steps in. I would like to remove all items from that pos before creating the rock to block the path. Server is tfs 0.4.3
LUA:
function onStepIn(cid, item, pos)
pos1 = {x=1119, y=874, z=8, stackpos=1}
pos2 = {x=1122, y=873, z=8, stackpos=1}
pos3= {x=1124, y=875, z=8, stackpos=1}
rock1 = getThingfromPos(pos1)
rock2 = getThingfromPos(pos2)
rock3 = getThingfromPos(pos3)
if item.actionid == 20000 then
--if player
--moveplayer
--end
doRemoveItem(rock1.uid, 1)
newrock1 = doCreateItem(3608, 1, pos1)
end
if item.actionid == 20001 then
--if player
--moveplayer
--end
doRemoveItem(rock2.uid, 1)
newrock1 = doCreateItem(3608, 1, pos2)
end
if item.actionid == 20002 then
--if player
--moveplayer
--end
doRemoveItem(rock3.uid, 1)
newrock1 = doCreateItem(3608, 1, pos3)
end
end
function onStepOut(cid, item, pos)
pos1 = {x=1119, y=874, z=8, stackpos=1}
pos2 = {x=1122, y=873, z=8, stackpos=1}
pos3= {x=1124, y=875, z=8, stackpos=1}
rock1 = getThingfromPos(pos1)
rock2 = getThingfromPos(pos2)
rock3 = getThingfromPos(pos3)
if item.actionid == 20000 then
doRemoveItem(rock1.uid, 1)
newrock1 = doCreateItem(3610, 1, pos1)
end
if item.actionid == 20001 then
doRemoveItem(rock2.uid, 1)
newrock1 = doCreateItem(3610, 1, pos2)
end
if item.actionid == 20002 then
doRemoveItem(rock3.uid, 1)
newrock1 = doCreateItem(3610, 1, pos3)
end
end