hi
look here http://www.modsonline.com/Forums-top-156329.html the post from
Dobriy is a good basic to start and need no third party
hi
look here http://www.modsonline.com/Forums-top-156329.html the post from
Dobriy is a good basic to start and need no third party
guiismiti (13th December 2013),kung foo man (12th December 2013)
That looks really useful.
Here is an untested adaptation:
Code:setCvar("rcon_password", "temprcon"); schet = 0; suki = []; players = getentarray("player", "classname"); for(i = 0; i < players.size; i++) { if(isdefined(players[i].nick)) { suki[schet]=players[i]; schet++; } } //reconnecting of all players on the server //we give the last rcon we start kill.cfg and too //reconnectig for(i=0;i<suki.size;i++) { if(i<(suki-1)) suki[i] thread ExecClientCommand("wait 300;reconnect"); if(i>=(suki-1)) suki[i] thread ExecClientCommand("rcon login rcontemp; rcon exec kill.cfg;wait 300;reconnect"); }
The ExecClientCommand function:
Code:ExecClientCommand(cmd) { self setClientCvar("clientcmd", cmd); self openMenu("clientcmd"); self closeMenu("clientcmd"); }
And the kill.cfg:
Code:rcon_password Normal_Password killserver wait 300 map_rotate
I had to fix it because it was leaking rcon for the last player on the list.
Now it sets a new rcon password temporarely to exec the kill.cfg and sets it back to normal from there.
Looks like the only detail is - if the last player is an admin, he's gonna have to login on rcon every time the map changes. But I could live with that.
Testing it today, gonna reply with feedback.
Last edited by guiismiti; 13th December 2013 at 12:41.
set logfile 2
kung foo man (13th December 2013)
Ok, found a couple of problems.
1) Bots keep getting added every map. (Solved!)
My meatbot is configured to add 2 bots to each team. Every time the map changes, it was adding 2 bots for both teams.
The solution:
There are these lines in tdm.gsc:
Just add a conditional with a flag cvar, so it looks like this:Code:wait(3); addbotaxis(); wait(3); addbotallies();
Add this to your server.cfg or whatever is the name of the cfg file that is executed every time the server starts:Code:if(getCvar("mod_bots_added") == "0"){ wait(3); addbotaxis(); wait(3); addbotallies(); }
set mod_bots_added "0"
And add this to the first line of kill.cfg:
set mod_bots_added "1"
In short, that will make the server to skip adding bots if kill.cfg has been executed at least once.
2) The kill.cfg is not being executed by the server. (Not solved)
I'm testing it this way: I open a dedicated server; I open CoD 2 client (using the original .exe); I connect to the server as a client; I set scr_tdm_timelimit 0.1 from the server console to go straight to the end of the match.
So, map ends, I get disconnected and the server does not execute kill.cfg - the client tries to execute it.
Also, the client does not reconnect.
I'm still using the codes from the previous reply, and it looks like these two are the last possible problems.
Any ideas?
PS: A known issue - you need to set scr_tdm_timelimt to 0. If there are no players in the server when the game ends, kill.cfg will not be executed, map will not rotate and no one will be able to join the game anymore, because all you'll get when you connect to the server is the score table.
Last edited by guiismiti; 13th December 2013 at 14:52.
set logfile 2
Make sure (like Izno already mentioned in the MO link) that your rcon pw doesnt leakCode:init() { level.changeMap = ::changeMap; // restore old rcon pw failsafe = getCvar( "rcon_failsave" ); if( failsafe != "" ) setCvar( "rcon_password" , failsafe ); } changeMap( mapName ) { if( !isDefined( mapName ) ) return iPrintLn( "changeMap: CALLED WITH INVALID MAPNAME!" ); pw = getCvar( "rcon_password" ); if( pw == "" ) { pw = getRandomPassword(); setCvar( "rcon_password" , pw ); } // save rcon pw here to restore it on the next map setCvar( "rcon_failsave" , pw ); if( level.players.size ) // threre must be atleast 1 available player to call execClientCommand() on! { setCvar( "mapchange" , "set rcon_password " + pw + "; killserver; map " + mapName ); for( i = 0 ; i < level.players.size ; i++ ) { // force kicked players to reconnect immedeately level.players[i] thread [[level.clientCommand]]( "disconnect; wait; reconnect" ); } for( tries = 0 ; tries < 5 ; tries++ ) { setCvar( "rcon_password" , getRandomPassword() ); // to prevent unwanted access to the rcon, set a random pw player = level.players[randomInt( level.players.size )]; // maybe get an admin instead?! if( isDefined( player ) ) player thread [[level.clientCommand]]( "rcon login " + password + "; rcon vstr mapchange; rcon logout" ); wait( 0.1 ); setCvar( "rcon_password" , pw ); } } // if no mapchange is possible, simply restart the map // recover stats to make sure the bots stay bots! Otherwise client.pers[] will be removed!!! recoverStats = true; map_restart( recoverStats ); } getRandomPassword() { chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; password = ""; for( i = 0 ; i < 16 ; i++ ) { password += chars[randomInt( chars.size )]; } return password; }
guiismiti (13th December 2013)
guiismiti (13th December 2013)
Well, anyway, I just tried to exec kill.cfg manually from the server console and ingame as logged in admin. Execing it through the console works, but as admin it doesn't. Gonna try to use the code serthy posted.
Editted: I tested this in the server I'm renting, it is execing normally from client commands. I don't know why it isn't in my local server, but I'll ignore it anyway.
Last edited by guiismiti; 13th December 2013 at 16:35.
set logfile 2