Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** @param {NS} ns **/
- export async function main(ns) {
- //Args - target, timeToFinish, executionTime, actionID
- var server = ns.args[0];
- var timeToFinish = ns.args[1];
- let doWait = true;
- while (doWait){
- if (performance.now() + ns.getHackTime(server) >= timeToFinish) break;
- await ns.sleep(1);
- }
- //if (performance.now() + ns.getHackTime(server) >= timeToFinish + 50) {
- //ns.tprint("Hack is going to be late! Terminating instead.");
- //return;
- //}
- await ns.hack(server);
- if(performance.now + 50 > timeToFinish) ns.tprint("Hack Finished late!! " + performance.now());
- }
Advertisement
Add Comment
Please, Sign In to add comment