{"id":17706744,"url":"https://github.com/nrzull/mtasa-chat2","last_synced_at":"2025-03-13T11:30:59.320Z","repository":{"id":250407375,"uuid":"192101573","full_name":"nrzull/mtasa-chat2","owner":"nrzull","description":"CEF chat for Multi Theft Auto: San Andreas","archived":true,"fork":false,"pushed_at":"2019-09-22T10:44:16.000Z","size":139,"stargazers_count":26,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-26T06:53:18.022Z","etag":null,"topics":["chat","gta","mtasa","multitheftauto"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nrzull.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-15T16:41:05.000Z","updated_at":"2024-10-08T13:29:18.000Z","dependencies_parsed_at":"2024-07-27T07:27:28.837Z","dependency_job_id":"09fa2874-8698-47fa-a6fc-754b173f0b04","html_url":"https://github.com/nrzull/mtasa-chat2","commit_stats":null,"previous_names":["nrzull/mtasa-chat2"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrzull%2Fmtasa-chat2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrzull%2Fmtasa-chat2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrzull%2Fmtasa-chat2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrzull%2Fmtasa-chat2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nrzull","download_url":"https://codeload.github.com/nrzull/mtasa-chat2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243396103,"owners_count":20284286,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chat","gta","mtasa","multitheftauto"],"created_at":"2024-10-25T00:03:10.414Z","updated_at":"2025-03-13T11:30:58.964Z","avatar_url":"https://github.com/nrzull.png","language":"Lua","funding_links":[],"categories":["Resources"],"sub_categories":[],"readme":"![showcase](https://i.imgur.com/bMoYPlL.jpg)\n\n## Description\n\nThe chat uses CEF and it tries to simulate behavior of default chat\n\n## Pros\n\n- Emojis (😈)\n- Adaptiveness (you don't need to put-on glasses for your 1920x1080 screen to see what others write)\n- Copy/paste from/to input (no more console -\u003e say someLongMessageOrUrl)\n- Customizable (now you can unify a chat for all of your players)\n- Extendable (for example you can make url links in chat clickable or add markdown support)\n\n## Cons\n\n- 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.\n- It can't be used until resource starts so you can't write useful messages to player in `onPlayerConnect` event handler. use `onPlayerJoin` instead\n\n## Getting Started\n\n- download [resource](https://github.com/nrzull/mtasa-chat2/releases/latest/download/chat2.zip)\n- move this resource to `server/mods/deathmatch/resources/` directory\n- add to `server/mods/deathmatch/mtaserver.conf`:\n\n```xml\n\u003c!-- set this resource before all other resources --\u003e\n\u003cresource src=\"chat2\" startup=\"1\" protected=\"0\" /\u003e\n```\n\n- add to `server/mods/deathmatch/acl.xml`:\n\n```xml\n\u003cgroup name=\"chat2ACLGroup\"\u003e\n  \u003cacl name=\"chat2ACL\"\u003e\u003c/acl\u003e\n  \u003cobject name=\"resource.chat2\"\u003e\u003c/object\u003e\n\u003c/group\u003e\n\n\u003cacl name=\"chat2ACL\"\u003e\n  \u003cright name=\"function.executeCommandHandler\" access=\"true\"\u003e\u003c/right\u003e\n\u003c/acl\u003e\n```\n\n## API\n\n### Clientside\n\n#### Functions\n\n- `outputChatBox(string message, int red?, int green?, int blue?) -\u003e void`\n  Note that there is no last parameter `colorcoded`. Hex processing is enabled by default\n- `showChat(bool show) -\u003e void`\n- `clearChatBox() -\u003e void`\n- `exports.chat2:isChatVisible() -\u003e bool`\n\n### Serverside\n\n#### Functions\n\n- `outputChatBox(string message, element elem?, int red?, int green?, int blue?) -\u003e void`\n  Note that there is no last parameter `colorcoded`. Hex processing is enabled by default\n- `showChat(element elem, bool show) -\u003e void`\n- `clearChatBox(element elem) -\u003e void`\n- `exports.chat2:useDefaultOutput(bool) -\u003e void`\n  Enable/disable default output. If you disable it, then you need to write your own custom handlers for `onPlayerChat` event\n\n### Examples\n\n```lua\naddEventHandler(\"onResourceStart\", resourceRoot, function()\n  -- need to be executed if your gamemode doesn't output any messages to chat in\n  -- onPlayerChat event handlers. As an example: play gamemode already uses its own output\n  -- so you don't need to enable default output, but race gamemode doesn't have it,\n  -- so you need to enable default output.\n  exports.chat2:useDefaultOutput(true)\nend)\n\naddEventHandler(\"onPlayerJoin\", root, function()\n  outputChatBox(\"#ccff00hellow #ffcc00world\", source)\n  outputChatBox(\"i'm red af\", source, 255, 0, 0)\nend)\n\n-- listen for direct output from chat\n-- should be created if useDefaultOutput wasn't set to 'true'\naddEventHandler(\"onPlayerChat\", root, function(message, messageType)\n  if message ~= \"ping\" then\n    outputChatBox(\"pong\", source)\n  end\nend)\n```\n\n### FAQ\n\n- #### I started this resource but I don't see the chat\n\n  You should execute `exports.chat2:useDefaultOutput(true)` because your gamemode doesn't have built-in output\n\n- #### The chat shows the same messages twice\n\n  Execute `exports.chat2:useDefaultOutput(false)` somewhere in your code\n\n- #### How can I add new input types for, let's say, global/local/private chats?\n\n  You need to add new entries in clientside [inputKeyButtons](https://github.com/nrzull/mtasa-chat2/blob/master/chat2_client.lua#L11) table with unique `messageType` values and then process this messageTypes in `onPlayerChat` event handlers\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnrzull%2Fmtasa-chat2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnrzull%2Fmtasa-chat2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnrzull%2Fmtasa-chat2/lists"}