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

!online command not working

Na Amigo

The crazy girl
Joined
Jun 5, 2017
Messages
254
Solutions
3
Reaction score
17
Location
Egypt
Hello my talkaction !online and /online is not working iam using the forgotten server 0.3.7_SVN
Code:
    <talkaction words="!online;/online" event="script" value="online.lua"/>
online.lua :-
Code:
local config = {
    showGamemasters = getBooleanFromString(getConfigInfo('displayGamemastersWithOnlineCommand'))
}
function onSay(cid, words, param)
    local players = getPlayersOnline()
    local strings = {}
    local i = 1
    local position = 1
    for _, pid in ipairs(players) do
        seal = true
        if param ~= "" then
            setPlayerStorageValue(cid, 30112, param)
            if getPlayerLevel(pid) < getPlayerStorageValue(cid, 30112) then
                seal = false
            end
        end
        if seal 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
            if((config.showGamemasters == TRUE or getPlayerCustomFlagValue(cid, PlayerCustomFlag_GamemasterPrivileges) == TRUE or getPlayerCustomFlagValue(pid, PlayerCustomFlag_GamemasterPrivileges) ~= TRUE) and (isPlayerGhost(pid) ~= TRUE or getPlayerAccess(cid) > getPlayerAccess(pid))) then
                strings[position] = strings[position] .. getCreatureName(pid) .. " [" .. getPlayerLevel(pid) .. "]"
                i = i + 1
            end
        end
    end
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (i - 1) .. " player(s) 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
    return TRUE
end
 
try this (:
Code:
function onSay(cid, words, param, channel)
    if(not checkExhausted(cid, 666, 10)) then
        return false
    end

    local strings, i, position, added, showGamemasters = {""}, 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
        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_ORANGE, str)
    end

    return true
end
 
try this :)
Code:
function onSay(cid, words, param, channel)
    if(not checkExhausted(cid, 666, 10)) then
        return false
    end

    local strings, i, position, added, showGamemasters = {""}, 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
        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_ORANGE, str)
    end

    return true
end
not working dude :/
Code:
[19:49:20.698] [Error - TalkAction Interface]
[19:49:20.699] data/talkactions/scripts/online.lua:onSay
[19:49:20.699] Description:
[19:49:20.700] data/talkactions/scripts/online.lua:2: attempt to call global 'checkExhausted' (a nil value)
[19:49:20.701] stack traceback:
[19:49:20.701]  data/talkactions/scripts/online.lua:2: in function <data/talkactions/scripts/online.lua:1>
 
and this?
Code:
local config = {
showGamemasters = getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand'))
}
function onSay(cid, words, param, channel)
local players = getPlayersOnline()
local strings = {""}
local i, position = 1, 1
local added = FALSE
for _, pid in ipairs(players) 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
if((config.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
else
added = FALSE
end
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (i - 1) .. " player(s) 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
return TRUE
end
 
and this?
Code:
local config = {
showGamemasters = getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand'))
}
function onSay(cid, words, param, channel)
local players = getPlayersOnline()
local strings = {""}
local i, position = 1, 1
local added = FALSE
for _, pid in ipairs(players) 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
if((config.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
else
added = FALSE
end
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (i - 1) .. " player(s) 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
return TRUE
end
this not working too and don't get error in console when i try !online no results nothing happen
 
Taken directly from Printers released 0.3.6 Datapack.

Talkactions.xml:
XML:
<talkaction words="!online" event="script" value="online.lua"/>

online.lua:
LUA:
local ranks = {
[1] = {"Tutor"},
[2] = {"S. Tutor"},
[3] = {"GM"},
[4] = {"CM"},
[5] = {"Admin"}
}

function onSay(cid, words, param, channel)
    local players = getPlayersOnline()
    local strings = {""}
    local i, position = 1, 1
    local added = false

    for _, pid in ipairs(players) 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

        if getPlayerAccess(pid) == 0 then
            strings[position] = strings[position] .. getCreatureName(pid) .." ["..getPlayerLevel(pid).."]"
            i = i + 1
            added = true
        else
            added = false
        end
    end

    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (i - 1) .. " player(s) 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

    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "-----------")

    local players2 = getPlayersOnline()
    local helpon = 0
    local rank = ""
    local str2 = ""

    for _, pid2 in ipairs(players2) do     
        if getPlayerAccess(pid2) > 0 then
            rank = ranks[getPlayerAccess(pid2)]
            str2 = str2 .. getCreatureName(pid2) .." ["..rank[1].."]  "
            helpon = helpon + 1
        end     
    end
    if helpon > 0 then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (helpon) .. " support player(s) online:")
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, str2)
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "There are no support players currently online.")
    end
    return true
