Jump to content

Rust Server Branch Switcher (Single Button) - C# Script


MarkMozza

Recommended Posts

Rust Server Branch Switcher

This script allows you to switch between branches using a single button.

Support: https://discord.gg/RmMmh7K

Installation

1. Create a new Custom Script.

  • Script Engine: C#
  • Event: Custom Icon
  • Allow Scheduling: True
  • Prompt for Variable Values: True
  • Stop Service Before Executing: True
  • Fill in remaining details

2. Copy the below code into the text area.

using System;
using System.IO;
using TCAdmin;
using System.Diagnostics;

public class CSharpScript : CSharpScriptBase
{

  public void Main() {
    Script.WriteToConsole("Updating Rust...");
    Process process = new Process();
    process.StartInfo.FileName = @TCAdminFolder+"\\Monitor\\Tools\\SteamCmd\\steamcmd.exe";
    process.StartInfo.Arguments = "+login anonymous +app_info_update 1 +force_install_dir "+ThisService.RootDirectory+" +app_update 258550 "+ThisService.Variables["steambranch"]+" validate +quit";
    process.StartInfo.UseShellExecute = false;
    process.StartInfo.RedirectStandardOutput = true;
    process.StartInfo.RedirectStandardError = true;
    process.OutputDataReceived += (s, e) => Script.WriteToConsole(e.Data);
    process.ErrorDataReceived += (s, e) => Script.WriteToConsole(e.Data);
    process.Start();
    process.BeginOutputReadLine();
    process.BeginErrorReadLine();
    process.WaitForExit();
  }

}

 

3. Setup a New Variable.

  • Variable Name: steambranch
  • Item Type: Combobox
  • Source Custom List
  • Configure Items. Add the followering options... (valid from post date)

First Item

  • Value: LEAVE BLANK
  • Display Text: Release Branch

Second Item

  • Value: -beta beta
  • Display Text: Staging Branch

Third Item

  • Value: -beta aux01
  • Displau Text: AUX Branch

4. Save & Done!

 

You're welcome

 

Edited by MarkMozza
Link to comment
Share on other sites

Ill share all my scripts. Customers ask ill build and share here. I believe sharing code is the way to go with TCAdmin. Its not like a huge script thats doing something amazing. I feel like these features should be built in.

PS. Just want to point out this adopted to be used on any Steam Game!

Edited by MarkMozza
PS
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use