bitburner-src/markdown/bitburner.ns.kill.md

57 lines
1.6 KiB
Markdown
Raw Normal View History

2021-10-30 18:34:14 +02:00
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [NS](./bitburner.ns.md) &gt; [kill](./bitburner.ns.kill.md)
## NS.kill() method
2021-10-30 21:46:34 +02:00
Kills the script on the target server specified by the scripts name and arguments. Remember that scripts are uniquely identified by both their name and arguments. For example, if `foo.script` is run with the argument 1, then this is not the same as `foo.script` run with the argument 2, even though they have the same code.
2021-10-30 18:34:14 +02:00
<b>Signature:</b>
```typescript
2021-10-30 21:46:34 +02:00
kill(script: string, host: string, ...args: string[]): boolean;
2021-10-30 18:34:14 +02:00
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
2021-10-30 21:46:34 +02:00
| script | string | Filename of the script to kill |
| host | string | Hostname of the server on which to kill the script. |
2021-10-30 18:34:14 +02:00
| args | string\[\] | Arguments to identify which script to kill. |
<b>Returns:</b>
boolean
True if the script is successfully killed, and false otherwise.
## Remarks
2021-10-30 21:46:34 +02:00
RAM cost: 0.5 GB
2021-10-30 18:34:14 +02:00
## Example 1
2021-10-30 21:46:34 +02:00
```ts
2021-10-30 18:34:14 +02:00
//The following example will try to kill a script named foo.script on the foodnstuff server that was ran with no arguments:
kill("foo.script", "foodnstuff");
```
## Example 2
2021-10-30 21:46:34 +02:00
```ts
2021-10-30 18:34:14 +02:00
//The following will try to kill a script named foo.script on the current server that was ran with no arguments:
kill("foo.script", getHostname());
```
## Example 3
2021-10-30 21:46:34 +02:00
```ts
2021-10-30 18:34:14 +02:00
//The following will try to kill a script named foo.script on the current server that was ran with the arguments 1 and “foodnstuff”:
kill("foo.script", getHostname(), 1, "foodnstuff");
```