All Projects → Stuyk → altV-Chat-Extended

Stuyk / altV-Chat-Extended

Licence: GPL-3.0 License
A modified version of the default chat with additional useful features.

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects
HTML
75241 projects

Labels

Projects that are alternatives of or similar to altV-Chat-Extended

altv-os-character-editor
alt:V Open Source Character Editor / Synchronization
Stars: ✭ 35 (+169.23%)
Mutual labels:  altv
altv-quickstart
The fastest alt:V JS setup on GitHub.
Stars: ✭ 29 (+123.08%)
Mutual labels:  altv
altv-issues
Issues and roadmap for alt:V project
Stars: ✭ 79 (+507.69%)
Mutual labels:  altv
altv-js-module
JS module for alt:V Multiplayer. Powered by NodeJS & v8
Stars: ✭ 32 (+146.15%)
Mutual labels:  altv
altv-typescript
A Typescript Boilerplate for alt:V with simple setup and usage.
Stars: ✭ 32 (+146.15%)
Mutual labels:  altv
coreclr-module
CoreClr (.NET Core Common Language Runtime) community made module https://fabianterhorst.github.io/coreclr-module/index.html
Stars: ✭ 65 (+400%)
Mutual labels:  altv
altv-javascript-guide
An alt:V JavaScript Guide built with VuePress
Stars: ✭ 12 (-7.69%)
Mutual labels:  altv

extended:Chat for alt:V

Remember to 🌟 this Github if you 💖 it.

You can start by adding the chat resource in its own folder called 'chat'.

This chat resource builds on the EXISTING chat resource for alt:V.

Features:

  • Register Commands
  • Send Chat Messages
  • Broadcast Chat Messages
  • Cancel Default Chat Behavior and Relay to New Event
  • Mute Players
  • Chat Ranges (Must be enabled inside the index.mjs for chat.);
  • Chat Open / Close Events for Clientside
  • Chat Message Event for Clientside
  • Automatically Clear Chat Box on Close
  • Chat Padding Removed for Double the Messages Viewable
  • Chat Visibility Fix
  • Debug Chat Formatting

Chat Range

Debug Formatting

Installation:

altVServerFolder/
└── resources/
    ├── chat/
    |   ├── index.mjs
    |   ├── client.mjs
    |   ├── resource.cfg
    |   └── html/
    └── your_resource/
        ├── your_resource_main.mjs
        ├── your_resource_client.mjs
        └── your_resource.cfg

This is for YOUR resource that you want to implement the chat resource into.

resource.cfg

type: js,
main: your_resource_main.mjs
client-main: your_resource_client.mjs
client-files: [],
deps: [
    chat
]

Configuration

Inside chat/index.mjs:

let rangedChat = false; // Used for ranged chat.
let rangeOfChat = 25; // Used for ranged chat.
let cancelAllChat = false; // Used to intercept messages.

General Usage

Serverside

import * as alt from 'alt';
import * as chat from 'chat';

// Registers player based functions.
// ie.
// player.sendMessage('Hello!');
// player.mute(true);
alt.on('playerConnect', (player) => {
    chat.setupPlayer(player);
});

// Uses the chat resource to register a command.
// Sends a chat message to the player with their position information.
chat.registerCmd('pos', (player, args) => {
    // Send a message to a player.
    chat.send(player, `X: ${player.pos.x}, Y: ${player.pos.y}, Z: ${player.pos.z}`);

    // Send a message to a player directly.
    player.sendMessage(`X: ${player.pos.x}, Y: ${player.pos.y}, Z: ${player.pos.z}`);

    // Mute a player.
    player.mute(true);

    // Unmute a player.
    player.mute(false);

    // Sends to all players.
    chat.broadcast(`${player.name} is located at: ${player.pos.x}, Y: ${player.pos.y}, Z: ${player.pos.z}`);
});

chat.mute(player);
chat.unmute(player);

alt.on('chatIntercept', (player, msg) => {
    // Do whatever you need to do.
});

// Debug formatting.
chat.success(`Something succeeded!`);
chat.info(`INFORMATION!`);
chat.warning(`Don't do it, man!`);
chat.error(`Now you screwed it up! Good Job!`);
chat.debug(`secret INFORMATION!`);

Clientside

import * as alt from 'alt';
import * as chat from 'chat';

// This event fires when the chat is opened.
alt.on('chatOpened', () => {
    alt.log('Chat was opened!');
});

// This event fires when the chat is closed.
alt.on('chatClosed', () => {
    alt.log('Chat was closed!');
});

// This event is fired when the player presses enter or the chat message is longer than 1.
alt.on('messageSent', (msg) => {
    alt.log(msg);
});

chat.pushMessage('tacoGuy', 'hello');
chat.pushLine('hello there!');

var chatHiddenStatus = chat.isChatHidden();
var chatOpenStatus = chat.isChatOpen();
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].