local players = {}
local font_flag = require('moonloader').font_flag
local my_font = renderCreateFont('Verdana', 12, font_flag.BOLD + font_flag.SHADOW)
function main()
while not isSampAvailable() do wait(0) end
while true do
wait(0)
local onlinePlayers = {}
local offlinePlayers = {}
for k, v in ipairs(players) do
local playerId = sampGetPlayerIdByNickname(v)
if playerId and sampIsPlayerConnected(playerId) then
table.insert(onlinePlayers, v)
else
table.insert(offlinePlayers, v)
end
end
local onlinePlayersStr = table.concat(onlinePlayers, ', ')
renderFontDrawText(my_font, '{00ff59}Online: {ffffff} '..onlinePlayersStr, 10, 440, 0xFFFFFFFF)
local offlinePlayersStr = table.concat(offlinePlayers, ', ')
renderFontDrawText(my_font, '{f20008}Offline: {ffffff} '..offlinePlayersStr, 10, 420, 0xFFFFFFFF)
end
end
function sampGetPlayerIdByNickname(nick)
nick = tostring(nick)
local _, myid = sampGetPlayerIdByCharHandle(PLAYER_PED)
if nick == sampGetPlayerNickname(myid) then return myid end
for i = 0, 1003 do
if sampIsPlayerConnected(i) and sampGetPlayerNickname(i) == nick then
return i
end
end
end