SidneiJR Posted February 24, 2018 Share Posted February 24, 2018 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
DNL291 Posted February 24, 2018 Share Posted February 24, 2018 (edited) Essas funções destacadas em laranja são funções do lado server. Você vai precisar chamar o server depois que a gridList for criada. Nesse evento do lado server, você envia os dados com as contas da ACL para o cliente. Edited February 24, 2018 by DNL291 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now