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

Help Global Event

GOD Cah

New Member
Joined
Jan 7, 2016
Messages
10
Reaction score
4
Hello Guys, good night.

I back studing some lua again, after 5 years, and the things have change a bit.

I try make a script, still works, but i have a error in console.

For exemple, when 4 players stay in x,y,z they are tp to x,y,z.

Script-

<globalevent name="Enter Arena" interval="2000" script="enterarena.lua"/>

local playerPosition = {
{x = 24999, y = 24985, z = 7},
{x = 25000, y = 24984, z = 7},
{x = 25001, y = 24985, z = 7},
{x = 25000, y = 24986, z = 7}
}
local newPosition = {
{x = 25000, y = 25000, z = 7},
{x = 25000, y = 25000, z = 7},
{x = 25000, y = 25000, z = 7},
{x = 25000, y = 25000, z = 7}
}

function onThink(interval, lastExecution)

local players = Game.getPlayers()

if #players == 0 then -- 0 players online, no need to execute the script
return true
end

local players = {}

for _, pos in ipairs(playerPosition) do
local player = Tile(pos):getTopCreature()
if player == nil or not player:isPlayer() then
return false
end
players[#players+1] = player
end
for i, player in ipairs(players) do
Position(playerPosition):sendMagicEffect(11)
player:teleportTo(newPosition, false)
player:setDirection(SOUTH)
end

return true
end

I have this error, but the script works well, someone know what a hell is that?

[Error - GlobalEvents::think] Failed to execute event: Enter Arena
 
positions in 1.2 are
Position([x = 0[, y = 0[, z = 0[, stackpos = 0]]]])

also you should avoid making a variable named players then a few lines later making another with the exact same name
 
Back
Top