Sign in to follow this  
Marke137

C# - bind keys to commands

Recommended Posts

just call an event from the client via player.callRemote("server.event") when player pressed a key.

Share this post


Link to post
Share on other sites

You will have to implement a binding function by yourself, currently that bind function from JS doesn't exist on C#

Share this post


Link to post
Share on other sites
Posted (edited)
12 hours ago, Division said:

just call an event from the client via player.callRemote("server.event") when player pressed a key.

Don't, please, that's the worst thing you can do to your server and to your network. You're not gonna even make it hard for people to (d)dos your server when they can just spam a button and be sure that the server will trust and accept all of the packets.

 

If you want to execute a command on a keypress, then process the key press inside your client script, do your checks and only then send the event to the server. Also I would advise to add a delay and check how much time passed since last key press (so you can limit a key press every second/2 seconds etc if you care about your server).

Edited by robearded

Share this post


Link to post
Share on other sites
Posted (edited)
vor 6 Stunden schrieb robearded:

Don't, please, that's the worst thing you can do to your server and to your network. You're not gonna even make it hard for people to (d)dos your server when they can just spam a button and be sure that the server will trust and accept all of the packets.

 

If you want to execute a command on a keypress, then process the key press inside your client script, do your checks and only then send the event to the server. Also I would advise to add a delay and check how much time passed since last key press (so you can limit a key press every second/2 seconds etc if you care about your server).

exactly what I wrote. I thought that building a "security" delay dont need to be mentioned :)
But agree 100% highly important!

Edited by Division

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.