Binding Clients F5+F6 keys

I would like to bind my clients F5 and F6 keys to open the wobble menu and make them a wobble person. (RagMorph)

The Con-Commands are: wobblecreate and Wobblemenu

Halp please? =)

Thanks,
-Nick

F5 and F6 are already bound to take pictures and make quicksaves, but why not use F2, 3, or 4? They already have built in commands and assuming you’re using sandbox, are not used by default.

The client must run:

bind F5 wobblecreate
bind F6 Wobblemenu
(stating the obvious, I know.)

I don’t know if you can do that via LUA. If you can, it’s a security risk (rebinding via LUA used to be a big problem).

I wouldn’t want any script rebinding my keys. My suggestion is to find a way to fit it in F3/F4.

edit:

No.

Bind is blocked for security reasons.

[lua]if ( input.IsKeyDown(“KEY_F6”) ) then[/lua]

Thanks flap,

Exactally what I needed, Didn’t want to bind the clients keys forever. Just in my server.

-Nick

But don’t forget: Forcing specific binds to your player’s is always a bad idea, since they could already have bound it to something (important) which now doesn’t work anymore.

I’d suggest to add an entry in the spawnmenu or somewhere else which opens the specific ragmorph menu or tell them how to bind it theirselves.

Does the forum think this would work?
[lua]if ( input.IsKeyDown(“KEY_F1”) ) then
RunConsoleCommand( “Wobblecreate” )
end[/lua]

That would run the console command every tick as long as the key is depressed, use **[Player.KeyPressed

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Player.KeyPressed)** instead.

Thanks Kopimi
-Nick

Please stop signing your posts :downs:
(Bugs da crap outta me)

I’d agree with you more if the majority of your posts werent absolutely retarded.

Glad to help Nick

-Kopimi <3

When a Key is ‘bound’ with this, will client’s binds still work?

Yes, though it may interfere. If they have F5 bound to +forward for some reason, and it opens an inventory, then it’ll merely run both.

Alright, I tried this out… Dosent appear to be working though.
[lua]local players = player.GetAll()
for _, player in ipairs( players ) do
if( player:KeyPressed( KEY_F1 ) ) then
RunConsoleCommand( “Wobblecreate” )
end
end

local players = player.GetAll()
for _, player in ipairs( players ) do
if( player:KeyPressed( KEY_F2 ) ) then
RunConsoleCommand( “Wobblemenu” )
end
end[/lua]
I’m usually not this retarded in lua, I am just having allot of trouble with this.

Really depends where you have that code.

You run it Clientside or Serverside?

I’m guessing it’s clientside since he’s using RunConsoleCommand. Move it to the server, don’t know which hook though.

Also, F1 and F2 are already hookable, respectively with ShowHelp and ShowTeam.

But when he is running it clientside, why the hell is he doing
[lua]
for _, player in ipairs( players ) do
[/lua]

Maybe it’s shared :stuck_out_tongue:

This is probably why he needed our help, but too lazy to fix it up now.

Leeetdude go away.

[lua]
for _, player in ipairs( players ) do
[/lua]

There is nothing wrong with what he did.