• 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 exhaustion !online talkaction

TibiaGameHost

Hello!
Joined
Feb 25, 2009
Messages
255
Reaction score
0
Location
Canadá
Hi, I have a problem.
I put in talkaction exhaustion.
Only problem with that is, emvez of Blocking the talkaction she is sending only one point.
View: http://prntscr.com/24ykkf

Help me?

Code:
local config = {
showGamemasters = getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand')),
offset = 0,
s = 11859, -- n mexa
exhau = 60 -- tempo em seegundos para salvar denovo
}

function onSay(cid, words, param, channel)
local players = getCustomPlayersOnline()
local strings = {""}
local i, position = 1, 1
local added = true
if (getPlayerStorageValue(cid, config.s) <= os.time()) then

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

local pid_n = getPlayerByName(pid[1])

if((config.showGamemasters or getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) or not getPlayerCustomFlagValue(pid_n, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) and (not isPlayerGhost(pid_n) or getPlayerGhostAccess(cid) >= getPlayerGhostAccess(pid_n))) then

local level = db.getResult("SELECT `level` FROM `players` WHERE `name` = \""..tostring(pid).."\";")
strings[position] = strings[position].. pid[1] .. " [".. pid[2] .. "]"
i = i + 1
added = true
else
added = false
end
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, #getSpoofOnline() + config.offset .." player(s) online:")
setPlayerStorageValue(cid,config.s,os.time()+config.exhau)
doPlayerSendCancel(cid, 'Voce nao pode usar esse comando rapidamente, aguarde...')
end

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

function getSpoofOnline()
local players, add = {}, {}
local result = db.getResult("SELECT `name`, `level` FROM `players` WHERE `online` = 1;")

if(result:getID() ~= -1) then
while(true) do
table.insert(players, {tostring(result:getDataString("name")), tonumber(result:getDataInt("level"))})
table.insert(add, tostring(result:getDataString("name")))

if not(result:next())then
break
end
end

result:free()
end

for index, cid in ipairs(getPlayersOnline()) do
if not isInArray(add, getCreatureName(cid)) then
table.insert(players, {getCreatureName(cid), getPlayerLevel(cid)})
end
end

return players or #players
end

function getCustomPlayersOnline()
local players, add = {}, {}
local result = db.getResult("SELECT `name`, `level` FROM `players` WHERE `online` = 1;")

if(result:getID() ~= -1) then
while(true) do
table.insert(players, {tostring(result:getDataString("name")), tonumber(result:getDataInt("level"))})
table.insert(add, tostring(result:getDataString("name")))

if not(result:next())then
break
end
end

result:free()
end

for index, cid in ipairs(getPlayersOnline()) do
if not isInArray(add, getCreatureName(cid)) then
table.insert(players, {getCreatureName(cid), getPlayerLevel(cid)})
end
end

return players or #players
end
 
Back
Top