forked from VANCOLD/fm_drive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FM_CONFIG.sma
60 lines (51 loc) · 2.61 KB
/
FM_CONFIG.sma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include "feckinmad/fm_global"
#include "feckinmad/fm_config"
stock const g_sConfigFile[] = "fm.cfg"
stock const g_sConfigForward[] = "fm_InitConfigExec"
public plugin_init()
{
fm_RegisterPlugin()
}
// -------------------------------------------------------------------------------------------------------------
// Ensure the plugins that depend on fm_InitConfigExec fail if it isn't running. (reqlib in fm_config.inc)
// -------------------------------------------------------------------------------------------------------------
public plugin_natives()
{
register_library(g_sConfigModule)
}
// -------------------------------------------------------------------------------------------------------------
// Execute fm.cfg and <mapname>.cfg on the server. plugin_cfg() is called after all plugins have run plugin_init()
// -------------------------------------------------------------------------------------------------------------
public plugin_cfg()
{
new sConfigDir[128]; get_localinfo("amxx_configsdir", sConfigDir, charsmax(sConfigDir))
new sCurrentMap[MAX_MAP_LEN]; get_mapname(sCurrentMap, charsmax(sCurrentMap))
// -------------------------------------------------------------------------------------------------------------
// Run the fm.cfg and the map specific config. Force it to do this NOW with server_exec()
// -------------------------------------------------------------------------------------------------------------
server_cmd("exec \"%s/%s\"", sConfigDir, g_sConfigFile)
server_cmd("exec \"%s/maps/cfgs/%s.cfg\"", sConfigDir, sCurrentMap)
server_exec()
// -------------------------------------------------------------------------------------------------------------
// Let other plugins know that the config has been run so they can work based on updated cvars
// -------------------------------------------------------------------------------------------------------------
new iReturn, iForward = CreateMultiForward(g_sConfigForward, ET_IGNORE)
ExecuteForward(iForward, iReturn)
DestroyForward(iForward)
return PLUGIN_CONTINUE
}
// -------------------------------------------------------------------------------------------------------------
// Execute fm.cfg on the player shortly after they connect for any fm specific binds / cvars they want
// 19/03/20 - Commented out. It's no longer possible to exec on clients.
// -------------------------------------------------------------------------------------------------------------
/*public client_putinserver(id)
{
set_task(1.0, "ExecPlayerConfig", id)
}
public ExecPlayerConfig(id)
{
if (is_user_connected(id))
{
client_cmd(id, "exec \"%s\"", g_sConfigFile)
}
}*/