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

TFS 1.X+ !onlinearea

darcioantonio

www.adventurerpg.com.br
Joined
Jul 30, 2013
Messages
165
Solutions
1
Reaction score
4
Location
Brasil
Twitch
darcio_
YouTube
UCEXCOEw_dYchojHNz
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
 
Solution
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 =...
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
 
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:
Solution
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
 
Back
Top