Galaxy
New Member
Hello Otlanders
I would like to change my script that is responsible for showing players online in-game.
First of all, I would like to add exhaustion to it for 30 seconds.
Secondly, Well, I must give you an example ;P
Now, when I use a command !online, this appears in Defaul channel:
But, I would just like the script to tell me the amout of players online ONLY - NOT ALL THE NAMES THAT ARE ONLINE BECAUSE WHEN THERE WILL BE 100 PLAYERS ONLINE, IT WILL BE NOT NEEDED SPAM (sorry for caps lock xD)
So, something like that:
and thats all i want the script to tell me...
Here is the script
Thanks for your support!
I would like to change my script that is responsible for showing players online in-game.
First of all, I would like to add exhaustion to it for 30 seconds.
Secondly, Well, I must give you an example ;P
Now, when I use a command !online, this appears in Defaul channel:
Code:
19:48 1 player(s) online:
19:48 Tomek [100000].
But, I would just like the script to tell me the amout of players online ONLY - NOT ALL THE NAMES THAT ARE ONLINE BECAUSE WHEN THERE WILL BE 100 PLAYERS ONLINE, IT WILL BE NOT NEEDED SPAM (sorry for caps lock xD)
So, something like that:
Code:
19:48 Actually there are X players online.
Here is the script
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
Thanks for your support!
Last edited: