Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ragempcommunity/types-server

Package Overview
Dependencies
Maintainers
3
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ragempcommunity/types-server

Types definitions for RAGE:MP server-side module

  • 2.0.0
  • npm
  • Socket score

Version published
Weekly downloads
72
decreased by-67.71%
Maintainers
3
Weekly downloads
 
Created
Source

Remember to 🌟 this Github if you 💖 it.

This package contains types definitions for RAGE:MP server-side module.

📥 Installation

SERVER-SIDE

Use github:ragempcommunity/ragemp-types#types-server to latest build

# With npm
npm i --save-dev github:ragempcommunity/ragemp-types#types-server@v1.0.3

# With yarn
yarn add -D github:ragempcommunity/ragemp-types#types-server@v1.0.3

# With pnpm
pnpm add -D github:ragempcommunity/ragemp-types#types-server@v1.0.3

To make these types detectable, you need to add the types property below to tsconfig.json on each side of your project.

// e.g server-side
{
	"compilerOptions": {
		"types": ["{RELATIVE_PATH_TO_NODE_MODULES}/@ragemp/types-server"]
	}
}

🤓 Usage

Full type-safe and auto-complete


To extend a Mp object, there are 2 ways:

  1. By extend the prototype of the object:
mp.Player.prototype.myMethod = function myMethod() {
	// my method logic
};

// Usage
mp.events.add('playerReady', (player) => {
	player.myProperty = 1;

	player.myMethod();
});
// @types/index.d.ts
declare global {
	interface PlayerMp {
		myProperty: number;

		myMethod(): void;
	}
}

export {};
  1. By extend the object itself:
mp.events.add('playerReady', (player) => {
	player.myProperty = 1;

	player.myMethod = function myMethod() {
		// my method logic
	};
});
// @types/index.d.ts
declare global {
	interface PlayerMp {
		myProperty: number;

		myMethod(): void;
	}
}

export {};

See: RAGEMP Typescript Boilerplate

👨‍💻 Contributing

To contribute to this repository, feel free to create a new fork of the repository and submit a pull request.

  1. Fork / Clone and select the main branch.
  2. Create a new branch in your fork.
  3. Make your changes.
  4. Commit your changes, and push them.
  5. Submit a Pull Request here!

🎉 Thanks

📋 License

This project is licensed under the MIT License - see the LICENSE file for details.

FAQs

Package last updated on 31 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc