Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Technical Support » Win32 FDS » Custom Commands Plug-in
Custom Commands Plug-in [message #390549] Sat, 13 June 2009 19:22 Go to next message
arnyswart is currently offline  arnyswart
Messages: 25
Registered: October 2004
Karma: 0
Recruit
Hey guys I was wondering if I could get some help with configuration.

I have set up a server for some Community Wars. However I need to get it to switch across and back to a normal server on an IRC command.

This is how far I have gotten:

I have written two commands into the commands.xml file:

<command name="NSCommWar-on">
<renguard required="0" />
<permission level="6" />
<hideInHelp value="0" />
<group>ingame</group>
<group>irc</group>
<help value="restarts the server and BRenBot with the CommWar Settings" />
<syntax value="!NSCommWar-on" />
<enabled value="0" />
</command>
<command name="NSCommWar-off">
<renguard required="0" />
<permission level="6" />
<hideInHelp value="0" />
<group>ingame</group>
<group>irc</group>
<help value="restarts the server and BRenBot with the Normal Settings" />
<syntax value="!NSCommWar-off" />
<enabled value="0" />

I then have created two .bat files to run:
NSCommWar-on
cmd
copy D:\Services\Renegade\NSComm\Server\data\Backup_settings\svrcfg_cnc.ini D:\Services\Renegade\NSComm\Server\data\svrcfg_cnc.ini
copy D:\Services\Renegade\NSComm\Server\data\Backup_settings\mapsettings.xml D:\Services\Renegade\NSComm\Server\BRenBot\mapsettings.xml
copy D:\Services\Renegade\NSComm\Server\data\Backup_settings\ssgm.ini D:\Services\Renegade\NSComm\Server\ssgm.ini
exit

NSCommWar-off
cmd
copy D:\Services\Renegade\NSComm\Server\data\Backup_settings\svrcfg_cnc_original.ini D:\Services\Renegade\NSComm\Server\data\svrcfg_cnc.ini
copy D:\Services\Renegade\NSComm\Server\data\Backup_settings\mapsettings_original.xml D:\Services\Renegade\NSComm\Server\BRenBot\mapsettings.xml
copy D:\Services\Renegade\NSComm\Server\data\Backup_settings\ssgm_original.ini D:\Services\Renegade\NSComm\Server\ssgm.ini
exit

Now the idea is that it goes like this:
!NSCommWar-on
>>!msg The server will be restarting for the community war, we apologise for any inconvience
>>Run .Bat files
>>Restart Server
>>Restart BRenBot (!Die Now or rehash if this works too)

Can someone tell me how I get into the BRenBot to get it to do this for us?

[Updated on: Sat, 13 June 2009 19:23]

Report message to a moderator

Re: Custom Commands Plug-in [message #390590 is a reply to message #390549] Sun, 14 June 2009 07:03 Go to previous message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
In the command function in the plugin use;

1) Running batch file
system <patch_to_batch_file>;


Asks the OS to execute the given file




2) Restarting FDS
system tskill server.dat


To stop server.dat (WARNING: tskill is a Windows XP system call which will stop ANY process with the given name or ID. The syntax above will stop ALL processes named server.dat, so if you have more than one server running it will kill them all. It also requires BRenBot to have admin rights or it wont have permission to call tskill).

This assumes you are using autorestart on the server, which will mean RenegadeServer.exe will relaunch the server.dat process automatically after this is called.


See replacement step below for a better method to perform this step.




3) Restarting BRenBot
exec brenbot.exe


Stops the current copy of BRenBot and launches a new copy.




References
System (Perl Function)
tskill (Windows XP system call)
Exec (Perl Function)




Edit : Replacement method for 2) Restarting FDS

Thinking about it, you could replace the tskill step with a simple RenRemCMD call to instruct the FDS to restart itself and sidestep the admin rights / multi server problems. Don't know why I didn't think of it first time around. Anyway, instead of that second code snippet regarding tskill above use;

plugin::RenRemCMD("restart");


http://steamsignature.com/card/1/76561197975867233.png

[Updated on: Sun, 14 June 2009 07:10]

Report message to a moderator

Previous Topic: Changing the Host Name
Next Topic: Sponsor a server
Goto Forum:
  


Current Time: Sat Dec 21 00:05:03 MST 2024

Total time taken to generate the page: 0.00651 seconds