Jump to content

ACL Button 2


TorNix~|nR

Recommended Posts

Hello guys, I don't know where the problem is in this code

I'm trying to make the button only for the ACL 'Admin'

The messages 'fail' and 'done' in server-side are working but the panel appears anyway

client-side

addEvent("trigger", true)
addEventHandler("onClientGUIClick", getRootElement(), function()
		if (source == button[1]) then	
		triggerServerEvent("trigger", localPlayer)
		guiSetVisible(window[4], true)
		guiBringToFront(window[4])
end)

server-side

addEvent("trigger", true)
function Test(plr)
	if (not isElement(plr)) then return end	
    if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then
	triggerClientEvent(plr, "trigger", plr)
	outputChatBox("done")
else
return outputChatBox("fail") end
end
end
addEventHandler("trigger", root, Test)

any help please?

Link to comment
  • Moderators
1 hour ago, TorNix~|nR said:

I don't know where the problem is in this code

Without library, you have to use triggerClientEvent to send a message back. You can't use the return keyword to send data back.

 

"onClientGUIClick" > triggerServerEvent > isObjectInACLGroup...  > triggerClientEvent > guiSetVisible...

 

 

 

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