Runtime environment Node.js in SA-MP.
Documentation is here.
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
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
Using Context API and TypeScript:
import{Group,Keys,Player,Position,Vehicle,Weapons}from"@sa-mp/core";import{Alt,Command,Context,Key,Param,ParamInt}from"@sa-mp/decorators";
@Context()exportclassModePlayerextendsPlayer.Context{publicreadonlyvehicles: Group<Vehicle>=newGroup;publiconConnect(): boolean{this.send(`Hello, ${this}!`);returntrue;}publiconRequestClass(): 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();}publiconDisconnect(): void{this.vehicles.destroy();}
@Key(Keys.YES)publichandleKeyYes(): void{this.spawn();}
@Key(Keys.NO)publichandleKeyNo(): void{this.vehicles.destroy();}
@Command("spawn")
@Alt("s")publicspawnPlayer(): void{this.spawn();}
@Command("pos")publicsetPosition(@Param()x: number, @Param()y: number, @Param()z: number): void{this.pos={x, y, z};}
@Command("veh")publiccreateVehicle(@ParamInt()model: number, @ParamInt()color1: number, @ParamInt()color2: number): void{const{x, y, z}: Position=this.pos;constrotation: number=this.angle;constvehicle: Vehicle=Vehicle.create({x, y, z, model,colors: [color1,color2], rotation});if(this.isInAnyVehicle())this.vehicle.destroy();this.put(vehicle);this.vehicles.push(vehicle);}}- Updating Node.js up to version 16.13.2!
- Write documentation.
- Add Streamer plugin support.
- Add CrashDetect plugin support.
- Add FCNPC plugin support.
- Add Jest testing support.
- Add Typeorm support.
- Add SAMPVOICE plugin support.
- Add SAMP CEF plugin support.
- Create SA-MP Extension.
| Package | Plugin |
|---|---|
