Mtasa-blue: Players can abuse 'PrtSc' button to cause FPS drops.

Created on 6 Dec 2019  路  8Comments  路  Source: multitheftauto/mtasa-blue

Players, with not powerful PC may use 'PrtSc' button spam, to make windows capture screenshots to often, which would cause a FPS drop. As result, they may gain advantage in some PvP situations.

To reproduce

  1. enable 'showframegraph'
  2. Spam with 'PrtSc' button.
    ...
  3. Profit :)

Additional context
Also, 'PrtSc' is not available for onClientKey event checks, so it is impossible to prevent it from being pressed, or implement some kind of detection to kick players for such activtiy.

bug

Most helpful comment

Adding print screen to onClientKey would have no benefit, MTA can't stop the print screen button from being pressed.

Furthermore, if you did manage to stop them from being able to take screenshots, these users would find another method of causing low FPS (nothing would be stopping them from creating a small c++ script that causes lag).

It would make more sense for you to address this issue in your server/scripts. Many servers implement a low FPS detector, which after a low FPS has been detected multiple times, the user will be warned or kicked.

All 8 comments

In the past when testing this we found that there was a specific video setting that was causing (or rather, exposing) this issue. (Although haron4igg doesn't seem to be able to reproduce it.)

I don't remember exactly which setting it was though

Adding print screen to onClientKey would have no benefit, MTA can't stop the print screen button from being pressed.

Furthermore, if you did manage to stop them from being able to take screenshots, these users would find another method of causing low FPS (nothing would be stopping them from creating a small c++ script that causes lag).

It would make more sense for you to address this issue in your server/scripts. Many servers implement a low FPS detector, which after a low FPS has been detected multiple times, the user will be warned or kicked.

Furthermore, if you did manage to stop them from being able to take screenshots, these users would find another method of causing low FPS (nothing would be stopping them from creating a small c++ script that causes lag).

It's not even that complex. People who wants to exploit this can open any application that might do heavy computations with a keypress (for instance, a screen recorder without GPU acceleration, or your own Bitcoin miner Javascript in a web browser), effectively having infinitely many "lag switches" to choose from.

I agree with the idea that in this case is better to deal with the symptoms than the actual cause of the FPS drop, as any preempted, multitasking OS is vulnerable to these problems by design. Windows doesn't make any strong guarantee to MTA about the CPU time it's going to receive at any time.

By the way, isn't the Print Screen functionality handled by Windows? If that's the case, perhaps MTA can only do little to prevent it from being a source of FPS drops.

If that's the case, perhaps MTA can only do little to prevent it from being a source of FPS drops.

yes the slowdown is in dxd9

As Lopsided mentioned, you can use FPS detectors but these are insufficient in some cases, for example collision based games like DD where you only lower FPS while hitting someone for less than a second. FPS detectors won't or atleast should not always trigger if the FPS are low for a few frames due to the fact many other events exist which could lower FPS like loading assets. Kicking a player cuz his FPS dropped once is also not the right approach, you would either need an AI which analyzes gameplay.

My suggestion:
Add a cooldown for MTA internal screenshot system for F12 key (1-2 seconds)
For print screen key, as its not that relevant for actual gameplay, either kick the player from server when spammed or let the server know the client presses an usual gameplay key too often.

As Lopsided mentioned, you can use FPS detectors but these are insufficient in some cases, for example collision based games like DD where you only lower FPS while hitting someone for less than a second. FPS detectors won't or atleast should not always trigger if the FPS are low for a few frames due to the fact many other events exist which could lower FPS like loading assets. Kicking a player cuz his FPS dropped once is also not the right approach, you would either need an AI which analyzes gameplay.

My suggestion:
Add a cooldown for MTA internal screenshot system for F12 key (1-2 seconds)
For print screen key, as its not that relevant for actual gameplay, either kick the player from server when spammed or let the server know the client presses an usual gameplay key too often.

I really won't like the idea of a cooldown for the F12 key since many of my users do take a lot of pictures so they can report users that are breaking the rules.

There will be always some way to make your FPS drop. I think this should be handled by the server owners and maybe facilitated throught MTA to check which players are having connection problems or FPS problems. In my case I just tag the users that are having too much ping or not that many fps for a while (like 15, 30 or even 60 seconds). I don't think an AI is needed to check this, you just need to be coherent. If a player is laggin for about 60 seconds he would probably keep laggin, so it's better to kick him or even ban him for a few minutes.

The only way to really known the FPS of a player is using onClientRender/onClientPreRender functions tho, could this be abused in someway so the server never knows that you are really lagging?

As Lopsided mentioned, you can use FPS detectors but these are insufficient in some cases, for example collision based games like DD where you only lower FPS while hitting someone for less than a second. FPS detectors won't or atleast should not always trigger if the FPS are low for a few frames due to the fact many other events exist which could lower FPS like loading assets. Kicking a player cuz his FPS dropped once is also not the right approach, you would either need an AI which analyzes gameplay.
My suggestion:
Add a cooldown for MTA internal screenshot system for F12 key (1-2 seconds)
For print screen key, as its not that relevant for actual gameplay, either kick the player from server when spammed or let the server know the client presses an usual gameplay key too often.

I really won't like the idea of a cooldown for the F12 key since many of my users do take a lot of pictures so they can report users that are breaking the rules.

There will be always some way to make your FPS drop. I think this should be handled by the server owners and maybe facilitated throught MTA to check which players are having connection problems or FPS problems. In my case I just tag the users that are having too much ping or not that many fps for a while (like 15, 30 or even 60 seconds). I don't think an AI is needed to check this, you just need to be coherent. If a player is laggin for about 60 seconds he would probably keep laggin, so it's better to kick him or even ban him for a few minutes.

The only way to really known the FPS of a player is using onClientRender/onClientPreRender functions tho, could this be abused in someway so the server never knows that you are really lagging?

Im not talking about low FPS over a long period of time of seconds, but rather few frames or between 1-2 seconds. As I said hitting someone with your car while spamming those keys to lower your FPS for those few frames, how do you want to check it if someone does it conistent to abuse or rather in coincidence due to random events.

Best example: When our mapmanager loads new map, every client dropps to 1 FPS for those few frames/seconds while loading, but thats no reaon for detector to kick. Events like these can be added to the detector, but in the end, is it worth to filter all possible events which could lower FPS or build in a mechanic to check key spamming/cooldown?

MTA screenshots are limited to one per second

Was this page helpful?
0 / 5 - 0 ratings