|H|TiTanium Posted June 23, 2013 Share Posted June 23, 2013 I'm doing an event manager, built in a GUI panel. But of course, I gotta make only admins allowed to open GUI, but everytime I try to add the below code (I'm not sure if I'm using the right one) I get message errors. But I'm sure something is wrong, as when I log, GUI opens automatically, so basic I want this : I wanna make only Admins allowed to open GUI, and to make it appear using /events and so close using myButton8 local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ( "user.".. accName, aclGetGroup ( "Admin" ) ) then I wanna add the above code to the code below. function showGUI ( ) if ( guiGetVisible ( myWindow ) == true ) then guiSetVisible ( myWindow, false ) else guiSetVisible ( myWindow, true ) showCursor( true ) end end addEventHandler("onClientResourceStart", resourceRoot, showGUI) addCommandHandler ( "events", showGUI ) function closeGUI ( ) guiSetVisible ( myWindow, false ) showCursor( false ) end addEventHandler("onClientGUIClick", myButton8, closeGUI, false) Link to comment
iPrestege Posted June 23, 2013 Share Posted June 23, 2013 You're not make much sense anyway try this : -- Client Side -- addCommandHandler('events', function ( ) triggerServerEvent ('aCheckGroup',localPlayer) end ) addEvent('aCheckDone',true) addEventHandler('aCheckDone',root, function ( ) state = guiGetVisible ( myWindow ) guiSetVisible ( myWindow,not state ) showCursor ( state ) end ) function closeGUI ( ) guiSetVisible ( myWindow, false ) showCursor( false ) end addEventHandler("onClientGUIClick", myButton8, closeGUI, false) -- Server Side -- addEvent('aCheckGroup',true) addEventHandler('aCheckGroup',root, function ( ) if isGuestAccount ( getPlayerAccount ( client ) ) then return false end local aPlayerAccount = getAccountName ( getPlayerAccount ( client ) ) if isObjectInACLGroup ('user.'..aPlayerAccount, aclGetGroup ( 'Admin' ) ) then triggerClientEvent ( client,'aCheckDone',client ) else outputChatBox('Access denied',client,255,0,0) end end ) 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