Advertisement
kisslo

rcon.bat

Sep 30th, 2015
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 4.13 KB | None | 0 0
  1. @echo off
  2. rem ------ Syntax ------
  3. rem clircon -P"rcon_password" -a127.0.0.1 -p27015 command
  4. rem ------ Notes ------
  5. rem !!!%* is a 'placeholder for every batch argument' It should not be removed. !!!!!
  6. rem !!!leave the quotes arround the rconpassword!!!
  7. rem ------ Usage ------
  8. rem edit the command line options and drag the batch file into the "run..." box which
  9. rem can be found in the windows startmenu.
  10. rem use qry_rcon.bat status to get the the status of your srcds server
  11.  
  12. rem Vars
  13. set host=
  14. set port=
  15. set password=
  16. set map1=
  17. set map2=
  18.  
  19. rem Check vars
  20. if [%host%]==[] goto :undefined
  21. if [%port%]==[] goto :undefined
  22. if [%password%]==[] goto :undefined
  23. if [%map1%]==[] goto :undefined
  24. if [%map2%]==[] goto :undefined
  25.  
  26. rem Host availability
  27. ping -n 1 %host% >nul
  28. if ERRORLEVEL 1 goto :unreachable
  29.  
  30. rem Cases
  31. if [%1]==[] goto :usage
  32. if [%1]==[players] if [%2]==[] goto :players
  33. if [%1]==[map] if [%2]==[] goto :map
  34. if [%1]==[uptime] if [%2]==[] goto :uptime
  35. if [%1]==[nicks] if [%2]==[] goto :nicks
  36. if [%1]==[info] if [%2]==[] goto :info
  37. if [%1]==[pvp] if [%2]==[] goto :pvp
  38. if [%1]==[custom] if [%2]==[] goto :custom
  39. goto :command
  40.  
  41. :players
  42. rem clircon.exe -P"%password%" -a%host% -p%port% status | find "%input%"
  43. for /f "tokens=1*delims=:" %%G in (' %0 stats^|findstr /n "^" ') do if %%G equ 2 for /f "tokens=7" %%a in ("%%H") do echo %%a
  44. goto :eof
  45.  
  46. :uptime
  47. for /f "tokens=1*delims=:" %%G in (' %0 stats^|findstr /n "^" ') do if %%G equ 2 for /f "tokens=4" %%a in ("%%H") do echo %%a
  48. goto :eof
  49.  
  50. :map
  51. rem clircon.exe -P"%password%" -a%host% -p%port% status | find "%input%"
  52. for /f "tokens=3" %%a in ('%0 status^| find "map"') do echo %%a
  53. goto :eof
  54.  
  55. :nicks
  56. rem for /f "tokens=4" %%a in ('rcon status^| find "#"') Do echo %%a
  57. for /f "tokens=4,*" %%G in (' %0 status^| find "STEAM" ') do echo %%G %%H
  58. goto :eof
  59.  
  60. :info
  61. rem call :map
  62. rem call :players
  63. rem call :uptime
  64. for /f "tokens=3" %%a in ('%0 status^| find "map"') do echo Map: %%a
  65. for /f "tokens=1*delims=:" %%G in (' %0 stats^|findstr /n "^" ') do if %%G equ 2 for /f "tokens=7" %%a in ("%%H") do echo Players: %%a
  66. for /f "tokens=1*delims=:" %%G in (' %0 stats^|findstr /n "^" ') do if %%G equ 2 for /f "tokens=4" %%a in ("%%H") do echo Uptime: %%a
  67. goto :eof
  68.  
  69. :command
  70. clircon.exe -P"%password%" -a%host% -p%port% %*
  71. goto :eof
  72.  
  73. :usage
  74. echo Usage: %0 [option]
  75. echo                   map - current map
  76. echo                      players - current players
  77. echo                   uptime - server uptime
  78. echo                   nicks - players nick
  79. echo                   info - map, players, uptime
  80. echo                   pvp - change map to %map1%, change playlist to pvp, connect to server
  81. echo                   custom - change map to %map2%, change playlist to custom
  82. echo                   [command] - rcon commands
  83. goto :eof
  84.  
  85. :unreachable
  86. echo %host% is unreachable
  87. goto :eof
  88.  
  89. :undefined
  90. echo Check your vars !!! (host, port, password, map1, map2)
  91. goto :eof
  92.  
  93. :pvp
  94. set players=
  95. rem call :players
  96. for /f "tokens=1*delims=:" %%G in (' %0 stats^|findstr /n "^" ') do if %%G equ 2 for /f "tokens=7" %%a in ("%%H") do set players=%%a
  97.  
  98. if  %players%==0 (
  99. echo Changing map to %map1%.....
  100. call %0 map %map1% push
  101. timeout /t 30
  102.  
  103. echo Changing playlist to pvp.....
  104. call %0 exec server_pvp.cfg
  105. timeout /t 5
  106.  
  107. echo Connecting to server.....
  108. cd "C:\Program Files (x86)\Steam\steamapps\common\insurgency2\"
  109. start /low insurgency.exe -textmode -novid -nosound -nopreload +clientport 27015 +connect %host%:27115
  110. timeout /t 10
  111.  
  112. echo Map changed to %map1% - Playlist changed to pvp - Connected to server !!!
  113. timeout /t 10
  114. ) else (
  115. echo Server is not empty !!!
  116. )
  117. goto :eof
  118.  
  119. :custom
  120. set players=
  121. rem call :players
  122. for /f "tokens=1*delims=:" %%G in (' %0 stats^|findstr /n "^" ') do if %%G equ 2 for /f "tokens=7" %%a in ("%%H") do set players=%%a
  123.  
  124. if  %players%==32 (
  125. echo Nextlevel changing to %map2%.....
  126. call %0 nextlevel %map2%
  127. timeout /t 10
  128.  
  129. echo Changing playlist to custom.....
  130. call %0 exec server_custom.cfg
  131. timeout /t 10
  132.  
  133. echo Map changed to %map2%  - Playlist changed to custom !!!
  134. timeout /t 10
  135. ) else (
  136. echo Server is not full !!!
  137. )
  138. goto :eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement