Hello.
I want a little remake to my !online command script:
Now its like:
I want something like this:
I want a little remake to my !online command script:
LUA:
local STORE_VALUE = 3567 -- Value where exhaust is saved.
local EXHAUST_TIME = 60 -- Exhaust time in seconds.
-----------------------------------------------
---- Skrypt Online, edytowany przez Vojtaz ----
-----------------------------------------------
local config = {
showGamemasters = getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand'))
}
function onSay(cid, words, param, channel)
if exhaust(cid, STORE_VALUE, EXHAUST_TIME) > 0 then
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) .. ""
i = i + 1
added = true
else
added = false
end
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "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)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, (i) .. " player(s) totally is playing at the moment.")
end
else
doPlayerSendCancel(cid, "You can check online players only one time per minute.")
end
return true
end
-- Exhaustion system (Made by Alreth, bugfix by me)
-- DO NOT EDIT!
function exhaust(cid, STORE_VALUE, EXHAUST_TIME)
newExhaust = os.time()
oldExhaust = getPlayerStorageValue(cid, STORE_VALUE)
if (oldExhaust == nil or oldExhaust < 0) then
oldExhaust = 0
end
if (EXHAUST_TIME == nil or EXHAUST_TIME < 0) then
EXHAUST_TIME = 1
end
diffTime = os.difftime(newExhaust, oldExhaust)
if (diffTime >= EXHAUST_TIME) then
setPlayerStorageValue(cid, STORE_VALUE, newExhaust)
return 1
else
return 0
end
end
Now its like:
Player(s) online:
Name, name
Totally X players online
I want something like this:
Player(s) online:
Name, name
Support online:
- here showing: players who have group higher than 2
Totally X players online