Hey! Me and my companion have made a lever that sends magic effect on 'positions' and a timer that makes you wait before you can do it again.
What we need help with Is that when a player use this lever YOU or CREATURE only get damaged and looses health If you stand on 'Positions!'
Thanks!
What we need help with Is that when a player use this lever YOU or CREATURE only get damaged and looses health If you stand on 'Positions!'
Code:
local t = {
timer = 1,
event = 0
}
local cfg = {
positions = {
{x=2386, y=2539, z=12},
{x=2386, y=2541, z=12},
{x=2386, y=2543, z=12},
{x=2387, y=2538, z=12},
{x=2389, y=2538, z=12},
{x=2397, y=2538, z=12}
}
}
local function addRock(cid)
leverPos = { x=2392, y=2540, z=12, stackpos=1 }
getLever = getThingFromPos(leverPos)
leverID = 1946
doTransformItem(getLever.uid, leverID -1)
t.event = 0
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(not isPlayer(cid)) then
return true
end
if t.event <= 0 and item.actionid == 7050 and item.itemid == 1945 then
for _, t in pairs(cfg.positions) do
doSendMagicEffect(t,6)
end
doPlayerSendTextMessage(cid,21,"")
doTransformItem(item.uid,item.itemid+1)
t.event = addEvent(addRock, t.timer * 1000, getThingPos(item.uid), cid)
else
doPlayerSendTextMessage(cid, 19, "It's powering up!")
doSendMagicEffect(getPlayerPosition(cid), 2)
end
return true
end
Thanks!