An open API service indexing awesome lists of open source software.

https://github.com/the2alert/node-samp

Runtime environment Node.js in SA-MP
https://github.com/the2alert/node-samp

nodejs nodesamp plugin runtime sa-mp

Last synced: 11 months ago
JSON representation

Runtime environment Node.js in SA-MP

Awesome Lists containing this project

README

          









Runtime environment Node.js in SA-MP.








## Documentation


Documentation is here.

## Getting started
Preliminary requirements:

Installation and start on TypeScript:
```
git clone https://github.com/dev2alert/node-samp-starter.git my-server
cd ./my-server
npm i
npm run compile
npm start
```
Installation and start on JavaScript:
```
git clone https://github.com/dev2alert/node-samp-javascript-starter.git my-server
cd ./my-server
npm i
npm start
```
Start in development mode:
```
npm run dev
```

## Getting Started with Docker
Preliminary requirements:

Installation:
```
git clone https://github.com/dev2alert/node-samp-docker-starter.git my-server
cd ./my-server
npm i
```
Build and run:
```
npm run compile
make -B build
make run
```

## Example
Using Context API and TypeScript:
```typescript
import {Group, Keys, Player, Position, Vehicle, Weapons} from "@sa-mp/core";
import {Alt, Command, Context, Key, Param, ParamInt} from "@sa-mp/decorators";

@Context()
export class ModePlayer extends Player.Context {
public readonly vehicles: Group = new Group;

public onConnect(): boolean {
this.send(`Hello, ${this}!`);
return true;
}

public onRequestClass(): void {
this.spawnInfo({x: 1906.2207, y: -2429.4124, z: 13.5391, team: 0, skin: 68, rotation: 0, weapons: [{type: Weapons.AK47, ammo: 89}]});
this.spawn();
}

public onDisconnect(): void {
this.vehicles.destroy();
}

@Key(Keys.YES)
public handleKeyYes(): void {
this.spawn();
}

@Key(Keys.NO)
public handleKeyNo(): void {
this.vehicles.destroy();
}

@Command("spawn")
@Alt("s")
public spawnPlayer(): void {
this.spawn();
}

@Command("pos")
public setPosition(@Param() x: number, @Param() y: number, @Param() z: number): void {
this.pos = {x, y, z};
}

@Command("veh")
public createVehicle(@ParamInt() model: number, @ParamInt() color1: number, @ParamInt() color2: number): void {
const {x, y, z}: Position = this.pos;
const rotation: number = this.angle;
const vehicle: Vehicle = Vehicle.create({x, y, z, model, colors: [color1, color2], rotation});
if(this.isInAnyVehicle())
this.vehicle.destroy();
this.put(vehicle);
this.vehicles.push(vehicle);
}
}
```

## Todo list

- [x] Updating Node.js up to version 16.13.2!

- [x] Write documentation.
- [x] Add Streamer plugin support.
- [x] Add CrashDetect plugin support.
- [x] Add FCNPC plugin support.
- [ ] Add Jest testing support.
- [ ] Add Typeorm support.
- [ ] Add SAMPVOICE plugin support.
- [ ] Add SAMP CEF plugin support.
- [ ] Create SA-MP Extension.

## Supported plugins


Package
Plugin




































## Credits

## License


MIT