function getPlayersWithName(string)
local t = {}
for i = 0, 999 do
if sampIsPlayerConnected(i) or i == select(2, sampGetPlayerIdByCharHandle(PLAYER_PED)) then
if sampGetPlayerNickname(i):find(string) then
table.insert(t, {id = i, name = sampGetPlayerNickname(i)})
end
end
end
return t
end
-- пример:
local list = getPlayersWithName('_Gay')
for i = 1, #list do
print('ID: '..list[i].id, 'Ник: '..list[i].name)
end