Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on Mar 11, 2024. It is now read-only.
/mtasa-chat2Public archive

CEF chat for Multi Theft Auto: San Andreas

License

NotificationsYou must be signed in to change notification settings

nrzull/mtasa-chat2

Repository files navigation

showcase

Description

The chat uses CEF and it tries to simulate behavior of default chat

Pros

  • Emojis (😈)
  • Adaptiveness (you don't need to put-on glasses for your 1920x1080 screen to see what others write)
  • Copy/paste from/to input (no more console -> say someLongMessageOrUrl)
  • Customizable (now you can unify a chat for all of your players)
  • Extendable (for example you can make url links in chat clickable or add markdown support)

Cons

  • It can't execute built-in commands like/nick,/login, etc "due to security reasons." (c) mta wiki. You need to write your own custom handlers for this commands or just use console for such commands. Custom commands still work as expected.
  • It can't be used until resource starts so you can't write useful messages to player inonPlayerConnect event handler. useonPlayerJoin instead

Getting Started

  • downloadresource
  • move this resource toserver/mods/deathmatch/resources/ directory
  • add toserver/mods/deathmatch/mtaserver.conf:
<!-- set this resource before all other resources--><resourcesrc="chat2"startup="1"protected="0" />
  • add toserver/mods/deathmatch/acl.xml:
<groupname="chat2ACLGroup">  <aclname="chat2ACL"></acl>  <objectname="resource.chat2"></object></group><aclname="chat2ACL">  <rightname="function.executeCommandHandler"access="true"></right></acl>

API

Clientside

Functions

  • outputChatBox(string message, int red?, int green?, int blue?) -> voidNote that there is no last parametercolorcoded. Hex processing is enabled by default
  • showChat(bool show) -> void
  • clearChatBox() -> void
  • exports.chat2:isChatVisible() -> bool

Serverside

Functions

  • outputChatBox(string message, element elem?, int red?, int green?, int blue?) -> voidNote that there is no last parametercolorcoded. Hex processing is enabled by default
  • showChat(element elem, bool show) -> void
  • clearChatBox(element elem) -> void
  • exports.chat2:useDefaultOutput(bool) -> voidEnable/disable default output. If you disable it, then you need to write your own custom handlers foronPlayerChat event

Examples

addEventHandler("onResourceStart",resourceRoot,function()-- need to be executed if your gamemode doesn't output any messages to chat in-- onPlayerChat event handlers. As an example: play gamemode already uses its own output-- so you don't need to enable default output, but race gamemode doesn't have it,-- so you need to enable default output.exports.chat2:useDefaultOutput(true)end)addEventHandler("onPlayerJoin",root,function()outputChatBox("#ccff00hellow #ffcc00world",source)outputChatBox("i'm red af",source,255,0,0)end)-- listen for direct output from chat-- should be created if useDefaultOutput wasn't set to 'true'addEventHandler("onPlayerChat",root,function(message,messageType)ifmessage~="ping"thenoutputChatBox("pong",source)endend)

FAQ

  • I started this resource but I don't see the chat

    You should executeexports.chat2:useDefaultOutput(true) because your gamemode doesn't have built-in output

  • The chat shows the same messages twice

    Executeexports.chat2:useDefaultOutput(false) somewhere in your code

  • How can I add new input types for, let's say, global/local/private chats?

    You need to add new entries in clientsideinputKeyButtons table with uniquemessageType values and then process this messageTypes inonPlayerChat event handlers


[8]ページ先頭

©2009-2025 Movatter.jp