Stop server from restarting map when second player joins?

tuia
Posts: 129
Joined: Tue Sep 06, 2011 12:36 pm
Location: Lisbon, Portugal

Re: Stop server from restarting map when second player joins

Post by tuia »

It's not documented here in the public forum, freddy asked me to patch the server executable, so that some commands, like game.killPlayer could be run.
You need to go to 0x00558268 address or 0x00158268 offset and change the byte value 75 to EB and save the file. After that, typing those commands from the server console won't prompt the "Unauthorized method" error message and they will be executed.
User avatar
jrivett
Posts: 17
Joined: Sat Nov 26, 2011 8:03 pm
Location: Vancouver, Canada
Contact:

Re: Stop server from restarting map when second player joins

Post by jrivett »

Ok, thanks!
freddy
Posts: 1267
Joined: Sun Oct 18, 2009 4:58 pm

Re: Stop server from restarting map when second player joins

Post by freddy »

i ran the command from file with the unpatched exe so it doesnt seems totally locked out, there seems to be some different access levels but there is not much documention to find about it. i guess reading from file is the highest "normal" access you can get.

http://bfmods.com/mdt/scripting/Console ... ccess.html

Code: Select all

c_totalAccess
 c_fullAccess
 c_endUserAccess
 c_noAccess
***************************************************************************************************************************************************************************************

what do you guys think about this, its supposed to be for bf42, i found it when i was googling around and i wonder if it have any substance to it, i dont have enough programming skills to determine if its meant just for bots or if it could be used to other things like perhaps a random event generator.
For the more advanced people i might to point out the undocumented <aiScript> class which is able to create scripts on the fly with nested expressions, even with subroutines.

aiScript.createScript 1 // start a new with id=1
aiScript.createScriptCommand ...
aiScript.createScriptVariable ...
aiScript.createScriptFlow ...
<complex statements, subroutines, expressions>
aiScript.endScript
aiScript.close
aiScript.runScript 1 // execute me
tuia
Posts: 129
Joined: Tue Sep 06, 2011 12:36 pm
Location: Lisbon, Portugal

Re: Stop server from restarting map when second player joins

Post by tuia »

freddy, is right. You can add game.setMinNrOfPlayers 0 to your init.con inside your map .rfa file. It's cleaner and easier than patching the server executable. You'll have to add that command to all your map files, though.
User avatar
jrivett
Posts: 17
Joined: Sat Nov 26, 2011 8:03 pm
Location: Vancouver, Canada
Contact:

Re: Stop server from restarting map when second player joins

Post by jrivett »

tuia wrote:freddy, is right. You can add game.setMinNrOfPlayers 0 to your init.con inside your map .rfa file. It's cleaner and easier than patching the server executable. You'll have to add that command to all your map files, though.
Cleaner, perhaps, but not easier - at least not for me. Presumably it's a server-side mod? Anyway, I'll keep it in mind. I would have tried that approach earlier but I couldn't get freddy to tell me where the setting was supposed to go. Meanwhile, the EXE patch seems to be working fine. Thanks!
User avatar
jrivett
Posts: 17
Joined: Sat Nov 26, 2011 8:03 pm
Location: Vancouver, Canada
Contact:

Re: Stop server from restarting map when second player joins

Post by jrivett »

Tuia: I hate to be a bother, but is there any chance you could find the code to change in the Linux server? I recently switched to Linux hardware (finally), and people are already complaining that the second player to join restarts the current map. Alternatively, if there's a particular hex string or set of instructions I should look for, I should be able to figure out which byte to change based on what you've already said.

I'm running the version 1.61 dynamic Linux server with the patches you already provided to prevent hacks.

(crossing my fingers)
Thanks in advance!
Jeff
tuia
Posts: 129
Joined: Tue Sep 06, 2011 12:36 pm
Location: Lisbon, Portugal

Re: Stop server from restarting map when second player joins

Post by tuia »

Hi!

I did a quick check at BF1942 Linux server code and could not find it. I can't remember now how I found that function in BF1942 Windows server. This weekend I'll try to look further.
You can use "game.setMinNrOfPlayers 0" command in each of your map files as a temporary workaround.
User avatar
Senshi
Posts: 697
Joined: Sun Oct 18, 2009 1:14 pm
Location: Germany
Contact:

Re: Stop server from restarting map when second player joins

Post by Senshi »

You can also add this line:
"game.setMinNrOfPlayers 0" to a basic common file that gets called for every map. Like the soldier.inc. That goes for every SSM modding/setting you want to apply for ALL maps.
User avatar
jrivett
Posts: 17
Joined: Sat Nov 26, 2011 8:03 pm
Location: Vancouver, Canada
Contact:

Re: Stop server from restarting map when second player joins

Post by jrivett »

Senshi wrote:You can also add this line:
"game.setMinNrOfPlayers 0" to a basic common file that gets called for every map. Like the soldier.inc. That goes for every SSM modding/setting you want to apply for ALL maps.
Thanks for the additional info. I looked for soldier.inc and wasn't able to find it. Were you referring to the files in "bf1942/game/common"? They are "AmericanNames.con", etc. If so, presumably I would have to add the setting to all five of those files.

Would the server executable need to be patched to allow this? I'm referring to the patch tuia found for freddy that eliminates restrictions on otherwise restricted commands like "game.killPlayer" (see above).
User avatar
Senshi
Posts: 697
Joined: Sun Oct 18, 2009 1:14 pm
Location: Germany
Contact:

Re: Stop server from restarting map when second player joins

Post by Senshi »

No need to edit the .exe .

Sorry, I gave you the wrong filename. Look for "objects\Soldiers\common\CommonSoldierData.inc" . That's a file that is called whenever a soldier is required (be it bot or player), so it allows to easily "hook" in commands that you want to apply universally.
Post Reply