TFS 1.X+ !onlinearea

darcioantonio

www.adventurerpg.com.br
Joined
Jul 30, 2013
Messages
92
Reaction score
2
Location
Brasil
Good morning, is there a talkaction that checks players in a particular area? with if it were an online
more !onlinearena.

Algo assim!
Lua:
function onSay(player, words, param, frompos, topos)

-- Local de Espera
local ConfigOnline = {
  frompos = {x = 1370, y = 1028, z = 6}, -- Norte Esquerda Local de espera
  topos = {x = 1374, y = 1032, z = 6} -- Sul Direita Local de espera
}
for a = ConfigOnline.frompos.x, ConfigOnline.topos.x do
  for b = ConfigOnline.frompos.y, ConfigOnline.topos.y do
    for c = 1, 6 do
      pos = {x = a, y = b, z = c, stackpos = 255}
     
    local hasAccess = pos
    local players = pos
    local playerCount = Game.getPlayerCount()--+69 -- spoofing

    player:sendTextMessage(MESSAGE_INFO_DESCR, playerCount .. " players online.")

    local i = 0
    local msg = ""
    for k, targetPlayer in ipairs(players) do
        if hasAccess or not targetPlayer:isInGhostMode() then
            if i > 0 then
        --        msg = msg .. ", "
            end
            msg = msg .. targetPlayer:getName() .. ", "
            i = i + 1
        end

        if i == 10 then
            if k == playerCount then
                msg = msg .. ""
            else
                msg = msg .. ""
            end
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg)
        --    msg = ""
            i = 0
        end
    end

    if i > 0 then
        msg = msg .. "."
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg)
    end
    end
  end
end

   
    return false
end
 

Don Daniello

/root
Staff member
Administrator
Joined
Apr 11, 2008
Messages
3,465
Reaction score
813
Location
Proland
It's not quite clear what are you seeking help with. Are you asking for talkaction or providing a script?
 

massuco

Brazilian, sorry for my bad english XD
Joined
Feb 17, 2013
Messages
175
Reaction score
15
Location
Brasil
He want to make this script to make this, when you say !onlinearea the script look how many ppl is on exact area on map
example
i say !onlinearea and the script count how many people have on that area map (example pos xyz to pos xyz) and return this number in one global message
 

piraten

TibiaEu.Com
Joined
Dec 30, 2018
Messages
58
Reaction score
17
i think he wants something like !onlinearea shows how many people are in thais,venore,etc,etc
 

Nekiro

7375727072697365643F203A29
Support Team
Joined
Sep 7, 2015
Messages
1,775
Reaction score
546
Lua:
function onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true

    end

    if player:getAccountType() < ACCOUNT_TYPE_GOD then
        return false

    end

    local split = param:split(",")
    if not split[4] then
        player:sendCancelMessage("Insufficient parameters.")
        return false
    end

    local position = Position(tonumber(split[1]), tonumber(split[2]), tonumber(split[3]))
    if not position then
        player:sendCancelMessage("Invalid position.")
        return false
    end

    local radius = tonumber(split[4])
    if not radius or radius < 1 then
        player:sendCancelMessage("Invalid radius.")
        return false
    end

    local count = #Game.getSpectators(position, false, true, radius, radius, radius, radius)
    player:sendTextMessage("This area has " .. count .. " players currently.")
    return false

end
Usage:
!onlinetime x,y,z,10 -- checks for players in position with radius of 10 x and y
 
Last edited:
OP
darcioantonio

darcioantonio

www.adventurerpg.com.br
Joined
Jul 30, 2013
Messages
92
Reaction score
2
Location
Brasil
Am I a layman, can I encase myself to use the function?
 
OP
darcioantonio

darcioantonio

www.adventurerpg.com.br
Joined
Jul 30, 2013
Messages
92
Reaction score
2
Location
Brasil
Please explain to me where to put the command
Please explain to me where to put the command
Please explain to me where to put the command
Please explain to me where to put the command
Please explain to me where to put the command
Please explain to me where to put the command
Please explain to me where to put the command
 
Top