Jump to content

C# - bind keys to commands


Marke137

Recommended Posts

  • 2 months later...
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
Link to comment
Share on other sites

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
Link to comment
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
  • Recently Browsing   0 members

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