Shadow Dan
Sh4dowDan
#edit
I fixed it this way, now everything is fine
#old ------------------------------------------------------------------------------
This script works perfect but has one bug. It counts players in ghost mode.
Need to add something like Game.getPlayerCount() - PlayersInGhostMode but i have no idea how to do it without errors.
btw. i didn't give up on trying but maybe someone knows easy solution for this so i posted it.
..and this may help other players in future.
I fixed it this way, now everything is fine
Code:
function onSay(player, words, param)
local cid = player
if(not checkExhausted(cid, 555, 5)) then
return false
end
local hasAccess = player:getGroup():getAccess()
local players = Game.getPlayers()
local playerCount = Game.getPlayerCount()
local e = 0
local i = 0
local msg = ""
local tmpPlayer
for k = 1, #players do
tmpPlayer = players[k]
if hasAccess or not tmpPlayer:isInGhostMode() then
if i > 0 then
msg = msg .. ", "
end
msg = msg .. tmpPlayer:getName() .. " [" .. tmpPlayer:getLevel() .. "]"
i = i + 1
end
if tmpPlayer:isInGhostMode() then
e = e + 1
end
if i == 10 then
if k == playerCount then
msg = msg .. "."
else
msg = msg .. ","
end
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, msg)
msg = ""
i = 0
end
end
if i > 0 then
msg = msg .. "."
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, msg)
end
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, playerCount - e .. " players online.")
return false
end
#old ------------------------------------------------------------------------------
This script works perfect but has one bug. It counts players in ghost mode.
Need to add something like Game.getPlayerCount() - PlayersInGhostMode but i have no idea how to do it without errors.
btw. i didn't give up on trying but maybe someone knows easy solution for this so i posted it.
..and this may help other players in future.
Code:
function onSay(player, words, param)
local cid = player
if(not checkExhausted(cid, 555, 2)) then
return false
end
local hasAccess = player:getGroup():getAccess()
local players = Game.getPlayers()
local playerCount = Game.getPlayerCount()
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, playerCount .. " players online.")
local i = 0
local msg = ""
local tmpPlayer
for k = 1, #players do
tmpPlayer = players[k]
if hasAccess or not tmpPlayer:isInGhostMode() then
if i > 0 then
msg = msg .. ", "
end
msg = msg .. tmpPlayer:getName() .. " [" .. tmpPlayer:getLevel() .. "]"
i = i + 1
end
if i == 10 then
if k == playerCount then
msg = msg .. "."
else
msg = msg .. ","
end
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, msg)
msg = ""
i = 0
end
end
if i > 0 then
msg = msg .. "."
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, msg)
end
return false
end
Last edited: