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

Lua Its possible create this custom online?

Ghazer

Member
Joined
Mar 13, 2009
Messages
350
Reaction score
6
its possible create one custom online with this features:
when your put !online say example:
thais: 5, venore: 6, yalahar: 0, fibula: 4, etc...



___________
New...
Its possible to add some features?
in default channel show curently players online and citys... and in the serverlog show the list of players to better order
like
b9d3caa645d4438f95c3d26.png


In default:
1) Currently players online...
2) Players in citys
621f918e8f0446739e86535.png

3) If you want to see the list, it is at Server Log channel.

In serverlog:
All list of players online

help please!
 
Last edited:
LUA:
local towns = {1, 2}

function onSay(cid, words, param, channel)
	local strings, i, position, added, showGamemasters, _towns = {""}, 1, 1, false, getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand')), {}
	for _, pid in ipairs(getPlayersOnline()) do
		if(added) then
			if(i > (position * 7)) then
				strings[position] = strings[position] .. ","
				position = position + 1
				strings[position] = ""
			else
				strings[position] = i == 1 and "" or strings[position] .. ", "
			end
		end

		added = false
		if((showGamemasters or getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) or not getPlayerCustomFlagValue(pid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) and (not isPlayerGhost(pid) or getPlayerGhostAccess(cid) >= getPlayerGhostAccess(pid))) then
			strings[position] = strings[position] .. getCreatureName(pid) .. " [" .. getPlayerLevel(pid) .. "]"
			i = i + 1
			added = true
            
            local closest = {towns[1], math.huge}
            for j = 1, #towns do
                local distance = getDistanceBetween(getThingPos(pid), getTownTemplePosition(towns[j]))
                if distance < closest[2] then
                    closest[1] = towns[j]
                    closest[2] = distance
                end
            end
            
            if not _towns[closest[1]] then
                _towns[closest[1]] = {}
            end
            
            table.insert(_towns[closest[1]], pid)
		end
	end

	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (i - 1) .. " player" .. (i > 1 and "s" or "") .. " online:")
	for i, str in ipairs(strings) do
		if(str:sub(str:len()) ~= ",") then
			str = str .. "."
		end

		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, str)
	end

    local townsStr, first = "", true
    for i = 1, #towns do
        townsStr = townsStr .. (first and "" or ", ") .. getTownName(towns[i]) .. ": " .. (_towns[i] and #_towns[i] or 0)
        first = false
    end
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, townsStr)
    
	return true
end
 
Its possible to add some features?
in default channel show curently players online and citys... and in the serverlog show the list of players to better order
like
b9d3caa645d4438f95c3d26.png


In default:
1) Currently players online...
2) Players in citys
621f918e8f0446739e86535.png

3) If you want to see the list, it is at Server Log channel.

In serverlog:
All list of players online

help please!
 
Last edited:
Back
Top