multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.38k stars 424 forks source link

Ability to choose the latest minclientversion automatically. #3577

Open YelehaUwU opened 2 months ago

YelehaUwU commented 2 months ago

Is your feature request related to a problem? Please describe.

No response

Describe the solution you'd like

I would like the value latest to be implemented as a parameter of minclientversion in the mtaserver.conf and preferably set as default, for servers to be up to date and make the server config require less attention.

Describe alternatives you've considered

No response

Additional context

No response

Security Policy

TracerDS commented 2 months ago

Mta does version checks when client joins. It checks against its version, not against the latest one. Server would have to sync with mta's nightly to get the latest version number. That would be quite a hassle.

In my opinion this is pointless and it just introduces laziness.

YelehaUwU commented 2 months ago

https://github.com/multitheftauto/mtasa-blue/blob/b6fc1b5156337d0ad5be540881b71b8ee362fd3a/Server/mods/deathmatch/utils/CHqComms.h#L147

Part of it's already implemented here as part of HQ updates, how would it be a hassle to implement?

There could be a setting that would determine if it should automatically change to latest and just reuse this function.

TracerDS commented 2 months ago

https://github.com/multitheftauto/mtasa-blue/blob/b6fc1b5156337d0ad5be540881b71b8ee362fd3a/Server/mods/deathmatch/utils/CHqComms.h#L147

Part of it's already implemented here as part of HQ updates, how would it be a hassle to implement?

There could be a setting that would determine if it should automatically change to latest and just reuse this function.

it processes it from the client, hence the bitStream. It would be a hassle because MTA would need to create an API for just returning latest version, update it every build and sync it with every server on the planet. Its trivial, but it takes time with little to no benefit at all.

YelehaUwU commented 2 months ago

Can't we use https://nightly.multitheftauto.com/ver/ data?

TracerDS commented 2 months ago

Can't we use https://nightly.multitheftauto.com/ver/ data?

Yes, we can use it to fetch current version if there is a way to get pure version info for current release (1.6). If not, there would be a lot of fiddling with webscraping

Fernando-A-Rocha commented 2 months ago

Good idea. Just add an endpoint like https://nightly.multitheftauto.com/ver/latest that returns the latest nightly version string meant to be used by all servers

jlillis commented 2 months ago

This is already possible using minclientversion_auto_update. You can also use the acpanel resource to set this and many more anticheat related options.

Good idea. Just add an endpoint like https://nightly.multitheftauto.com/ver/latest that returns the latest nightly version string meant to be used by all servers

This already exists. An example of it in use is available in the acpanel resource.

YelehaUwU commented 1 month ago

The setting minclientversion_auto_update doesn't work for some reason. I'll see about tweaking the acpanel resource as it gets the 1.3 version instead of 1.6

TracerDS commented 1 month ago

The setting minclientversion_auto_update doesn't work for some reason. I'll see about tweaking the acpanel resource as it gets the 1.3 version instead of 1.6

Hmmm, it seems its not used anywhere. Just defined but not used image

Fernando-A-Rocha commented 1 month ago

@Dutchman101 can you elaborate on the purpose of minclientversion_auto_update, considering you are in the MTA AC team?

Xenius97 commented 1 month ago

U can do it with a simple script, just using lua:

function refreshMinVersion()
    fetchRemote("https://nightly.multitheftauto.com/ver/", function(body, err)
        local minclientVersion = "1.6.0-9.22628.0"
        if err == 0 then
            local version = "1.6"
            local pattern = "<b>version: " .. version .. "</b>.-Max recommended/minclientversion:%s*([%d%.%-]+)"

            minclientVersion = string.match(body, pattern)
        else
            iprint("Error fetching data: " .. err)
        end

        setServerConfigSetting("minclientversion", minclientVersion, true) -- https://nightly.mtasa.com/ver/ -> Max recommended/minclientversion
        iprint("Min client version set to: " .. minclientVersion)
    end)
end

addEventHandler("onResourceStart", resourceRoot, function()
    refreshMinVersion()
    setTimer(refreshMinVersion, 60000 * 60 * 8, 0) -- optional [auto update every 8 hour]
end)
YelehaUwU commented 1 month ago

It's nice, but we're trying to find out the reasoning behind it not being implemented in the server config in a functional way when the setting exists.

Fernando-A-Rocha commented 1 month ago

It's nice, but we're trying to find out the reasoning behind it not being implemented in the server config in a functional way when the setting exists.

I just tested something. I set minclientversion in mtaserver.conf to empty, and minclientversion_auto_update to 2. After starting the server, this setting was set to 1.6.0-9.22628.0 automatically. So this feature is doing something, it's just not very transparent on what happens...

YelehaUwU commented 1 month ago

Can you try doing the same while the server is turned off? Maybe the file was in use and thus got rewritten back, happened to me few times.

Fernando-A-Rocha commented 1 month ago

What you mean exactly?

YelehaUwU commented 1 month ago

Maybe the server config wasnt properly saved due to the server running

-------- Pôvodná správa --------

    1. 2024 15:09, Fernando Rocha napísal/a:

What you mean exactly?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

Fernando-A-Rocha commented 1 month ago

Server doesn't detect config changes if you edit mtaserver.conf while the server is running. It reads the values on server startup

YelehaUwU commented 1 month ago

Whenever I edited it while it was running, there was a 50/50 chance it would revert the changes on restart :d

-------- Pôvodná správa --------

    1. 2024 16:14, Fernando Rocha napísal/a:

Server doesn't detect config changes if you edit mtaserver.conf while the server is running. It reads the values on server startup

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>