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

Preconfig: Fix mp_teamlist cvar being set too late #2

Open
rtxa opened this issue Jan 6, 2024 · 0 comments
Open

Preconfig: Fix mp_teamlist cvar being set too late #2

rtxa opened this issue Jan 6, 2024 · 0 comments

Comments

@rtxa
Copy link

rtxa commented Jan 6, 2024

In Half-Life, the cvar mp_teamlist sets which models are going to be teams, e.g mp_teamlist "hgrunt;scientist". The issue is that HL reads this cvar right before plugin_cfg().

My proposed solution would be to run the preconfig file immediately with server_exec() when the plugin ends so when the map changes, the cvar is already set and the teams will be set correctly. I already tested this and didn't notice any side-effects.

Replace line 841 in file polymorph.sma with:

get_configsdir(szMainFilePath, charsmax(szMainFilePath))
server_cmd("exec %s/polymorph/poly_preconfig%d.cfg", szMainFilePath, g_iNextMod + 1)
server_exec();

Also, I have notice that Polymorph can't read the cvar mp_teamlist properly because it contains semicolons inside which gets trimmed by the next lines.

This get fixed by replacing lines 1039-1041 in polymorph.sma with:

trim(szData);
ArrayPushString(g_aCfgList, szData);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant