-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: replace esx_rpchat with cc-chat
- Loading branch information
1 parent
25e3ef2
commit e51e065
Showing
13 changed files
with
460 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<h4 align="center"> | ||
<img src="https://img.shields.io/github/release/Concept-Collective/cc-chat.png"> | ||
<img src="https://img.shields.io/github/last-commit/Concept-Collective/cc-chat"> | ||
<img src="https://img.shields.io/github/license/Concept-Collective/cc-chat.png"> | ||
<img src="https://img.shields.io/github/issues/Concept-Collective/cc-chat.png"> | ||
<img src="https://img.shields.io/github/contributors/Concept-Collective/cc-chat.png"> | ||
<a href="https://discord.gg/PSqXgg8v8M" title=""><img alt="Discord Status" src="https://discordapp.com/api/guilds/807309391849062480/widget.png"></a> | ||
</h4> | ||
|
||
<div align="center"> | ||
<img src="https://user-images.githubusercontent.com/24248108/164179346-a4f24916-7c9f-42db-b89e-6df85b01ca61.jpg"> | ||
<h1 align="center">🎨 CC Chat - Chat Theme</h1> | ||
<p align="center"> | ||
CC Chat is a chat theme that includes a <a href="https://github.com/Concept-Collective/cc-rpchat">custom message template</a> for FiveM's default chat resource. | ||
<br/> | ||
<b><a href='https://discord.conceptcollective.net'>Discord</a> - <a href='https://cc-chat.conceptcollective.net/'>Documentation</a> - <a href="https://github.com/Concept-Collective/cc-chat/issues">Report Bug</a> - <a href="https://github.com/Concept-Collective/cc-chat/issues">Request Feature</a></b></h5> | ||
</p> | ||
<a href="https://discord.gg/PSqXgg8v8M" title=""><img alt="Discord Invite" src="https://discordapp.com/api/guilds/807309391849062480/widget.png?style=banner2"></a> | ||
</div> | ||
|
||
### 🖼️ Showcase | ||
|
||
<details> | ||
<summary>Screenshots</summary> | ||
<br> | ||
<img src="https://user-images.githubusercontent.com/24248108/163717930-36500cde-fa37-449a-b70b-ca25435b5493.png"> | ||
<img src="https://user-images.githubusercontent.com/24248108/163717928-fcd3c93a-622e-4ad2-b426-36ed15124af0.png"> | ||
<img src="https://user-images.githubusercontent.com/24248108/163717929-00984374-ac7f-4248-9631-96c6a715e819.png"> | ||
</details> | ||
|
||
### ⚠️ Important Notice | ||
**If CC Chat is a dependency for another resource you can ignore this notice.** | ||
|
||
Please note that this resource **does not include** any pre-written commands or chat messages; you will need to **create them yourself**. It is designed for people who have some experience with scripting. Only those who have some idea of what they're doing will be given support. | ||
|
||
### ✅ Features | ||
|
||
- Custom text input box | ||
- Custom suggestions box | ||
- A ready-to-use chat template | ||
- Anti-spam system | ||
- [Font Awesome](https://fontawesome.com/) icons (v6.2.1) | ||
- Completely customisable | ||
- Free Forever | ||
|
||
### 🛠 Installation | ||
Official guide to installing **CC Chat**. | ||
|
||
**Dependencies** | ||
- [Chat](https://github.com/citizenfx/cfx-server-data/tree/master/resources/%5Bgameplay%5D/chat) | ||
|
||
**Download** | ||
- Download the [latest releases](https://github.com/Concept-Collective/cc-chat/releases/latest) of cc-chat. | ||
|
||
**Install** | ||
- Create a new folder in your resources folder named ``cc-chat`` | ||
- Extract the archive's contents to your ``cc-chat`` folder. | ||
- ensure ``cc-chat`` anywhere after the default ``chat`` resource in your ``server.cfg``. | ||
|
||
### 🙋 Support | ||
- [Discord](https://discord.conceptcollective.net) | ||
|
||
-------- | ||
### License | ||
For an updated license, check the ``License`` file. That file will always overrule anything mentioned in the ``readme.md`` | ||
|
||
cc-chat - Concept Collective | ||
|
||
Copyright © 2022 Concept Collective. All rights reserved. | ||
|
||
You can use and edit this code to your liking as long as you don't ever claim it to be your own code and always provide proper credit. You're not allowed to sell cc-chat or any code you take from it. If you want to release your own version of cc-chat, you have to link the original GitHub repo, or release it via a Forked repo. |
23 changes: 23 additions & 0 deletions
23
server-data/resources/[esx_addons]/cc-chat/client/main.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
function getTimestamp() | ||
local meridiem = 'AM' | ||
year , month , day , hour , minute , second = '' | ||
if GetGameName() == 'fivem' then | ||
year , month , day , hour , minute , second = GetLocalTime() | ||
elseif GetGameName() == 'redm' then | ||
year , month , day , hour , minute , second = GetPosixTime() | ||
end | ||
if hour >= 13 then | ||
hour = hour - 12 | ||
meridiem = 'PM' | ||
end | ||
if hour == 12 then | ||
meridiem = 'PM' | ||
end | ||
if minute <= 9 then | ||
minute = '0' .. minute | ||
end | ||
timestamp = hour .. ':' .. minute .. ' ' .. meridiem | ||
return timestamp | ||
end | ||
|
||
exports('getTimestamp', getTimestamp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
version '1.4.1' | ||
author 'Concept Collective' | ||
description 'A chat theme for FiveM' | ||
|
||
lua54 'yes' | ||
|
||
server_script 'server/main.lua' | ||
client_script 'client/main.lua' | ||
|
||
dependency 'chat' | ||
|
||
file 'theme/style.css' | ||
|
||
chat_theme 'ccChat' { | ||
styleSheet = 'theme/style.css', | ||
msgTemplates = { | ||
ccChat = '<div id="notification" class="noisy"><div id="color-box" style="background-color: {0} !important;" class="noisy"></div><div id="info"><div id="top-info"><div id="left-info"><h1 id="title"><i class="{1}"></i></h1><h2 id="sub-title">{2}</h2></div><h2 id="time">{3}</h2></div><div id="bottom-info"><br><p id="text">{4}</p></div></div>' | ||
} | ||
} | ||
|
||
exports { | ||
'getTimestamp' | ||
} | ||
|
||
game 'common' | ||
fx_version 'adamant' |
62 changes: 62 additions & 0 deletions
62
server-data/resources/[esx_addons]/cc-chat/server/main.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
local svConfig = {} | ||
|
||
-- Configuration | ||
svConfig.versionChecker = true -- Version Checker | ||
svConfig.supportChecker = true -- Support Checker (If you use exports, it is recommended that you leave this on) | ||
|
||
-- Script | ||
AddEventHandler('onResourceStart', function(resourceName) | ||
if (GetCurrentResourceName() ~= resourceName) then | ||
return | ||
end | ||
if GetCurrentResourceName() ~= 'cc-chat' and svConfig.supportChecker == true then | ||
print('^6[Warning]^0 For better support, it is recommended that "'..GetCurrentResourceName().. '" be renamed to "cc-chat"') | ||
end | ||
if svConfig.versionChecker == true then | ||
PerformHttpRequest('https://api.github.com/repos/Concept-Collective/cc-chat/releases/latest', function (err, data, headers) | ||
if data == nil then | ||
print('An error occurred while checking the version. Your firewall may be blocking access to "github.com". Please check your firewall settings and ensure that "github.com" is allowed to establish connections.') | ||
return | ||
end | ||
|
||
local data = json.decode(data) | ||
if data.tag_name ~= 'v'..GetResourceMetadata(GetCurrentResourceName(), 'version', 0) then | ||
print('\n^1================^0') | ||
print('^1CC Chat ('..GetCurrentResourceName()..') is outdated!^0') | ||
print('Current version: (^1v'..GetResourceMetadata(GetCurrentResourceName(), 'version', 0)..'^0)') | ||
print('Latest version: (^2'..data.tag_name..'^0) '..data.html_url) | ||
print('Release notes: '..data.body) | ||
print('^1================^0') | ||
end | ||
end, 'GET', '') | ||
end | ||
end) | ||
|
||
-- Antispam System (Beta) | ||
local users = {} | ||
function checkSpam(source, message) | ||
local BlockedStatus = false | ||
|
||
-- Checks if the user has sent a message before | ||
if users[source] == nil then | ||
users[source] = {time = os.time()} | ||
return false | ||
end | ||
|
||
-- Check if the user has sent messages too quickly | ||
if os.time() - users[source].time < 2 then | ||
BlockedStatus = true | ||
end | ||
|
||
-- Check if the message is a repeat of the last message | ||
if message == users[source].lastMessage then | ||
BlockedStatus = true | ||
end | ||
|
||
-- Update the user's information in the table | ||
users[source] = {lastMessage = message, time = os.time()} | ||
|
||
return BlockedStatus | ||
end | ||
|
||
exports('checkSpam', checkSpam) |
Oops, something went wrong.