Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Stuyk/rebar-character-select
A character selection plugin for Rebar
https://github.com/Stuyk/rebar-character-select
Last synced: about 22 hours ago
JSON representation
A character selection plugin for Rebar
- Host: GitHub
- URL: https://github.com/Stuyk/rebar-character-select
- Owner: Stuyk
- Created: 2024-05-09T19:10:07.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-05-23T17:56:00.000Z (7 months ago)
- Last Synced: 2024-12-22T07:34:59.256Z (about 22 hours ago)
- Language: TypeScript
- Homepage: https://rebarv.com/
- Size: 18.6 KB
- Stars: 3
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Character Select for Rebar Framework
This plugin allows a user to create a character entry after authenticating, or select an existing character.
It automatically binds a `character` document to the player after authentication.
## Requires
You must have these plugins installed to use this plugin.
- [Rebar Auth](https://github.com/Stuyk/rebar-auth)
## Features
- Create a Character Entry
- Delete a Character Entry
- Select a Character Entry
- Config to Create First & Last Name Character
- Config to Create Single Named Character
- Config to Limit Total Characters Allowed
- Config for Single Character Login
- Translations## API
If you need to listen for when a player has selected a character you can use the `character-select-api`.
```ts
import * as alt from 'alt-server';
import { useRebar } from '@Server/index.js';
import { Character } from '@Shared/types/character.js';const Rebar = useRebar();
const api = Rebar.useApi();function handleCharacterSelected(player: alt.Player, character: Character) {}
async function init() {
// Wait for the API to be ready
await alt.Utils.waitFor(() => api.isReady('character-select-api'), 30000);// Get the API
const charSelectApi = api.get('character-select-api');// Hook in your event
charSelectApi.onSelect(handleCharacterSelected);
}init();
```## Installation
From the main directory of your `Rebar` framework.
```
git clone https://github.com/Stuyk/rebar-character-select src/plugins/character-select
```That's it.
If you wish to save the plugin in your own repository, go to the `src/plugins/character-select` folder and delete the `.git` folder.