-
Posts
11 -
Joined
-
Last visited
-
Days Won
1
Content Type
Profiles
Forums
Events
Downloads
Everything posted by MarkMozza
-
Ha your the guy from my Steam Guide!!!!
-
-
Rust Server Branch Switcher (Single Button) - C# Script
MarkMozza replied to MarkMozza's topic in TCAdmin Scripts
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! -
Rust Server Wiper Allows your to wipe your rust server using a single button. You can also use this along with the Scheduler, you can choose to do a weekly map wipe with a monthly player wipe. Note: Code could be better but works fine. I will make it better in the future. 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; public class CSharpScript : CSharpScriptBase { public void Main() { Script.WriteToConsole("Rust Wiper Starting."); // All Player Info var serverIdentity = (string)ThisService.Variables["Identity"]; // Set Folder Paths var playerBP = Path.Combine(ThisService.RootDirectory, "server\\"+serverIdentity+"\\player.blueprints.3.db"); var playerDeaths = Path.Combine(ThisService.RootDirectory, "server\\"+serverIdentity+"\\player.deaths.3.db"); var playerIdentities = Path.Combine(ThisService.RootDirectory, "server\\"+serverIdentity+"\\player.identities.3.db"); var playerStates = Path.Combine(ThisService.RootDirectory, "server\\"+serverIdentity+"\\player.states.191.db"); var playerTokens = Path.Combine(ThisService.RootDirectory, "server\\"+serverIdentity+"\\player.tokens.db"); if((string)ThisService.Variables["deleteblueprints"]=="yes" & File.Exists(playerBP)) { Script.WriteToConsole("Deleting Blueprints..."); File.Delete(playerBP); } if((string)ThisService.Variables["deletedeaths"]=="yes" & File.Exists(playerDeaths)) { Script.WriteToConsole("Deleting Deaths..."); File.Delete(playerDeaths); } if((string)ThisService.Variables["deleteidentities"]=="yes" & File.Exists(playerIdentities)) { Script.WriteToConsole("Deleting Identities..."); File.Delete(playerIdentities); } if((string)ThisService.Variables["deletestates"]=="yes" & File.Exists(playerStates)) { Script.WriteToConsole("Deleting States..."); File.Delete(playerStates); } if((string)ThisService.Variables["deletetokens"]=="yes" & File.Exists(playerTokens)) { Script.WriteToConsole("Deleting Tokens..."); File.Delete(playerTokens); } // This will wipe map if((string)ThisService.Variables["deletemap"]=="yes") { Script.WriteToConsole("Deleting Map..."); var mapPath = Path.Combine(ThisService.RootDirectory, "server\\"+serverIdentity); var mapFiles = Directory.EnumerateFiles(mapPath, "*.map*", SearchOption.AllDirectories); foreach (var item in mapFiles) { File.Delete(item); } var savFiles = Directory.EnumerateFiles(mapPath, "*.sav*", SearchOption.AllDirectories); foreach (var item in savFiles) { File.Delete(item); } } Script.WriteToConsole("Rust Wiper Completed."); } } 3. Setup Thw Following Variables. Variable Names: deleteblueprints, deletedeaths, deleteidentities, deletestates, deletetokens, deletemap Script Parameter: True Admin Access: True Sub Admin: True Reseller: True User Access: True Server Owner: True Item Type: Checkbox On Value: yes Off Value: no 4. Save & Done! You're welcome
-
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
-
I prefere just to link directly to the latest download that way i can setup configuration files etc, i have message support to include an Updater feature, however in the latest update you have to provide a version number, this makes updating a pain, the update button should appear constantly and it just downloads the latest. This method is nice, it just lacks in UI side (being able to manage plugin produce configs in Configuration Files).
-
Yeah i completely understand, makes perfect sense. I guess because of the update period of most mods is daily, i wanted an easy way to link directly to the git, so each time the mod is installed its up to date. If you could write something very basic that can do it, i should be able to figure out the rest, i am a developer myself but never done this kind of scripting, feel like a bit of a novice here. I was thinking about writing a PHP download script that will clone and rezip and push the new zip to download. Mark
-
Yes i understand, this is fine for now i guess, but still would be 100x better if you could just provide the .git file and the system will clone it and update with a single button. Your expecting customers to be all experienced with code. Mark
-
Sorry if this has already been brought up, it should have. Is it already possible to use a git url ( example://github.com/???????/????????/archive/master.zip) but on extract it will include "-master" in the folder path. Would be cool if it was just a feature + its ez to update mods via git. I could literally store all my mods then on git so when i update git, its just a matter of pulling on tcadmin (id have a deploy script anyway automating the whole process) , which also could be a script. Mark