Thanks for all your answers!
Quote:
Originally Posted by Dr!fter
... Forwards are the best id say, and you can also force all submodules to update at any time by calling a forward (not sure if this is important).
|
Even though this is not an important feature for this plugin, for me this is the decisive argument for Forwards in general.
Quote:
Originally Posted by Dr!fter
... You can also avoid calling FindConVar by using a forward when the cvar is created and forwarding the handle to all the submodules.
|
And that's fantastic! I didn't even think of passing the handle instead of the values. In this way, the submodules, can even change the master convars, like FindConvar if required.
Thank you very much!
For me, this topic is solved, but I'm still open to hearing new arguments!
edit: here a test snippet of passing convars handles:
Quote:
Master:
PHP Code:
public void OnPluginStart()
{
gc_sName = CreateConVar("plugin_name", "Name", "");
gc_fTime = CreateConVar("plugin_time", "10.0", "");
}
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
g_hSendConfig = CreateGlobalForward("MyPlugin_Config", ET_Ignore, Param_Cell, Param_Cell);
}
public void OnConfigsExecuted()
{
Call_StartForward(g_hSendConfig);
Call_PushCell(gc_sName);
Call_PushCell(gc_fTime);
Call_Finish();
}
Module
PHP Code:
ConVar gc_sName;
ConVar gc_fTime;
public void MyPlugin_Config(ConVar name, ConVar time)
{
gc_sName = name;
gc_fTime = time;
}
|
__________________