citizenfx / fivem

The source code for the Cfx.re modification frameworks, such as FiveM, RedM and LibertyM, as well as FXServer.
https://cfx.re/
3.42k stars 2.01k forks source link

Code execution on resource initialization? #2473

Open gtasnail opened 3 months ago

gtasnail commented 3 months ago

What happened?

I'm not entirely sure if this is intended to happen but you can provide code that executes on server start-up via fxmanifest using pcall (without said resource added to start-up) it also executes when refreshing resources

Expected result

I'm honestly not sure

Reproduction steps

Simple basic resource setup with a fxmanifest

Example code with the "issue" present

function stonky()
    print('Hello on refresh resource?')
end
pcall(stonky)

fx_version 'cerulean'
game 'gta5'

Example image of output: image

Importancy

Unknown

Area(s)

FiveM, RedM, FXServer, ScRT: Lua

Specific version(s)

Server 7290 windows

Additional information

No response

slashkeyvalue commented 3 months ago

It's a Lua file, that's expected.

DaniGP17 commented 3 months ago

The fxmanifest.lua is the start entry of the script, in which you define information about the script, it is normal that code can be executed