Jump to content

ACL Button


TorNix~|nR

Recommended Posts

  • Moderators

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
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...