-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7197182
commit 74610ed
Showing
7 changed files
with
489 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 sevenlabs | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
MIT License | ||
Copyright (c) 2023 sevenlabs | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Empty file.
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 @@ | ||
fx_version 'bodacious' | ||
game 'gta5' | ||
author 'nano11bravo' | ||
description 'An updated chat theme based on Chat resource for FiveM.' | ||
url 'https://www.github.com/nano11bravo/' | ||
version '1.0.0' | ||
lua54 'yes' | ||
|
||
server_script 'server/main.lua' | ||
client_script 'client/main.lua' | ||
|
||
dependency 'chat' | ||
|
||
file 'theme/style.css' | ||
|
||
chat_theme 'labs-chat' { | ||
styleSheet = 'theme/style.css', | ||
msgTemplates = { | ||
labsChat = '<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' | ||
} | ||
|
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. |
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,76 @@ | ||
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) | ||
updateLogFile('Resource Started') | ||
if (GetCurrentResourceName() ~= resourceName) then | ||
return | ||
end | ||
if GetCurrentResourceName() ~= 'labs-chat' and svConfig.supportChecker == true then | ||
print('^6[Warning]^0 For better support, it is recommended that "'..GetCurrentResourceName().. '" be renamed to "labs-chat"') | ||
end | ||
if svConfig.versionChecker == true then | ||
PerformHttpRequest('https://api.github.com/repos/sevenlabs/labs-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('^1Labs 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) | ||
|
||
AddEventHandler('chatMessage', function(source, author, message) | ||
local formattedMessage = author .. ': ' .. message | ||
updateLogFile(formattedMessage) | ||
end) | ||
|
||
function updateLogFile(v) | ||
if LoadResourceFile(GetCurrentResourceName(), 'chat_log.log') == nil then | ||
SaveResourceFile(GetCurrentResourceName(), 'chat_log.log', '') | ||
end | ||
local logFile = LoadResourceFile(GetCurrentResourceName(), 'chat_log.log') | ||
local logFile = logFile .. os.date("[%H:%M:%S] ") .. v .. '\n' | ||
SaveResourceFile(GetCurrentResourceName(), 'chat_log.log', logFile) | ||
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.