manve1 Posted October 17, 2012 Posted October 17, 2012 I have a problem trying to trigger ACL functions to client side from server side. LUA - CLIENT: hWnd_Commands = guiCreateWindow( 0.2, 0.2, 0.6, 0.6, "Admin LVL.5 Commands || By Enjoy || Version 1.0", true ) hGrid_Admin = guiCreateGridList( 0.1, 0.1, 0.8, 0.6, true, hWnd_Commands ) function visibleToAdmin5(p) triggerServerEvent('aclAdmin5', root) guiSetVisible(hWnd_Commands, true) showCursor(true) end addCommandHandler('mycmds', visibleToAdmin5) addEventHandler('onPlayerLogin', getRootElement(), visibleToAdmin5) LUA - SERVER: addEvent('aclAdmin5',true) function aclAdmin5_( p ) if isObjectInACLGroup ( "user." ..getAccountName ( getPlayerAccount ( p ) ), aclGetGroup ( "Admin5" ) ) then end end addEventHandler('aclAdmin5', getRootElement(), aclAdmin5_) ERRORS - PIC: Looking for tutorials or information? check out: www.simpleask.co.uk
Callum Posted October 17, 2012 Posted October 17, 2012 Either change 'p' to source (and remove 'p' from the function params), or change Line 4 (client-side) to; triggerServerEvent("aclAdmin5",localPlayer,localPlayer) Retired
TwiX! Posted October 17, 2012 Posted October 17, 2012 addEventHandler('onPlayerLogin', getRootElement(), visibleToAdmin5) This event can use only 'source' - Working on [php/HTML/Mysql/Lua/Java Scripts/Web Design/3D Modeling]
Renkon Posted October 17, 2012 Posted October 17, 2012 You are triggering the event from client to server, but you haven't added any ARGUMENT, so p is null. hWnd_Commands = guiCreateWindow( 0.2, 0.2, 0.6, 0.6, "Admin LVL.5 Commands || By Enjoy || Version 1.0", true ) hGrid_Admin = guiCreateGridList( 0.1, 0.1, 0.8, 0.6, true, hWnd_Commands ) function visibleToAdmin5() triggerServerEvent('aclAdmin5', root, source) guiSetVisible(hWnd_Commands, true) showCursor(true) end addCommandHandler('mycmds', visibleToAdmin5) addEventHandler('onPlayerLogin', getRootElement(), visibleToAdmin5)
manve1 Posted October 17, 2012 Author Posted October 17, 2012 You are triggering the event from client to server, but you haven't added any ARGUMENT, so p is null. hWnd_Commands = guiCreateWindow( 0.2, 0.2, 0.6, 0.6, "Admin LVL.5 Commands || By Enjoy || Version 1.0", true ) hGrid_Admin = guiCreateGridList( 0.1, 0.1, 0.8, 0.6, true, hWnd_Commands ) function visibleToAdmin5() triggerServerEvent('aclAdmin5', root, source) guiSetVisible(hWnd_Commands, true) showCursor(true) end addCommandHandler('mycmds', visibleToAdmin5) addEventHandler('onPlayerLogin', getRootElement(), visibleToAdmin5) oh yeh, i am, ty bro, only problem = it don't work Looking for tutorials or information? check out: www.simpleask.co.uk
Renkon Posted October 17, 2012 Posted October 17, 2012 In ServerEvent, set as second argument, localPlayer instead of root
Araa Posted October 17, 2012 Posted October 17, 2012 LUA - CLIENT: addEventHandler("onClientResourceStart", resourceRoot, function() hWnd_Commands = guiCreateWindow( 0.2, 0.2, 0.6, 0.6, "Admin LVL.5 Commands || By Enjoy || Version 1.0", true ) hGrid_Admin = guiCreateGridList( 0.1, 0.1, 0.8, 0.6, true, hWnd_Commands ) guiSetVisible(hWnd_Commands, false) end) function visibleToAdmin5() triggerServerEvent('aclAdmin5', root) guiSetVisible(hWnd_Commands, true) showCursor(true) end addCommandHandler('mycmds', visibleToAdmin5) addEventHandler('onPlayerLogin', getRootElement(), visibleToAdmin5) LUA - SERVER: addEvent('aclAdmin5',true) function aclAdmin5_( ) if isObjectInACLGroup ( "user." ..getAccountName ( getPlayerAccount ( client ) ), aclGetGroup ( "Admin5" ) ) then end end addEventHandler('aclAdmin5', getRootElement(), aclAdmin5_) Anyways, what you are trying to do it to make the check serverside? If so, it doesn't return any value, thus won't really make any effect on the clientside function. Hi, this is a signature.
manve1 Posted October 18, 2012 Author Posted October 18, 2012 It still doesn't make GUI visible to people that are in the acl group Admin5 Looking for tutorials or information? check out: www.simpleask.co.uk
myonlake Posted October 18, 2012 Posted October 18, 2012 It still doesn't make GUI visible to people that are in the acl group Admin5 Probably because you aren't doing anything when it checks that. If I helped you, please click the like button on the right Thanks!
manve1 Posted October 18, 2012 Author Posted October 18, 2012 It still doesn't make GUI visible to people that are in the acl group Admin5 Probably because you aren't doing anything when it checks that. don't really get what you mean Looking for tutorials or information? check out: www.simpleask.co.uk
myonlake Posted October 18, 2012 Posted October 18, 2012 The event which you have server-side doesn't return anything. This should work. Client-side function g_commands() if not isElement(hWnd_Commands) then hWnd_Commands = guiCreateWindow(0.2, 0.2, 0.6, 0.6, "Admin LVL.5 Commands || By Enjoy || Version 1.0", true) hGrid_Admin = guiCreateGridList(0.1, 0.1, 0.8, 0.6, true, hWnd_Commands) showCursor(true) else destroyElement(hWnd_Commands) showCursor(false) end ) function visibleToAdmin5() triggerServerEvent("aclAdmin5", localPlayer) end addCommandHandler("mycmds", visibleToAdmin5) addEventHandler("onPlayerLogin", root, visibleToAdmin5) addEvent("onPermissionGranted", true) addEventHandler("onPermissionGranted", root, function() g_commands() end ) Server-side addEvent("aclAdmin5", true) addEventHandler("aclAdmin5", root, function() if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(source)), aclGetGroup ("Admin5")) then triggerClientEvent("onPermissionGranted", source) end end ) Edit: Just realized this is my 666th post, lmao. If I helped you, please click the like button on the right Thanks!
manve1 Posted October 18, 2012 Author Posted October 18, 2012 works, thank you. Looking for tutorials or information? check out: www.simpleask.co.uk
myonlake Posted October 18, 2012 Posted October 18, 2012 No problem If I helped you, please click the like button on the right Thanks!
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