Estou tentando utilizar a gridlist para mostrar Players de um determinado grupo ACL
Tentei seguir o padrão dessa função abaixo:
grid = guiCreateGridList(x*310, y*300, x*200, y*140, false)
column = guiGridListAddColumn(grid, "Policiais Online", 1)
guiSetVisible(grid, false)
clientsideResourceStart = function()
if column then
for id,playeritem in ipairs(getElementsByType("player")) do
if isPlayerInTeam(playeritem, "PM") then
local row = guiGridListAddRow(grid)
guiGridListSetItemText(grid, row, column, getPlayerName(playeritem), false, false)
end
end
end
end
addEventHandler ( "onClientResourceStart", resourceRoot, clientsideResourceStart )
function isPlayerInTeam(src, TeamName)
if src and isElement ( src ) and getElementType ( src ) == "player" then
local team = getPlayerTeam(src)
if team then
if getTeamName(team) == TeamName then
return true
else
return false
end
end
end
end
Substituindo "isPlayerInTeam" por "isPlayerInACL" ficando da seguinte forma:
grid = guiCreateGridList(x*310, y*300, x*200, y*140, false)
column = guiGridListAddColumn(grid, "Policiais Online", 1)
guiSetVisible(grid, false)
clientsideResourceStart = function()
if column then
for id,playeritem in ipairs(getElementsByType("player")) do
if isPlayerInACL(playeritem, "Police") then
local row = guiGridListAddRow(grid)
guiGridListSetItemText(grid, row, column, getPlayerName(playeritem), false, false)
end
end
end
end
addEventHandler ( "onClientResourceStart", resourceRoot, clientsideResourceStart )
function isPlayerInACL(player, acl)
local accountName = getAccountName( getPlayerAccount(player) )
if accountName ~= "guest" and type( aclGetGroup(acl) ) == "userdata" then
return isObjectInACLGroup( "user."..accountName, aclGetGroup(acl) )
end
return false
end
Porém como é na parte Client ela não consegue ler "getPlayerAccount", como posso utilizar essa função corretamente?