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()
I had ned it too, like boss arena request @walltimer , ty Sarah for ur help, where do i find ur paypal for donation?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