ralke
(҂ ͠❛ ෴ ͡❛)ᕤ
- Joined
- Dec 17, 2011
- Messages
- 1,759
- Solutions
- 31
- Reaction score
- 999
- Location
- Santiago - Chile
- GitHub
- ralke23
- Twitch
- ralke23

Hi! I need a little support with this lever, I wonder how can I avoid players from pulling the lever if a player is standing on the rock position? This way the player doesn't stand on the stone if someone else pulls the lever (if it also sends a return message will be nice!). Like is shown here:

Here's the script
LUA:
local stonePosition = Position(1055, 946, 10)
local relocatePosition = Position(1055, 946, 10)
local orcLeverRemoveStone = Action()
function orcLeverRemoveStone.onUse(player, item, fromPosition, target, toPosition, isHotkey)
local tile = Tile(Position(1055, 946, 10))
if item.itemid == 1945 then
local stoneItem = tile:getItemById(1285)
if stoneItem then
stoneItem:remove()
item:transform(1946)
end
else
tile:relocateTo(relocatePosition, true)
Game.createItem(1285, 1, stonePosition)
item:transform(1945)
end
return true
end
orcLeverRemoveStone:uid(9192)
orcLeverRemoveStone:register()
Thanks in advance! Regards ^^