Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This Script check if you can afford a better personal server and automatically deletes
- //and buys the better one.
- //While also resuming any scripts that were running on that pserver previously.
- var ramValues = []
- //Here all the ramValues get added to the array.
- for (var i = 0; i < 20; i++){
- var ram = 20 - i;
- ramValues.push(2 ** ram);
- }
- //This checks if you can afford a better one.
- for (var u = 0; u < getPurchasedServers().length; u++){
- var hostname = getPurchasedServers()[u];
- for (var d = 0; d < ramValues.length; d++){
- if (getServerMoneyAvailable('home') > getPurchasedServerCost(ramValues[d]) && ramValues[d] > getServerMaxRam(getPurchasedServers()[u])){
- var ram = ramValues[d]
- //This checks which script should be restarted
- var scripts = ps(hostname);
- killall(hostname);
- deleteServer(hostname)
- purchaseServer(hostname, ram);
- //This runs the scripts.
- for (var f = 0; f < scripts.length; f++){
- var script = scripts[f];
- scp(script.filename, hostname);
- exec(script.filename, hostname, script.threads, ...script.args);
- }
- break
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement