/samp-node

a SA-MP plugin to run nodejs scripts

Primary LanguageC++

samp-node

samp-node is a SA-MP plugin that allows you to run Node.js, meaning you can code in JS/TS instead of pawn.


Todo:

  • Add samp constant values (eg: INVALID_PLAYER_ID, MAX_TEXT_DRAWS, and etc...)

Download

You can always find latest builds here
But if you are looking for a stable version (or using sampctl), please visit here

Node version

Currently samp-node uses Node.js v16.

Tips

You should transpile your JS into commonjs to avoid issues.
It's recommended you use TypeScript and setup a tsconfig that extends @tsconfig/node16.

Type definitions for TypeScript

If you're using TypeScript then take a look at this repoistory: https://github.com/samp-dev/node
Instructions can be found there on how to install and use them.
Special thanks to pkfln (peek).

Credits

  • Damo for his samp.js project. 80% of native caller code is from that project, cause I didn't want to do all the args processing by myself when there's already something useful out there!
  • Hual for some v8 tips he gave me
  • Graber for a few suggestions and helpful advices
  • pkfln (peek) for fixing and adding some samp callbacks/events in samp-node, and making @sa-mp/node
  • polygxn for his changes in README.md which don't exist anymore
  • JustMichael (ADRFranklin) for his contributions, including fixes, features, and any others he's going to do in future
  • Alexander Plutalov (plutalov) for fixing long time crash issues and not having context running properly
  • iAmir (Amyr Aahmady) that's me.