AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Reload amx.cfg in every round. (https://forums.alliedmods.net/showthread.php?t=182956)

jonnzus 04-15-2012 15:06

Reload amx.cfg in every round.
 
Can someone make me code what reloads amx.cfg in every round, or some other ini/txt/.cfg file?

I got this kinda of code what reloads when someone connects.
When is exec that file there is commands what server should do then.

Code:

public client_putinserver(id)
    server_cmd("exec cstrike\addons\amxmodx\configs\amx.cfg)

new g_msgChannel


Deidara 04-15-2012 15:14

Re: Reload amx.cfg in every round.
 
Why do you not set a task every x seconds with a public on server_cmd?

Code:

#include < amxmodx >

public plugin_init()
{
register_plugin("Reload","1.0","Deidara");
set_task(30.0, "reload", _, _, _,"b");
}

public reload()
{
 server_cmd("exec cstrike/addons/amxmodx/configs/amx.cfg");
}


jonnzus 04-15-2012 15:19

Re: Reload amx.cfg in every round.
 
Quote:

Originally Posted by Deidara (Post 1689847)
Why do you not set a task every x seconds with a public on server_cmd?

Code:

#include < amxmodx >

public plugin_init()
{
register_plugin("Reload","1.0","Deidara");
set_task(30.0, "reload", _, _, _,"b");
}

public reload()
{
 server_cmd("exec cstrikeaddonsamxmodxconfigsamx.cfg");
}


Thanks that OK too, to I have to put \ marks to cstike-addons-etc?

Deidara 04-15-2012 15:21

Re: Reload amx.cfg in every round.
 
My bad, yes, you need to put "\"
cstrike\addons\amxmodx\configs\amx.cfg

jonnzus 04-15-2012 15:30

Re: Reload amx.cfg in every round.
 
So this is right?


public reload()
{
server_cmd("exec cstrike\addons\amxmodx\configs\amx.cfg");
}


And when it loads that does server make those commands what are inside of amx.cfg?

Deidara 04-15-2012 15:35

Re: Reload amx.cfg in every round.
 
Must be "/" not "\", so, this is the correct form:

Code:

public reload()
{
server_cmd("exec cstrike/addons/amxmodx/configs/amx.cfg");
}

When command exec, any settings in amx.cfg will load in real time

kramesa 04-15-2012 16:18

Re: Reload amx.cfg in every round.
 
2 Attachment(s)
Untested:

fysiks 04-15-2012 16:42

Re: Reload amx.cfg in every round.
 
Quote:

Originally Posted by jonnzus (Post 1689857)
So this is right?


public reload()
{
server_cmd("exec cstrike\addons\amxmodx\configs\amx.cfg");
}


And when it loads that does server make those commands what are inside of amx.cfg?

Remove "cstrike\" it already assumes you are in the cstrike directory. Also, the default file is actually called "amxx.cfg".

Quote:

Originally Posted by kramesa (Post 1689873)
Untested:

Clearly. And, it's pointless to use a file for that. If you don't want it hardcoded, you could use a cvar. However, if the OP is able to compile the plugin him/herself then I would recommend hardcoding it.

jonnzus 04-15-2012 16:50

Re: Reload amx.cfg in every round.
 
Quote:

Originally Posted by fysiks (Post 1689895)
Remove "cstrike\" it already assumes you are in the cstrike directory. Also, the default file is actually called "amxx.cfg".



Clearly. And, it's pointless to use a file for that. If you don't want it hardcoded, you could use a cvar. However, if the OP is able to compile the plugin him/herself then I would recommend hardcoding it.

Ok thanks.

Btw does it need to be like this;


server_cmd("exec /addons/amxmodx/configs/amxx.cfg");
or this?
server_cmd("exec "/addons/amxmodx/configs/amxx.cfg");

fysiks 04-15-2012 16:54

Re: Reload amx.cfg in every round.
 
Quote:

Originally Posted by jonnzus (Post 1689899)
server_cmd("exec /addons/amxmodx/configs/amxx.cfg");
or this?
server_cmd("exec "/addons/amxmodx/configs/amxx.cfg");

The first one but without the first slash.


All times are GMT -4. The time now is 20:44.

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