Jump to content

setAccountData y getAccountData de todos los usuarios?


lLinux

Recommended Posts

Mi problema es que quiero hacer que obtenga todos los jugadores conectados... coja a los que son admin, smod, mod y les de un setAccountData... para en el client-side obtenerlos con getAccountData y organizarlos en una lista, por color.

Server-side:

function getRanks() 
    for index, player in ipairs(getElementsByType("player")) do 
        local account = getPlayerAccount( player ) 
         
        if account and not isGuestAccount( account ) then 
            local accountName = getAccountName( account ); 
            if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then 
                setAccountData(player, "RAdmin", "Si") 
            elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "SuperModerator" ) ) then 
                setAccountData(player, "RSmod", "Si") 
            elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Moderator" ) ) then 
                setAccountData(player, "RMod", "Si") 
            end 
        end 
    end 
end 

Client-Side:

function Actualizar() 
guiGridListClear(LISTA) 
for index, player in ipairs(getElementsByType("player")) do 
    FILA = guiGridListAddRow(LISTA) 
    guiGridListSetItemText ( LISTA, FILA, COLUMNA, (string.gsub ( getPlayerName(player), '#%x%x%x%x%x%x', '' ) or getPlayerName(player)), false, false) 
    guiGridListSetItemData ( LISTA, FILA, COLUMNA, getPlayerName(player)) 
    if (getElementData(player, "RAdmin")) then 
        guiGridListSetItemColor(LISTA, FILA, COLUMNA, 0, 0, 255) 
    elseif (getElementData(player, "RSmod")) then 
        guiGridListSetItemColor(LISTA, FILA, COLUMNA, 0, 255, 255) 
    elseif (getElementData(player, "RMod")) then 
        guiGridListSetItemColor(LISTA, FILA, COLUMNA, 255, 255, 0) 
    else 
        guiGridListSetItemColor(LISTA, FILA, COLUMNA, 255, 255, 255) 
    end 
end 
end 

Asi como esta marca que el argumento 1 de setAccountData del server-side esta mal. No he logrado hacer que obtenga tampoco.

Link to comment
  
function getRanks() 
    for index, player in ipairs(getElementsByType("player")) do 
        local account = getPlayerAccount( player ) 
        
        if account and not isGuestAccount( account ) then 
            local accountName = getAccountName( account ); 
            if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then 
                setAccountData(account, "RAdmin", "Si") 
            elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "SuperModerator" ) ) then 
                setAccountData(account, "RSmod", "Si") 
            elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Moderator" ) ) then 
                setAccountData(account, "RMod", "Si") 
            end 
        end 
    end 
end 
  

El argumento 1 de setAccountData es la cuenta, no el elemento.

Y getAccountData tanto setAccountData son funciones del server-side, por ende no podrás utilizarlas en el client-side.

Link to comment
  
function getRanks() 
    for index, player in ipairs(getElementsByType("player")) do 
        local account = getPlayerAccount( player ) 
        
        if account and not isGuestAccount( account ) then 
            local accountName = getAccountName( account ); 
            if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then 
                setAccountData(account, "RAdmin", "Si") 
            elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "SuperModerator" ) ) then 
                setAccountData(account, "RSmod", "Si") 
            elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Moderator" ) ) then 
                setAccountData(account, "RMod", "Si") 
            end 
        end 
    end 
end 
  

El argumento 1 de setAccountData es la cuenta, no el elemento.

Y getAccountData tanto setAccountData son funciones del server-side, por ende no podrás utilizarlas en el client-side.

Aaaa mierd* se me habia olvidado que eran server-side.

Link to comment
  • Recently Browsing   0 members

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