• 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 [otbr] Remove money by time

walltimer

Active Member
Joined
Aug 5, 2020
Messages
170
Reaction score
26
I need a script that when player is in position from xyz to xyz it will remove 10 coins (my own id) in each minute, if he wont have it, he will be kicked.
 
Last edited:
data/scripts/remMoneyEvent.lua
Lua:
local config = {
    centerPos = Position(0, 0, 0),
    rangeX = 10,
    rangeY = 10,
    exitPos = Position(0, 0, 0), -- exit pos when player no have money
    price = 10 -- gold coins
}

local remMoneyEvent = GlobalEvent("RemoveMoneyEvent")

function remMoneyEvent.onThink(interval)
    local spectators = Game.getSpectators(config.centerPos, false, true, config.rangeX, config.rangeX, config.rangeY, config.rangeY)
    if #spectators == 0 then
        return true
    end

    for _, player in pairs(spectators) do
        if not player:removeMoney(config.price) then
            player:getPosition():sendMagicEffect(CONST_ME_POFF)
            player:teleportTo(config.exitPos)
            config.exitPos:sendMagicEffect(CONST_ME_TELEPORT)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have been expelled from the area for lack of money.")
        end
    end
    return true
end

remMoneyEvent:interval(1000 * 60) -- 1 minute
remMoneyEvent:register()

You must configure the center of the area, and then establish the distance from the center of the area to its ends, this is defined with rangeX and rangeY, in this way if we have rangeX = 10, then we will search from the center of the room up to 10 sqm towards the <--- and ---> sides and every player who is in this rank will have to pay or otherwise he will be expelled, the same happens with the Y rank, there is nothing more to explain
 
data/scripts/remMoneyEvent.lua
Lua:
local config = {
    centerPos = Position(0, 0, 0),
    rangeX = 10,
    rangeY = 10,
    exitPos = Position(0, 0, 0), -- exit pos when player no have money
    price = 10 -- gold coins
}

local remMoneyEvent = GlobalEvent("RemoveMoneyEvent")

function remMoneyEvent.onThink(interval)
    local spectators = Game.getSpectators(config.centerPos, false, true, config.rangeX, config.rangeX, config.rangeY, config.rangeY)
    if #spectators == 0 then
        return true
    end

    for _, player in pairs(spectators) do
        if not player:removeMoney(config.price) then
            player:getPosition():sendMagicEffect(CONST_ME_POFF)
            player:teleportTo(config.exitPos)
            config.exitPos:sendMagicEffect(CONST_ME_TELEPORT)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have been expelled from the area for lack of money.")
        end
    end
    return true
end

remMoneyEvent:interval(1000 * 60) -- 1 minute
remMoneyEvent:register()

You must configure the center of the area, and then establish the distance from the center of the area to its ends, this is defined with rangeX and rangeY, in this way if we have rangeX = 10, then we will search from the center of the room up to 10 sqm towards the <--- and ---> sides and every player who is in this rank will have to pay or otherwise he will be expelled, the same happens with the Y rank, there is nothing more to explain
I had ned it too, like boss arena request @walltimer , ty Sarah for ur help, where do i find ur paypal for donation?
 
Back
Top