end
 
Taken directly from Printers released 0.3.6 Datapack.

Talkactions.xml:
XML:
<talkaction words="!online" event="script" value="online.lua"/>

online.lua:
LUA:
local ranks = {
[1] = {"Tutor"},
[2] = {"S. Tutor"},
[3] = {"GM"},
[4] = {"CM"},
[5] = {"Admin"}
}

function onSay(cid, words, param, channel)
    local players = getPlayersOnline()
    local strings = {""}
    local i, position = 1, 1
    local added = false

    for _, pid in ipairs(players) 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

        if getPlayerAccess(pid) == 0 then
            strings[position] = strings[position] .. getCreatureName(pid) .." ["..getPlayerLevel(pid).."]"
            i = i + 1
            added = true
        else
            added = false
        end
    end

    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (i - 1) .. " player(s) 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

    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "-----------")

    local players2 = getPlayersOnline()
    local helpon = 0
    local rank = ""
    local str2 = ""

    for _, pid2 in ipairs(players2) do    
        if getPlayerAccess(pid2) > 0 then
            rank = ranks[getPlayerAccess(pid2)]
            str2 = str2 .. getCreatureName(pid2) .." ["..rank[1].."]  "
            helpon = helpon + 1
        end    
    end
    if helpon > 0 then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (helpon) .. " support player(s) online:")
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, str2)
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "There are no support players currently online.")
    end
    return true
end
not working :(
 
oh sorry you are using 0.3.7. Didn't see.
Talkactions.xml
XML:
<talkaction words="!online" event="script" value="online.lua"/>

online.lua:
LUA:
local config = {
    showGamemasters = getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand'))
}

function onSay(cid, words, param, channel)
    local players = getPlayersOnline()
    local strings = {""}
local sorc,druid,paladin,knight,rook = 0,0,0,0,0

    local i, position = 1, 1
    local added = false
    for _, pid in ipairs(players) do
    -- Implementacion por Xafterin.
        if isSorcerer(pid) then
            sorc = sorc + 1
        elseif isDruid(pid) then
            druid = druid + 1
        elseif isPaladin(pid) then
            paladin = paladin + 1
        elseif isKnight(pid) then
            knight = knight + 1
        elseif isRookie(pid) then
            rook = rook + 1
    end
    ---
        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

        if((config.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
        else
            added = false
        end
    end

    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, (i - 1) .. " player(s) online:")
    for i, str in ipairs(strings) do
        if(str:sub(str:len()) ~= ",") then
            str = str .. ". ".. sorc .." Sorcerers, ".. druid .." Druids, ".. paladin .." Paladins, ".. knight .." Knights."
        end

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, str)
    end

    return true
end
 
oh sorry you are using 0.3.7. Didn't see.
Talkactions.xml
XML:
<talkaction words="!online" event="script" value="online.lua"/>

online.lua:
LUA:
local config = {
    showGamemasters = getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand'))
}

function onSay(cid, words, param, channel)
    local players = getPlayersOnline()
    local strings = {""}
local sorc,druid,paladin,knight,rook = 0,0,0,0,0

    local i, position = 1, 1
    local added = false
    for _, pid in ipairs(players) do
    -- Implementacion por Xafterin.
        if isSorcerer(pid) then
            sorc = sorc + 1
        elseif isDruid(pid) then
            druid = druid + 1
        elseif isPaladin(pid) then
            paladin = paladin + 1
        elseif isKnight(pid) then
            knight = knight + 1
        elseif isRookie(pid) then
            rook = rook + 1
    end
    ---
        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

        if((config.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
        else
            added = false
        end
    end

    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, (i - 1) .. " player(s) online:")
    for i, str in ipairs(strings) do
        if(str:sub(str:len()) ~= ",") then
            str = str .. ". ".. sorc .." Sorcerers, ".. druid .." Druids, ".. paladin .." Paladins, ".. knight .." Knights."
        end

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, str)
    end

    return true
end
this not working
 
Last edited:
Back
Top