Rotate server_cmd()
How do I keep rotating a server_cmd() for a certain amount for time?
I tried to do the following but failed the map changes when I tried to make it repeat : public START(id, level, cid) { server_cmd("exec ^"%s^"", COMMANDHERE); set_task(30,"REPEAT"); } public REPEAT(id, level, cid) { server_cmd("exec ^"%s^"", COMMANDTWOHERE); set_task(30, "START"); <-- The map will change here, how to slove it? } |
Re: Rotate server_cmd()
Show us your exact code, because what you have shown us doesn't cause the map to change
|
Re: Rotate server_cmd()
You might need to explain that better. Are you trying to just alternate the file that you execute? I.e. Execute file_one.cfg then execute file_two.cfg then execute file_one.cfg then execute file_two.cfg etc.
|
Re: Rotate server_cmd()
Inf. loop of execing config file, not recommanded
|
Re: Rotate server_cmd()
Quote:
Yes. But when its time to execute file one again, the server restarts. Can you show me how to do that? |
Re: Rotate server_cmd()
What is in the files? The code isn't causing the server to restart...
|
Re: Rotate server_cmd()
I actually don't know how to write, but fysiks was right ->Execute file_one.cfg then execute file_two.cfg then execute file_one.cfg then execute file_two.cfg etc.
public START(id, level, cid) { server_cmd("exec ^"%s^"", COMMANDHERE); set_task(30,"REPEAT"); } public REPEAT(id, level, cid) { server_cmd("exec ^"%s^"", COMMANDTWOHERE); set_task(30, "START"); <-- I WAS TRYING TO EXECUTE THE FIRST TAST AGAIN thats all I did. Can someone quickly show me some examples? Just repeating it. |
Re: Rotate server_cmd()
In your original post you said something about "failed the map changes" and nobody know what that means.
To do what I described I would do something like this: PHP Code:
|
Re: Rotate server_cmd()
#include <amxmodx>
#include <amxmisc> #define PLUGIN "exec cfg" #define VERSION "1.0" #define AUTHOR "chungsy" #define LOADING "^n^t%s v%s, Copyright (C) 2013 by %s^n" new g_iCounter = 0 new g_szCfgs[][] = { "cfg_one.cfg", "cfg_two.cfg" } public plugin_init() { register_plugin("PLUGIN", "VERSION", "AUTHOR"); server_print("LOADING", "PLUGIN", "VERSION", "AUTHOR"); set_task(30.0, "myTask", .repeat=1) } public myTask() { server_cmd("exec %s", g_szCfgs[g_iCounter % sizeof(g_szCfgs)]) g_iCounter++ } The code doesn't work for some reason. If the one above works, thats good, but what if I want to exec the first cfg for 30s and the 2nd one for 10s? Can you make it more flexible? |
Re: Rotate server_cmd()
Quote:
I know right, but Pretty sure thats what happened, which is weird. You will be amaze when you find out how many "Mapchange to de_dust2" are there in the log file. -------- Mapchange to de_dust2 -------- -------- Mapchange to de_dust2 -------- -------- Mapchange to de_dust2 -------- -------- Mapchange to de_dust2 -------- -------- Mapchange to de_dust2 -------- -------- Mapchange to de_dust2 -------- -------- Mapchange to de_dust2 -------- -------- Mapchange to de_dust2 -------- -------- Mapchange to de_dust2 -------- -------- Mapchange to de_dust2 -------- -------- Mapchange to de_dust2 -------- -------- Mapchange to de_dust2 -------- -------- Mapchange to de_dust2 -------- -------- Mapchange to de_dust2 -------- ....... |
| All times are GMT -4. The time now is 23:55. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.