Sign in to follow this  
TorNix~|nR

ACL Button

Recommended Posts

Hello guys, I wanted to know how to make this button be visible or open only for specific ACL

button = guiCreateButton(370, 525, 80, 30, "Button", false, tab)

if (source == button) then
		-- opens punishment window
		guiSetVisible(window, true)
		guiBringToFront(window)

Help please

Share this post


Link to post
Posted (edited)

https://wiki.multitheftauto.com/wiki/IsPlayerInACL

 

This example open window with command.

First, check acl rights on server side, after it trigger client.

-- SERVER

function isPlayerInACL(player, acl)
    if isElement(player) and getElementType(player) == "player" and aclGetGroup(acl or "") and not isGuestAccount(getPlayerAccount(player)) then
        local account = getPlayerAccount(player)
        return isObjectInACLGroup( "user.".. getAccountName(account), aclGetGroup(acl) )
    end
    return false
end

addCommandHandler("open", function(player)
    if isPlayerInACL(player, "groupWhoCanOpenPanel") then -- is player added to acl group?
        triggerClientEvent(player, "openPanel", player) -- if yes trigger the panel open
    else
        outputChatBox("You have no right to it :(", player) -- :(
    end
end)

 

-- CLIENT

addEvent("openWindow", true)
addEventHandler("openWindow", root, function()
    guiSetVisible(window, true)
    guiBringToFront(window)
end)

 

Edited by stPatrick
  • Thanks 1

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.