[API/dev resource] screenshot-basic - make screenshots of clients' games!

Option 1-2-3 not work for me and ı cant be understand what ı am gonna be do with option 4 ?

I’ve done some testings with NVIDIA and AMD cards and it works fine on NVIDIA but with AMD GPUs I always get black screenshots, maybe It’s related with this https://github.com/mrdoob/three.js/issues/14137

EDIT: Maybe its a problem with the GLSL because AMD GLSL compiler its strict while NVIDIA’s compiler is laxer https://www.geeks3d.com/20101002/tips-how-to-quickly-test-glsl-shaders-for-ati-on-a-nvidia-system/

EDIT2: Sorry for too many edits, after some tests I found GLSL is working as intended, I think the trick with the CfxTexture is not working on AMD GPUs :confused:

2 Likes

have you fixed it ?

As Nowimps8 said try adding on top of your server “.bat” but with 850 instead

@ECHO OFF
CHCP 850
CLS

Any solution for this?

Could not start dependency webpack for resource screenshot-basic.
musl libc (x86_64)
Version 1.1.22
Dynamic Program Loader
Usage: /home/dev/fx-server/alpine/opt/cfx-server/ld-musl-x86_64.so.1 [options] [--] pathname [args]
retrieved banlist
Building resource webpack failed.
Error data: yarn failed!

Just updated cfx, same thing

Its because yarn is not working on Linux, check this Webpack on Linux Server

If you have a windows machine you can take a workaround following this steps:

  • Create a fivem server on windows and add this resource to it.
  • Add “start yarn” and “start screenshot-basic” to your server.cfg.
  • Start the server and let it build the resource webpack.
  • Open the “__resource.lua” of screenshot-basic and remove the following lines:
> dependency 'yarn'
> dependency 'webpack'
> webpack_config 'client.config.js'
> webpack_config 'server.config.js'
> webpack_config 'ui.config.js'
  • Delete the following files and folders (not needed because the resource is builded now)

node_modules
src
ui
client.config.js
server.config.js
ui.config.js
yarn.lock
dist\ui.js

  • Move the screenshot-basic resource folder to your Linux server and it’s ready to go :wink:

Sorry for my bad english, hope this helps you :slight_smile:

4 Likes

Why does it when you upload to wew.wtf/upload.php it shares the same link, so after you have taken a screenshot of a client it only shows the first screenshot as a new link is not generated.

It took me a while to understand your problem :sweat_smile:
The data you get back after uploading an screenshot it’s sent by the remote server and can be happening two things:

  1. The remote upload server is not sending any data to access the image (if it sends it back, don’t confuse with request url) or its faulty.
  2. The response from the remote upload it’s being cached and that’s why you get alwais the same url back.

With the first case if it’s your own service check it sends back valid information, if it’s a third party service I can’t help you with it.

In the second case you have to add an small modification to the code and rebuild the resource, I recommend you doing this with a fresh copy of screenshot-basic before runing the resource. Under line 173 and 184 of ui/src/main.ts (https://github.com/citizenfx/screenshot-basic/blob/de9ecac9e7ec90aeda4260d54b34e5f87ee6fa93/ui/src/main.ts#L173 https://github.com/citizenfx/screenshot-basic/blob/de9ecac9e7ec90aeda4260d54b34e5f87ee6fa93/ui/src/main.ts#L184) add the following line.

cache: ‘no-store’,

so you will end having this

mode: ‘cors’,
cache: ‘no-store’,
body: (request.targetField) ? getFormData() : JSON.stringify({

mode: ‘cors’,
cache: ‘no-store’,
body: JSON.stringify({

Note: Be carefull copying this because quotes get stylished here and you need simple quotes.

Hope this helps you :slight_smile:

So I have good news and bad news.

Good news is that it is making a fresh new link per upload unlike before, confirming the latter of the 2 problems you suggested is the problem.

Bad news is that it isn’t taking a fresh image. Although a new link is being returned I think it is caching the first screenshot therefore if I move and then take another screenshot it would still show what I had before I moved.

I done this with a fresh version of screenshot-basic.

What export should i use to get my screenshot uploaded to the resource folder or somewhere on my server files

@mmando

exports['screenshot-basic']:requestClientScreenshot(GetPlayers()[1], {
    fileName = 'cache/screenshot.jpg'
}, function(err, data)
    print('err', err)
    print('data', data)
end)

This when called by the server to all or a specific client will save a screenshot as a .jpg to the cache, the location can be changed to see fit.

Did you fix the black screen?

1 Like

Before you connect to the server make sure FiveM is in fullscreen.

well i got that error

No such export requestClientScreenshoot in resource screenshot-basic

fixed my bad i had to use it as server side

I remember getting that error but can’t remember how I fixed it.

1 Like

Getting this error when attempting to install yarn

Did you manage to fix this problem? If you did, how so?

As said on chat:

Really, Node? Why fail fatally if a console is not using TrueType fonts, like all default console on non-East Asian Windows before 10?

TL;DR: enable TrueType fonts for your console defaults.

2 Likes

Thank you. I got it working properly.

I think I found why this gives black screenshots on some GPUs, allmost on AMD GPUs. It’s because this works by using three OpenGL extension filters on a custom material, two of them “ARB_sparse_texture_clamp” and “ARB_texture_filter_minmax” are not implemented well implemented on AMD cards.

In unextended OpenGL, minification and magnification filters such as LINEAR allow texture lookups to returned a filtered texel value produced by computing an weighted average of a collection of texels in the neighborhood of the texture coordinate provided.

AMD RADEON RX 580 (NON WORKING CARD)

NVIDIA GTX 970 (WORKING CARD)

2 Likes