manve1 Posted September 22, 2012 Share Posted September 22, 2012 i'm trying to trigger ACL to client side and i just can't manage it my self, tried out different way's, but still didn't open the window. client: function triggering_cc() if ( guiGetVisible ( Wnd ) == true ) then guiSetVisible ( Wnd, false ) showCursor(false) else guiSetVisible ( Wnd, true ) showCursor(true) end end addEvent( "triggering_c", true ) addEventHandler("triggering_c", root, triggering_cc) server: function triggering() if isObjectInACLGroup ( "user." ..getAccountName ( getPlayerAccount ( p ) ), aclGetGroup ( "Moderator" ) )then bindKey('p','down', function() guiSetVisible(Wnd, not guiGetVisible(Wnd)) showCursor(not isCursorShowing()) end ) triggerClientEvent ( thePlayer, "triggering_c", getRootElement() ) end end Link to comment
DiSaMe Posted September 22, 2012 Share Posted September 22, 2012 You need the server to tell the client if he/she has access to the window and the client should do the rest of the job. Something like this: Server: function letUseTheGUIIfModerator(player) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Moderator")) then triggerClientEvent(player, "letUseTheGUI", root) end end Client: function createModeratorGUI() Wnd = guiCreateWindow(100, 100, 100, 100, "SomeWindow", false) --do everything else what you need in that window bindKey("p", "down", function() local show = not guiGetVisible(Wnd) guiSetVisible(Wnd, show) showCursor(show) end ) end addEvent("letUseTheGUI", true) addEventHandler("letUseTheGUI", root, createModeratorGUI) You will need to call letUseTheGUIIfModerator from the server-side script (make sure the client will have downloaded the script when you do so). This function checks if the player is a moderator, and if so, then tells the client to create the window by triggering "letUseTheGUI" event. On the client, this causes createModeratorGUI to be called and this function creates the window and binds the key P to toggle the visibility of that window. Link to comment
manve1 Posted September 22, 2012 Author Share Posted September 22, 2012 it already has a Wnd ( window or GUI create ) Link to comment
DiSaMe Posted September 22, 2012 Share Posted September 22, 2012 Then remove the window creation part from createModeratorGUI, what's the problem? Link to comment
manve1 Posted September 22, 2012 Author Share Posted September 22, 2012 the problem is it still doesn't work Link to comment
DiSaMe Posted September 22, 2012 Share Posted September 22, 2012 Any more information? /debugscript? Full code? 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