DOCUMENTATION: Fix incorrect cloud API example (#2738)

This commit is contained in:
catloversg
2026-05-07 04:30:48 +07:00
committed by GitHub
parent 15a67d0156
commit a7b34b110c
2 changed files with 2 additions and 2 deletions
@@ -377,7 +377,7 @@ Paste the following code into the [Script](../basic/scripts.md) editor:
// amount of servers
while (i < ns.cloud.getServerLimit()) {
// Check if we have enough money to purchase access to a server
if (ns.getServerMoneyAvailable("home") > ns.cloud.getRamLimit(ram)) {
if (ns.getServerMoneyAvailable("home") > ns.cloud.getServerCost(ram)) {
// If we have enough money, then:
// 1. Purchase the server
// 2. Copy our hacking script onto the newly purchased cloud server
@@ -37,7 +37,7 @@ Common infinite loop when translating the server purchasing script in starting g
let i = ns.cloud.getServerNames().length;
while (i < ns.cloud.getServerLimit()) {
if (ns.getServerMoneyAvailable("home") > ns.cloud.getRamLimit(ram)) {
if (ns.getServerMoneyAvailable("home") > ns.cloud.getServerCost(ram)) {
const hostname = ns.cloud.purchaseServer("cloud-server-" + i, ram);
ns.scp("early-hack-template.js", hostname);
ns.exec("early-hack-template.js", hostname, 3);