Jump to content

(Help please) How do I add bindKey to this?


Adde

Recommended Posts

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 by Guest
Link to comment

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 by Guest
Link to comment
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
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

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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...