DiGiTal Posted May 15, 2017 Share Posted May 15, 2017 Hi, i have a HELP PANEL ADMIN which contain all info,commands for probi admin,but i want to only admins can open it thanks Link to comment
Reval Posted May 15, 2017 Share Posted May 15, 2017 try this client side Spoiler function guiToggleVisible ( ) if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount (player) ), aclGetGroup ( "Admin" ) ) then if ( guiGetVisible ( admenwindow ) == true ) then -- check if the gui element is visible guiSetVisible ( admenwindow, false ) -- if it is, we hide it showCursor(false) else guiSetVisible ( admenwindow, true ) -- if not, we make it visible showCursor(true) end end end 1 Link to comment
DNL291 Posted May 15, 2017 Share Posted May 15, 2017 (edited) Use these functions Server side: getAccountName getPlayerAccount isObjectInACLGroup aclGetGroup triggerClientEvent And trigger a Client custom event to open the panel. 1 hour ago, Reval said: try this client side Hide contents function guiToggleVisible ( ) if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount (player) ), aclGetGroup ( "Admin" ) ) then if ( guiGetVisible ( admenwindow ) == true ) then -- check if the gui element is visible guiSetVisible ( admenwindow, false ) -- if it is, we hide it showCursor(false) else guiSetVisible ( admenwindow, true ) -- if not, we make it visible showCursor(true) end end end That will not work. You're mixing server-side functions with client side. Edited May 15, 2017 by DNL291 1 Link to comment
Ahmed Ly Posted May 15, 2017 Share Posted May 15, 2017 --Client key = "F3" bindKey(key,"down", function () triggerServerEvent("onPlayerOpenPanel",localPlayer) end ) addEvent("open",true) addEventHandler("open",root, function () if guiGetVisible (Window ) == false then guiSetVisible (Window,true) showCursor(true) playSoundFrontEnd(20) else guiSetVisible (Window,false) showCursor(false) end end ) --Server addEvent("onPlayerOpenPanel",true) addEventHandler("onPlayerOpenPanel",root, function () acc = getPlayerAccount(source) if not isGuestAccount(acc) then if isObjectInACLGroup( "user.".. getAccountName(acc),aclGetGroup ( "Admin" ) ) then triggerClientEvent(source,"open",source) end end end ) 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now