• 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!

RevScripts check fromPosition - toPosition

alcapone

Member
Joined
Jan 13, 2021
Messages
246
Reaction score
19
Lua:
      positionsArena = {
            fromPosition = Position(1549, 994, 7),
            toPosition = Position(1579, 1020, 7)
        },   


local CastlePrepareDeath = CreatureEvent('CastlePrepareDeath')
function CastlePrepareDeath.onPrepareDeath(player, killer)
 
 
    player:teleportTo(Position(1525, 1032, 7))
    player:setHealth(player:getMaxHealth())
    player:addMana(player:getMaxMana())
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE,'[Event Castle] ' .. player:getName() .. ' was killed.')
 
    return true
end   
CastlePrepareDeath:register()


how could i check this arena to activate only if the player is in it
 
Solution
Lua:
local positionsArena = {
    fromPosition = Position(1549, 994, 7),
    toPosition = Position(1579, 1020, 7)
}

local CastlePrepareDeath = CreatureEvent('CastlePrepareDeath')
function CastlePrepareDeath.onPrepareDeath(player, killer)
     if player:getPosition():isInRange(positionsArena.fromPosition, positionsArena.toPosition) then
        player:teleportTo(Position(1525, 1032, 7))
        player:setHealth(player:getMaxHealth())
        player:addMana(player:getMaxMana())
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE,'[Event Castle] ' .. player:getName() .. ' was killed.')
    end
    return true
end   
CastlePrepareDeath:register()
Lua:
local positionsArena = {
    fromPosition = Position(1549, 994, 7),
    toPosition = Position(1579, 1020, 7)
}

local CastlePrepareDeath = CreatureEvent('CastlePrepareDeath')
function CastlePrepareDeath.onPrepareDeath(player, killer)
     if player:getPosition():isInRange(positionsArena.fromPosition, positionsArena.toPosition) then
        player:teleportTo(Position(1525, 1032, 7))
        player:setHealth(player:getMaxHealth())
        player:addMana(player:getMaxMana())
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE,'[Event Castle] ' .. player:getName() .. ' was killed.')
    end
    return true
end   
CastlePrepareDeath:register()
 
Solution
Lua:
local positionsArena = {
    fromPosition = Position(1549, 994, 7),
    toPosition = Position(1579, 1020, 7)
}

local CastlePrepareDeath = CreatureEvent('CastlePrepareDeath')
function CastlePrepareDeath.onPrepareDeath(player, killer)
     if player:getPosition():isInRange(positionsArena.fromPosition, positionsArena.toPosition) then
        player:teleportTo(Position(1525, 1032, 7))
        player:setHealth(player:getMaxHealth())
        player:addMana(player:getMaxMana())
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE,'[Event Castle] ' .. player:getName() .. ' was killed.')
    end
    return true
end  
CastlePrepareDeath:register()
a doubt is there any way to check floors?
 
Back
Top