• 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 0.X I NEED HELP WITH THIS GLOBALEVENT

lSenturion2

Active Member
Joined
Oct 2, 2019
Messages
124
Reaction score
29
Can someone help on this?
I need this script have to show on CHANNEL_PLAYERSON the total players online and the names, like the !online command.
Code:
function onThink(cid, interval, lastExecution)

 for _, creature in ipairs(getChannelUsers(CHANNEL_PLAYERSON)) do
doPlayerSendChannelMessage(creature, "Information", " Players online: ", TALKTYPE_CHANNEL_O, CHANNEL_PLAYERSON)
end

return TRUE
end
 
Lua:
function onThink(cid, interval, lastExecution)
    local t = {}
    local showGamemasters = getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand'))
    for _, pid in ipairs(getPlayersOnline()) do
        local added = true
        if not showGamemasters and (getPlayerCustomFlagValue(pid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) or isPlayerGhost(pid)) then
            added = false
        end
        if (added) then
            t[#t+1] = getCreatureName(pid) .. " [" .. getPlayerLevel(pid) .. "]"
        end
    end

    if #t > 0 then
        for _, pid in ipairs(getChannelUsers(CHANNEL_PLAYERSON)) do
            doPlayerSendChannelMessage(pid, "", #t.." players online: "..table.concat(t, ", "), TALKTYPE_CHANNEL_O, CHANNEL_PLAYERSON)
        end
    end
    return true
end
 
Back
Top