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

A simple help

darcioantonio

www.adventurerpg.com.br
Joined
Jul 30, 2013
Messages
165
Solutions
1
Reaction score
4
Location
Brasil
Twitch
darcio_
YouTube
UCEXCOEw_dYchojHNz
I used this script on my version 8.60 server,
I need to move it to TFS 1.3 or adapt it, I'm having difficulties can someone help me?


It represents a script if it checks if there is a player or more in a certain area X, Y if there is another one please get me!

Lua:
if #getPlayersInArea({x = 577, y = 448, z = 10}, {x = 579, y = 457, z = 10}) >= 1  then
    doPlayerSendTextMessage(cid,19,"Existe um jogador dentro da arena aguarde.")
    return false
end


function getPlayersInArea(fromPosition, toPosition)
  local players = {}
  for _, pid in ipairs(getPlayersOnline()) do
    if isInRange(getPlayerPosition(pid), fromPosition, toPosition) then
      table.insert(players, pid)
    end
  end
  return players
end
 
Solution
Try this:
Lua:
local centerPosition = Position(100, 100, 7)
local players = Game.getSpectators(centerPosition, false, true, 5, 5, 5, 5)
if #players > 0  then
    doPlayerSendTextMessage(cid,19,"Existe um jogador dentro da arena aguarde.")
    return false
end

--C = centerPosition ; x = area to look
--[x][x][x][x][x][x][x][x][x][x][x]
--[x][x][x][x][x][x][x][x][x][x][x]
--[x][x][x][x][x][C][x][x][x][x][x]
--[x][x][x][x][x][x][x][x][x][x][x]
--[x][x][x][x][x][x][x][x][x][x][x]
--[x][x][x][x][x][x][x][x][x][x][x]

-Edit
Sorry, i posted the code and don't explained:
The function: Game.getSpectators(position[, multifloor = false[, onlyPlayer = false[, minRangeX = 0[, maxRangeX =...
I used this script on my version 8.60 server,
I need to move it to TFS 1.3 or adapt it, I'm having difficulties can someone help me?


It represents a script if it checks if there is a player or more in a certain area X, Y if there is another one please get me!

Lua:
if #getPlayersInArea({x = 577, y = 448, z = 10}, {x = 579, y = 457, z = 10}) >= 1  then
    doPlayerSendTextMessage(cid,19,"Existe um jogador dentro da arena aguarde.")
    return false
end


function getPlayersInArea(fromPosition, toPosition)
  local players = {}
  for _, pid in ipairs(getPlayersOnline()) do
    if isInRange(getPlayerPosition(pid), fromPosition, toPosition) then
      table.insert(players, pid)
    end
  end
  return players
end
Hi,
Use:
Game.getSpectators(position[, multifloor = false[, onlyPlayer = false[, minRangeX = 0[, maxRangeX = 0[, minRangeY = 0[, maxRangeY = 0]]]]]]) to get all players in area, be sure to set onlyPlayer variable to true, to return only players.
 
Try this:
Lua:
local centerPosition = Position(100, 100, 7)
local players = Game.getSpectators(centerPosition, false, true, 5, 5, 5, 5)
if #players > 0  then
    doPlayerSendTextMessage(cid,19,"Existe um jogador dentro da arena aguarde.")
    return false
end

--C = centerPosition ; x = area to look
--[x][x][x][x][x][x][x][x][x][x][x]
--[x][x][x][x][x][x][x][x][x][x][x]
--[x][x][x][x][x][C][x][x][x][x][x]
--[x][x][x][x][x][x][x][x][x][x][x]
--[x][x][x][x][x][x][x][x][x][x][x]
--[x][x][x][x][x][x][x][x][x][x][x]

-Edit
Sorry, i posted the code and don't explained:
The function: Game.getSpectators(position[, multifloor = false[, onlyPlayer = false[, minRangeX = 0[, maxRangeX = 0[, minRangeY = 0[, maxRangeY = 0]]]]]])
Return a table with all Spectators in the area.
position = centerPosition to start search
multifloor = will look in all floors?
onlyPlayer = will return only players
minRangeX = count of SQM to west side FROM center position
maxRangeX = count of SQM to east side FROM center position
minRangeY = count of SQM to north side FROM center position
maxRangeY = count of SQM to south side FROM center position
 
Last edited:
Solution
Try this:
Lua:
local centerPosition = Position(100, 100, 7)
local players = Game.getSpectators(centerPosition, false, true, 5, 5, 5, 5)
if #players > 0  then
    doPlayerSendTextMessage(cid,19,"Existe um jogador dentro da arena aguarde.")
    return false
end

--C = centerPosition ; x = area to look
--[x][x][x][x][x][x][x][x][x][x][x]
--[x][x][x][x][x][x][x][x][x][x][x]
--[x][x][x][x][x][C][x][x][x][x][x]
--[x][x][x][x][x][x][x][x][x][x][x]
--[x][x][x][x][x][x][x][x][x][x][x]
--[x][x][x][x][x][x][x][x][x][x][x]

-Edit
Sorry, i posted the code and don't explained:
The function: Game.getSpectators(position[, multifloor = false[, onlyPlayer = false[, minRangeX = 0[, maxRangeX = 0[, minRangeY = 0[, maxRangeY = 0]]]]]])
Return a table with all Spectators in the area.
position = centerPosition to start search
multifloor = will look in all floors?
onlyPlayer = will return only players
minRangeX = count of SQM to west side FROM center position
maxRangeX = count of SQM to east side FROM center position
minRangeY = count of SQM to north side FROM center position
maxRangeY = count of SQM to south side FROM center position



Thank you very much, I will test!
 
Back
Top