• 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 Error In GUI

renots10

New Member
Joined
Feb 28, 2010
Messages
34
Reaction score
1
Started up A New server, And when Anyone Does !online, It errors In The GUI menu.

The code Is

Code:
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
        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_BLUE, (i - 1) .. " player(s) online on FrozEn StaRlIght:")
        for i, str in ipairs(strings) do
                if(str:sub(str:len()) ~= ",") then
                        str = str .. ". ".. sorc .." sorcerers, ".. druid .." druids, ".. paladin .." paladins, ".. knight .." knights and ".. rook .." rookies."
                end
 
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, str)
        end
 
        return true
end

The Error Is

Code:
[Error - TalkAction Interface] 
data/talkactions/scripts/online.lua:onSay
Description: 
data/talkactions/scripts/online.lua:2: attempt to call global 'doPlayerAddEditedItem' (a nil value)
stack traceback:
data/talkactions/scripts/online.lua:2: in function <data/talkactions/scripts/online.lua:1>

Any Help would Be Great, Thanks.
 
You're just missing doPlayerAddEditedItem function.
Use the following one:

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
 
Back
Top