Skip to content
This repository was archived by the owner on Jan 15, 2024. It is now read-only.

Commit 06f29f6

Browse files
committed
v2.0.0
1 parent b2fa728 commit 06f29f6

33 files changed

+116
-9450
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.vscode
22
node_modules
3-
test
43

54
plugin/builds
65
plugin/build.ps1

.npmignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
docs
33
node_modules
44
plugin
5-
test
65

76
CNAME
8-
jsdoc.json
7+
jsdoc.json
8+
jsdoc.mod.css

README.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,28 @@
88

99
A JavaScript wrapper over SourceMod.
1010

11-
[SourceMod](https://www.sourcemod.net/) is a modification to Source servers, such as Team Fortress 2 and Counter-Strike: Global Offensive. SourceMod allows you to write plugins that modify the game in all sorts of ways, while SourceMod.JS lets you write plugins or custom server logic in JavaScript (instead of SourcePawn, the complicated language SourceMod uses), then interface with a SourceMod server via WebSockets.
11+
[SourceMod](https://www.sourcemod.net/) by itself is a modification to Source servers, such as Team Fortress 2 and Counter-Strike: Global Offensive. It allows you to write plugins that modify the game in all sorts of ways, from new gamemodes, to simple administration plugins. SourceMod.JS is a wrapper over SourceMod that lets you write plugins or custom server logic in JavaScript.
12+
13+
The JavaScript side (where you write your code) interfaces with an actual SourceMod server (where you install the plugin), via [WebSockets](https://en.wikipedia.org/wiki/WebSocket). This effectively allows you to wirelessly control a server over the internet, but it is heavily recommended to host the SourceMod.JS plugin on the same machine (or network) as the actual SourceMod server, to reduce latency.
1214

1315
```
1416
npm install sourcemod.js
1517
```
1618

1719
```js
18-
import { Server } from "sourcemod.js"
20+
import { Server } from "../index.js"
1921

20-
const server = await new Server("ws://localhost:12345")
22+
const server = new Server("ws://localhost:12345", { auth: "admin" })
2123
server.connect()
2224

2325
server.on("ready", async () => {
2426
console.log("Connected!")
25-
server.players.on("connect", (player) => {
26-
console.log(`${player.name} connected!`)
27+
28+
server.players.on("connect", (id, name) => {
29+
console.log(`${name} connected!`)
2730
})
28-
server.players.on("disconnect", (player) => {
29-
console.log(`${player.name} disconnected!`)
31+
server.players.on("disconnect", (id, name) => {
32+
console.log(`${name} disconnected!`)
3033
})
3134
})
3235

@@ -46,6 +49,8 @@ Currently, the only supported and tested game server is Team Fortress 2. If you'
4649

4750
Other than that, feel free to contribute! Bugfixes, new features, or just better code in general are all greatly appreciated!
4851

52+
If you need help at any point, please feel free to contact me! You can find all of my links at [https://infinixi.us](https://infinixi.us), and my Discord is **infinixius#5875**. You can also ask for help on the [issues](https://github.com/Infinixius/sourcemod.js/issues) page.
53+
4954
# License
5055

5156
This project is under the [MIT License](https://mit-license.org/). This allows you to use, modify, and distribute the source code as long as you include the license.
@@ -57,4 +62,6 @@ This project also makes use of the following libraries and/or projects:
5762
- [sm-websocket](https://github.com/peace-maker/sm-websocket)
5863
- [SourceMod Sockets](https://forums.alliedmods.net/showthread.php?t=67640)
5964

60-
- [ws](https://github.com/websockets/ws)
65+
- [ws](https://github.com/websockets/ws)
66+
67+
Big thanks to [punteroo](https://github.com/punteroo) for helping with the `GiveWeapon` code!

docs/assets/logo.png

-113 KB
Binary file not shown.

docs/assets/logo_shadow.png

-339 KB
Binary file not shown.

docs/assets/socialpreview.png

-462 KB
Binary file not shown.

jsdoc.mod.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)