AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Force AutoExecConfig() to create cfg in late (https://forums.alliedmods.net/showthread.php?t=311669)

Dragokas 10-28-2018 09:12

Force AutoExecConfig() to create cfg in late
 
Hi,

I do like to use sm engine to update convar values in cfg file.

Unfortunately:

Code:

char g_sConfigFile[30] = "l4d_test_plugin";

public void OnPluginStart()
{
    AutoExecConfig(true, g_sConfigFile);
}

is work, but calling:
Code:

void UpdateCfg()
{
        char sPath[PLATFORM_MAX_PATH];
        Format(sPath, sizeof(sPath), "cfg/sourcemod/%s.cfg", g_sConfigFile);
        DeleteFile(sPath);
        AutoExecConfig(true, g_sConfigFile);
}

in late game is not work: file deleted but not created.

Is it possible to force it to work rather than writing code like this or creating own config file, like KeyValues format? (I don't want to produce extra cfg files or extra code.)

Fyren 10-28-2018 11:18

Re: Force AutoExecConfig() to create cfg in late
 
You can't reasonably do this yourself without examining the config contents. Just deleting the file would lose any changes the user has made. Even if you find code written to do this for you (which I'm pretty sure someone has done, but I don't think it's popular), you'll have to at least give it your variable names, so it'd involve a code change.

shanapu 10-28-2018 11:48

Re: Force AutoExecConfig() to create cfg in late
 
https://forums.alliedmods.net/showthread.php?t=204254


All times are GMT -4. The time now is 14:41.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.