GithubHelp home page GithubHelp logo

altv-os-js-entitysync's Introduction

Open Source - Entity Sync for JS

Created by LeonMrBonnie

❤️ Support me by becoming a Patron
⭐ This repository if you found it useful!

Generic badge


Description

This repository provides an alt:V resource to work with the C# Entity Sync in JS.

It provides an easy base class for entities that you can expand for you own entities.

This resource handles the showing/removing of entities for you, you only need to create you own entity types.

Installing Dependencies / Installation

I cannot stress this enough. Ensure you have NodeJS 13+ or you will have problems.

  • NodeJS 13+
  • An Existing or New Gamemode
  • General Scripting Knowledge

First download the JS wrapper for the C# entity sync from GitHub.
Then you need to build it using dotnet publish -c Release and create a new resource with the type csharp.
You should name this resource entitysync-wrapper.

After that simply add the name of this resource to your server.cfg resource section.

altv-os-js-entitysync

And also add the name of this resource to the deps array of your resource.cfg from your main gamemode.
Also add the entitysync-wrapper to the deps array of your resource.

Then simply clone this repository into your main server resources folder.

cd resources
git clone https://github.com/LeonMrBonnie/altv-os-js-entitysync

Ensure your package.json includes this property:

"type": "module"

Adding new Entity types

For every new entity type (textlabel, object, ped etc.) you need to create a new Class that extends the base Entity class.
To do that you need to import this resource and extend from the Entity class. Then you can use the entity data etc.
Make sure that every new Entity class has its own unique type id. Else it will cause conflicts. For more info take a look at the Entity Sync Documentation

You can find an example in server/textlabel-example.js and client/textlabel-example.js

! IMPORTANT !
All your files related to the entity sync have to be in the same resource, because you can't export and import a class.
So you have to put all the files from this resource into your own resource.

Credits

  • Stuyk - For the drawtext3d function used in the example and this readme layout, as well as his other contributions to the alt:V community
  • Fabian Terhorst aka. Heron - For creating the C# module as well as creating the C# Entity Sync
  • Kudze - For creating the JS wrapper for the C# Entity Sync

Other alt:V Open Source Resources

altv-os-js-entitysync's People

Contributors

konders avatar leonmrbonnie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

altv-os-js-entitysync's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.