Adde Posted August 23, 2013 Share Posted August 23, 2013 (edited) Hello I have done a function that only makes people in acl group VIP available to write /vip and open the vip gui. I have tried different things but noone of them have worked. So, how do I add a bind that also only works for acl group VIP? server function theGUIshow(thePlayer) local account = getPlayerAccount(thePlayer) local accName1 = getAccountName(account) if isObjectInACLGroup ("user."..accName1, aclGetGroup ( "VIP" ) ) then triggerClientEvent(thePlayer,"showTheGUI", thePlayer) else cancelEvent() end end addCommandHandler("vip",theGUIshow) client function openGUI() if guiGetVisible(GUIEditor.window[100]) == true then guiSetVisible(GUIEditor.window[100], false) showCursor(false) guiSetInputEnabled(false) else guiSetVisible(GUIEditor.window[100], true) showCursor(true) guiSetInputEnabled(true) end end addEvent("showTheGUI",true) addEventHandler("showTheGUI", getLocalPlayer(),openGUI) Edited August 23, 2013 by Guest Link to comment
Prime Posted August 23, 2013 Share Posted August 23, 2013 (edited) I just tried it and it works fine for me. Possibly some problem with your gui function. And try changing Client line 2 to if guiGetVisible(GUIEditor.window[100]) then as it opens the gui but doesn't close it bindKey ( player, "", "down", theGUIshow) Edited August 24, 2013 by Guest Link to comment
Adde Posted August 23, 2013 Author Share Posted August 23, 2013 I just tried it and it works fine for me. Possibly some problem with your gui function. And try changing Client line 2 to if guiGetVisible(GUIEditor.window[100]) then as it opens the gui but doesn't close it But I don´t know where I should place "bindKey" Okay, I changed that. Link to comment
Ab-47 Posted August 23, 2013 Share Posted August 23, 2013 I just tried it and it works fine for me. Possibly some problem with your gui function. And try changing Client line 2 to if guiGetVisible(GUIEditor.window[100]) then as it opens the gui but doesn't close it But I don´t know where I should place "bindKey" Okay, I changed that. Replace: addCommandHandler("vip",theGUIshow) with: bindKey("key", "down", theGUIshow) Make sure you replace "key" with your key such as "f1", "f2", "a", "b", etc. for i.e: bindKey("f1", "down", theGUIshow) Link to comment
Adde Posted August 23, 2013 Author Share Posted August 23, 2013 Tried that before. Debug: Bad argument ´bindKey´. Link to comment
Ab-47 Posted August 23, 2013 Share Posted August 23, 2013 Tried that before. Debug: Bad argument ´bindKey´. Just realized, it's a server side function, try using a player argument: bindKey(player, "key", "down", theGUIshow) for i.e: bindKey(player, "f1", "down", theGUIshow) Link to comment
Adde Posted August 23, 2013 Author Share Posted August 23, 2013 Na, didn´t make anything better. Same debug and no panel. Link to comment
manawydan Posted August 23, 2013 Share Posted August 23, 2013 try no tested function theGUIshow(thePlayer) local account = getPlayerAccount(thePlayer) local accName1 = getAccountName(account) if isObjectInACLGroup ("user."..accName1, aclGetGroup ( "VIP" ) ) then triggerClientEvent(thePlayer,"showTheGUI", thePlayer) end end function BindHere() bindKey(source, "f1", "down", theGUIshow) end addEventHandler("onPlayerLogin",getRootElement(),BindHere) Link to comment
Adde Posted August 24, 2013 Author Share Posted August 24, 2013 try no tested function theGUIshow(thePlayer) local account = getPlayerAccount(thePlayer) local accName1 = getAccountName(account) if isObjectInACLGroup ("user."..accName1, aclGetGroup ( "VIP" ) ) then triggerClientEvent(thePlayer,"showTheGUI", thePlayer) end end function BindHere() bindKey(source, "f1", "down", theGUIshow) end addEventHandler("onPlayerLogin",getRootElement(),BindHere) It works man, thanks! 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