Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a way to prevent server-side prints from being redirected to players #3029

Open
SloPro opened this issue Dec 22, 2024 · 3 comments
Open
Assignees
Labels
bug ScRT: Lua Issues/PRs related to the Lua scripting runtime triage Needs a preliminary assessment to determine the urgency and required action

Comments

@SloPro
Copy link
Contributor

SloPro commented Dec 22, 2024

What happened?

Hello,

this isn't technically a bug report, but I was told to post this here anyway by Heron.

I used to use Lua's io.write(message) to be able to guarantee certain server console output will never get redirected to a client, e.g. when executing a command. io.write would just print directly to stdout without triggering the redirect. This no longer works as of build 12092 (not exact number) as io.write doesn't exist anymore. It worked in 11516.

Since io.write doesn't exist anymore, and JavaScript's similar process.stdout.write is also apparently planned to be removed, I'd like to suggest a way to prevent these redirects from happening.

Thanks

Expected result

Prints to stdout

Reproduction steps

-- on the server:
RegisterCommand('test', function()
    print('this is a server-side print')
end)

Once a player executes the /test command from the code below, the output will be seen in the client's F8 console (and potentially stock chat). It's transmitted via a __cfx:internal:serverPrint S->C event. I think it would be good to have a way to print to the server's console in such cases without the player being able to read what it says.

Importancy

Unknown

Area(s)

FiveM, FXServer, ScRT: Lua

Specific version(s)

FXServer 12092

Additional information

No response

@SloPro SloPro added bug triage Needs a preliminary assessment to determine the urgency and required action labels Dec 22, 2024
@github-actions github-actions bot added the ScRT: Lua Issues/PRs related to the Lua scripting runtime label Dec 22, 2024
@AvarianKnight
Copy link
Contributor

AvarianKnight commented Dec 22, 2024

You can already do this

con_removeChannelFilter "forward:*/*" noprint

This overwrites the forward the server does here

EDIT: Looking at the code this should stop the print from getting forwarded to the client, you should double check that it actually works

@SloPro
Copy link
Contributor Author

SloPro commented Dec 22, 2024

It indeed doesn't do anything for this case, that has been included in our cfg for a while. Even if I manually invoke it again, it makes no difference, as seen below:

image

@AvarianKnight
Copy link
Contributor

Yea looks like this logic isn't actually uses except to not print to the server, the scope destructor will still print to the client no matter what.

Wonder if people would be against all of this being the default and having to opt in to this forwarding & sending to the client as I don't think most people have liked this being the default anyways.

@FabianTerhorst FabianTerhorst self-assigned this Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ScRT: Lua Issues/PRs related to the Lua scripting runtime triage Needs a preliminary assessment to determine the urgency and required action
Projects
None yet
Development

No branches or pull requests

3 participants