Jump to content

[Help] Simple problem


BieHDC

Recommended Posts

Posted

I have a easy question. I wanna use a combined key shortcut (rshift + #) to open a panel, but i cant find how to make this.

Here is the Code for bind:

if isPlayerAdmin ( player ) then 
    bindKey ( player, "rshift + #", "down", isPlayerAdmins ) 
end 

AND the same for unbind:

unbindKey ( source, "rshift + #", "down", isPlayerAdmins ) 

Posted

Maybe like this :

addEventHandler( 'onClientRender', getRootElement( ), function( ) 
    if getKeyState( 'lshift' ) then 
        bindKey( '#', 'down', YourFunction ); 
    else 
        unbindKey( '#', 'down', YourFunction ); 
    end 
end ); 

Posted

You missunderstood me

I want a key combination for showing up a GUI and the same for toggle off.

This combination should be set onJoin and on RecourceStart

and if the player quit the bind should be deleted.

Mkay?

Posted

i showed you the way to bind tow keys together ( not sure if it was the best way ), You should make the function that toggles the GUI By Your self, or use this one SetBindKeyWindowShow !

+ You don't need to remove the bind with onPlayerQuit ( makes no sens, it will be removed automatically )

Posted

The function: "isPlayerAdmins" triggers a client event, right? if so, then you can use the same method you currently using and getKeyState on the client side, to make sure the second key is also pressed.

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