Page 2 of 7 FirstFirst 1234 ... LastLast
Results 11 to 20 of 65

Thread: Changing map on MeatBot (CoD 2)

  1. #11
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    No, you still need the part kung posted:
    Code:
    execClientCommand(cmd)
    {
        player = self;
        player setClientCvar("clientcmd", cmd);
        player openMenu("clientcmd");
        player closeMenu("clientcmd");
    }
    quitPlayerReconnect()
    {
        players = getEntArray("player", "classname");
        for (i=0; i<players.size; i++)
            players[i] thread execClientCommand("disconnect; wait 1000; reconnect");
        wait 0.50; // make sure the commands arrive
        closer(1204, "killserver; map mp_toujane");
    }
    but dont need any .sh tweaks and/or b3
    You will need a .menu file to exec it though...

  2. #12
    Corporal guiismiti's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    244
    Thanks
    121
    Thanked 42 Times in 31 Posts
    I've been looking, without success, for tutorials on how to install libcod. Are there any?
    set logfile 2

  3. #13
    Private
    Join Date
    Jun 2013
    Posts
    70
    Thanks
    20
    Thanked 32 Times in 26 Posts
    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

  4. The Following 2 Users Say Thank You to vanfreddy For This Useful Post:

    guiismiti (13th December 2013),kung foo man (12th December 2013)

  5. #14
    Corporal guiismiti's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    244
    Thanks
    121
    Thanked 42 Times in 31 Posts
    Quote Originally Posted by vanfreddy View Post
    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

    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 13:41.
    set logfile 2

  6. The Following User Says Thank You to guiismiti For This Useful Post:

    kung foo man (13th December 2013)

  7. #15
    Corporal guiismiti's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    244
    Thanks
    121
    Thanked 42 Times in 31 Posts
    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:
    Code:
            wait(3);
            addbotaxis();
            wait(3);
            addbotallies();
    Just add a conditional with a flag cvar, so it looks like this:
    Code:
    	if(getCvar("mod_bots_added") == "0"){
                 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:

    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 15:52.
    set logfile 2

  8. #16
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    Code:
    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;
    }
    Make sure (like Izno already mentioned in the MO link) that your rcon pw doesnt leak

  9. The Following User Says Thank You to serthy For This Useful Post:

    guiismiti (13th December 2013)

  10. #17
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Quote Originally Posted by guiismiti View Post
    That looks really useful.

    Here is an untested adaptation:

    Code:
    setCvar("rcon_password", "temprcon");
    suki[i] thread ExecClientCommand("rcon login rcontemp; rcon exec kill.cfg;wait 300;reconnect");
    I can spot the error. Can you?

  11. The Following User Says Thank You to IzNoGoD For This Useful Post:

    guiismiti (13th December 2013)

  12. #18
    Corporal guiismiti's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    244
    Thanks
    121
    Thanked 42 Times in 31 Posts
    Quote Originally Posted by IzNoGoD View Post
    I can spot the error. Can you?
    Spotted it like 1 second after looking at it lol!
    set logfile 2

  13. #19
    Corporal guiismiti's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    244
    Thanks
    121
    Thanked 42 Times in 31 Posts
    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 17:35.
    set logfile 2

  14. #20
    Corporal guiismiti's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    244
    Thanks
    121
    Thanked 42 Times in 31 Posts
    Has anybody tested Meatbot on Linux?
    set logfile 2

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •