Skip to content

Commit e9488cf

Browse files
Update README.md
1 parent 1720523 commit e9488cf

File tree

1 file changed

+26
-28
lines changed

1 file changed

+26
-28
lines changed

README.md

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -393,62 +393,60 @@ AltColShape.OnEntityEnterColShape = (entity, shape) => {
393393

394394
### Experimental entity streaming
395395

396-
https://github.com/FabianTerhorst/coreclr-module/releases/download/1.7.6-beta6/networking-entity.zip
397-
398-
Include the js file in your index.html
399-
```html
400-
<script type="module" src="networking-entity.js"></script>
401-
```
402-
Add the networking-entity.js and entity.proto file to your client config and save the entity.proto in top level of client files
403-
Add the https://www.nuget.org/packages/AltV.Net.NetworkingEntity/ to your project where you want to run the server
396+
https://github.com/FabianTerhorst/coreclr-module/releases/download/cdntest1.12.0-beta/networking-entity.zip
397+
Extract the files from the zip and put them into resources/networking-entity.
398+
Add the https://www.nuget.org/packages/AltV.Net.NetworkingEntity/ dependency to your server.
404399
```csharp
405400
AltNetworking.Init();
406401
AltNetworking.CreateEntity(new Position {X = 0, Y = 0, Z = 73}, 1, 50, new Dictionary<string, object>());
407402
```
408-
Add the client.js to your client and maybe rename the file
409-
Use it like this
403+
Add the networking-entity as a dependency to your client resource.
404+
```
405+
deps: [
406+
networking-entity
407+
]
408+
```
409+
Import the networking-entity resource in your client script and setup it.
410+
```js
411+
import networkingEntity from "networking-entity";
412+
networkingEntity.create();
413+
```
414+
Now you can write a own streamer to receive the entities and convert them into game objects ect.
415+
Tip: You can also call the `networkingEntity.create();` in the constructor of the streamer.
410416
```js
411-
import { create, onStreamIn, onStreamOut, onDataChange } from "client/streaming/client.js";
412-
import game from "natives";
413-
import hudWebView from "client/hud-webview.js";
417+
import networkingEntity from "networking-entity";
414418

415419
class EntityStreamer {
416420
constructor() {
417-
create(hudWebView);
418-
this.peds = new Map();
419421
this.onStreamIn = this.onStreamIn.bind(this);
420422
this.onStreamOut = this.onStreamOut.bind(this);
421423
this.onDataChange = this.onDataChange.bind(this);
422-
onStreamIn(this.onStreamIn);
423-
onStreamOut(this.onStreamOut);
424-
onDataChange(this.onDataChange);
424+
networkingEntity.onStreamIn(this.onStreamIn);
425+
networkingEntity.onStreamOut(this.onStreamOut);
426+
networkingEntity.onDataChange(this.onDataChange);
425427
}
426428

427429
onStreamIn(entity) {
428-
const ped = game.createPed(2, 1885233650, entity.position.x, entity.position.y, entity.position.z, 61, false, true);
429-
this.peds.set(entity.id, ped);
430430

431431
}
432432

433433
onStreamOut(entity) {
434-
if (this.peds.has(entity.id)) {
435-
game.deleteEntity(this.peds.get(entity.id));
436-
}
434+
437435
}
438436

439437
onDataChange(entity, data) {
440-
//TODO: when model changes ect.
438+
441439
}
442-
443440
}
444441

445442
export default new EntityStreamer();
446443
```
447-
Import the streamer in your main client file
444+
Now you just need to import the streamer from your client code.
448445
```js
449-
import "client/entity-streamer.js";
446+
import 'client/my-streamer.js';
450447
```
451-
When running on server don't forget to open the websocket port 46429 or change it to a own port with
448+
449+
When running on server don't forget to open the websocket port 46429 or change it to a own port with.
452450
```csharp
453451
AltNetworking.Init(new NetworkingModule(myPort))
454452
```

0 commit comments

Comments
 (0)