• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

[Help] Area damage on creature and player

Nemphis

Veteran OT User
Joined
Jun 22, 2009
Messages
699
Reaction score
441
Location
Sweden
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!'


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!
 
Back
Top