Jump to content

Dúvida referente a gridlist


Recommended Posts

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?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...