Skip to content

Latest commit

 

History

History
70 lines (48 loc) · 1.74 KB

README.md

File metadata and controls

70 lines (48 loc) · 1.74 KB

[CRC][TS] alt:V Login

Supported by CRC

A login system that uses username / password for authentication.

Does not provide any account recovery methods. Just a simple login with username / password.

Requires

Highly recommended to get the extension, for better event handling.

Installation

  1. Install NPM packages
npm i @stuyk/cross-resource-cache
  1. Install crc-db resource

  2. Create a folder in your src folder called crc-login.

  3. Add the TypeScript files from this resource, to that folder.

  4. Modify server.toml and ensure it loads whatever you named the folder.

In the case of the example above it should be crc-login.

resources = [ 
    'crc-db',
    'crc-login',
    'core',
    'dbg_reconnect'
]
  1. Listen for crc-login-finish event.

When a bearer token is passed from a client you will get general account information through an alt.on event.

You should be listening to this event from some other resource.

interface Account {
    // MongoDB Document ID
    _id: string;
    // Account Data
    username: string;
    password: string;
}

alt.on('crc-login-finish', (player: alt.Player, account: Account) => {
    player.frozen = false;
    player.model = 'mp_m_freemode_01';
    player.visible = true;
    player.spawn(0, 0, 72);
});

Preview