Jump to content

Como colocar para apenas Staff abrir o painel Handling


Recommended Posts

Meu servidor esta com handling de mod ativado, eu já entrei varias vezes nas configurações lua do handling achando aonde colocar isObjectInACLGroup e então nunca achei já coloquei vários em .lua (cliente side e sever side) do handling eu queria saber aonde e oque colocar pra só staffs ter acesso lembrando que a ACL é Staff.

Link to comment
function startBuilding ( )
    if DEBUGMODE then
        outputDebugString ( "Building the gui.." )
    end
    
    if heditGUI.window then
        destroyGUI ( )
    end
    
    local template = getUserTemplate ( )
    
    if not template then
        if DEBUGMODE then
        end

        return false
    end

    local window = buildMainWindow ( template )
    buildUtilButtons ( template )
    buildMenuButtons ( template )
    buildMenus ( template )
    buildSpecials ( template )
    
    guiSetVisible ( window, false )
    
    toggleEvents ( window, true )
    
    forceVehicleChange ( )

    checkTheUpdates ( ) -- We check the updates after the gui has been build, because like this the updates will get listed upon a setting change too.
    
    bindKey ( getUserConfig ( "usedKey" ), "down", toggleEditor )
    addCommandHandler ( getUserConfig ( "usedCommand" ), toggleEditor )
    
    return true
end

Aonde coloca?

 

Link to comment

Se eu soubesse kkkk Sou muito iniciante nisso, desculpe.

addEventHandler ( "onPlayerLogin", root, function ( )
    local admin = isObjectInACLGroup ( "user."..getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Admin" ) )
    triggerClientEvent ( source, "updateClientRights", source, true, admin )
end )

Achei isso em Core.lua Sever side.

Link to comment

Não tem isObjectInACLGroup em cliente side

addEvent ( "requestRights", true )
addEventHandler ( "requestRights", root, function ( )
    if not isValidPlayer ( client ) then
        if DEBUGMODE then
            error ( "Invalid client at event 'requestRights'!", 2 )
        end
        return false
    end
    
    local pAccount = getPlayerAccount ( client )
    if isGuestAccount ( pAccount ) then
        triggerClientEvent ( client, "updateClientRights", client, false, false )
    else
        local admin = isObjectInACLGroup ( "user."..getAccountName ( pAccount ), aclGetGroup ( "Admin" ) )
        triggerClientEvent ( client, "updateClientRights", client, true, admin )
    end
end )

Mais um em Server-side

Link to comment
function startBuilding ( )
    if DEBUGMODE then
        outputDebugString ( "Building the gui.." )
    end
    
    if heditGUI.window then
        destroyGUI ( )
    end
    
    local template = getUserTemplate ( )
    
    if not template then
        if DEBUGMODE then
        end

        return false
    end

    local window = buildMainWindow ( template )
    buildUtilButtons ( template )
    buildMenuButtons ( template )
    buildMenus ( template )
    buildSpecials ( template )
    
    guiSetVisible ( window, false )
    
    toggleEvents ( window, true )
    
    forceVehicleChange ( )

    checkTheUpdates ( ) -- We check the updates after the gui has been build, because like this the updates will get listed upon a setting change too.
    
    bindKey ( getUserConfig ( "usedKey" ), "down", toggleEditor )
    addCommandHandler ( getUserConfig ( "usedCommand" ), toggleEditor )
    
    return true
end

 

Link to comment

Tu tem que achar a função que abre o painel e passar por triggerEvent. 
Exemplo:

--CLIENT-SIDE

function AbrirPainel ()
		showCursor(true)
		guiSetVisible(Painel, true)
    else          
		showCursor(false)
		guiSetVisible(Painel, false)
  end
end
addEvent("Open_Painel", true)
addEventHandler("Open_Painel", resourceRoot, AbrirPainel)
-- Server Side


Grupo = "Console"
function OpenGerenciador(source)
  	accountname = getAccountName(getPlayerAccount(source))
  	if isObjectInACLGroup("user." .. accountname, aclGetGroup(Grupo)) then
   		 triggerClientEvent(source, "Open_Painel", root)
  	end
end

function BindStart()
  	for index, player in ipairs(getElementsByType("player")) do
   		 bindKey(player, "b", "down", OpenGerenciador)
  	end
end
addEventHandler("onResourceStart", root, BindStart)

function onPlayerJoin()
  	bindKey(source, "b", "down", OpenGerenciador)
end
addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoin)

function StopMod(player)
  	for index, player in ipairs(getElementsByType("player")) do
    	unbindKey(player, "b", "down", OpenGerenciador)
  	end
end
addEventHandler("onResourceStop", root, StopMod)

 

Link to comment
addEventHandler ( "onPlayerLogin", root, function ( ) ----- Server-Side
    local admin = isObjectInACLGroup ( "user."..getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Admin" ) )
    triggerClientEvent ( source, "updateClientRights", source, true, admin )
	triggerClientEvent(source, "showMenu", root)
end )

----- Client-Side

addEvent ( "showMenu", true )
addEventHandler ( "showMenu", root, guiShowMenu )

 

Link to comment
  • 1 year later...
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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