function getAllPlayers()
local list, colors = {}, {
[368966908] = "Нет",
[2566951719] = "Grove Street",
[2580667164] = "Los Santos Vagos",
[2580283596] = "East Side Ballas",
[2566979554] = "Varrios Los Aztecas",
[2573625087] = "The Rifa",
[2157523814] = "La Cosa Nostra",
[2159694877] = "Warlock MC",
[23486046] = "Night Wolves",
[2150852249] = "Russian Mafia",
[2157314562] = "Yakuza",
[2160918272] = "Правительство",
[2152104628] = "Страховая компания",
[2150206647] = "Центральный банк",
[2164221491] = "Инструкторы",
[2164227710] = "Больница",
[2147503871] = "Полиция",
[2157536819] = "Армия/ТСР",
[2164228096] = "TV студия",
}
for _, ped in ipairs(getAllChars()) do
local result, id = sampGetPlayerIdByCharHandle(ped)
if result then
table.insert(list, {
id = id,
name = sampGetPlayerNickname(id) or 'undefined',
org = colors[sampGetPlayerColor(id)] or 'Не удалось определить'
})
end
end
return list
end
-- использование:
sampRegisterChatCommand('getplayers', function()
for _, player in ipairs(getAllPlayers()) do
sampAddChatMessage(('ID: %s | Ник: %s | Организация: %s'):format(player.id, player.name, player.org), -1)
end
end)