Encrypted Chat will allow players to view and post on an encrypted phone. This uses a social media style system that allows players to post messages with a custom username and profile picture.
By default, the chat command /darkweb is used to open the phone, however, this can also be configured to any command or even set up to be opened by using an item.
Players can change their username, profile picture, and phone size on the settings page.
This is a standalone script, however, you can enable QBCore support within the config.
Installation
Download the power_encryptedChat from Keymaster
Run the .sql file in your database. It is located within the README folder.
Add the files to your resources folder
Ensure that the resource file will start (either ensure your resource in the server.cfg or inside a folder which is started on server start)
Edit the config file to your needs
Restart your server
Configuration
Select the tab below for your framework to see the configuration options available.
useStandalone = false
useQBCore = true
resourceName = 'qb-core' -- Only change if you have renamed your QBCore file
useItem = false -- True if you want to have the encrypted chat opened by using an item
itemName = 'darkweb_phone' -- Name of the item (if left as default, you will need to create an item)
usingRealtime = false -- False is based on game time / True is based on real-time
usingTimezone = 'Europe/London' -- You can view the names of time zones here. https://momentjs.com/timezone/
enableCommand = true -- True if you want a chat command to open the encrypted chat
commandName = 'darkweb' -- Command used to open the chat. The default would be /darkweb
restrictFromJobs = true -- True means specified jobs will not be able to open encrypted chat
restrictedJobs = {
['police'] = true -- This will disable players with the police job from using the encrypted chat.
}
costPerMessage = 0 -- 0 is disabled / Any value over 0 is the price per message
When used as standalone, your player data will be stored based on Rockstar license and not by character ID.
This is not recommended for servers that allow multiple characters per player.
useStandalone = true
useQBCore = false
-- QBCore Only
-- resourceName = 'qb-core' -- Only change if you have renamed your QBCore file
-- useItem = false -- True if you want to have the encrypted chat opened by using an item
-- itemName = 'darkweb_phone' -- Name of the item (if left as default, you will need to create an item)
usingRealtime = false -- False is based on game time / True is based on real-time
usingTimezone = 'Europe/London' -- You can view the names of time zones here. https://momentjs.com/timezone/
enableCommand = true -- True if you want a chat command to open the encrypted chat
commandName = 'darkweb' -- Command used to open the chat. The default would be /darkweb
-- restrictFromJobs = true -- True means specified jobs will not be able to open encrypted chat
-- restrictedJobs = {
-- ['police'] = true -- This will disable players with the police job from using the encrypted chat.
-- }
costPerMessage = 0 -- 0 is disabled / Any value over 0 is the price per message
If you want to use an item with standalone, you will need to create a useable item that triggers the following client event:
power_encryptedChat:open
Editable files
client.lua
Custom Notifications
If you would like to edit the notifications to add your own custom notifications or to match them to your other server notifications, you can edit them in the client.lua file. Default notifications are as follows:
-- Edit the below if you would like to change the notification type.
RegisterNetEvent('power_encryptedChat:newMessageNotfication')
AddEventHandler('power_encryptedChat:newMessageNotfication', function(username)
TriggerEvent('chat:addMessage', {color = {255, 255, 255}, args = {"^8DARKWEB", 'New Post from '..username}})
end)
RegisterNetEvent('power_encryptedChat:notification')
AddEventHandler('power_encryptedChat:notification', function(message)
TriggerEvent('chat:addMessage', {color = {255, 255, 255}, args = {"^8DARKWEB", message}})
end)
server.lua
Discord Webhook
If you would like to add a discord webhook, you can add it to the server.lua. Be sure to change the CHANGEME to your webhook URL.
the-- Discord Webhook
-- Sends a copy of the darkweb message to discord as a chat message using the webhook.
local enableDiscordWebhook = true
-- Discord Webhook URL
local discordWebhookURL = "https://discord.com/api/webhooks/CHANGEME"
function discordMessage(data)
if enableDiscordWebhook then
local embeds = {}
if string.len(data.image) > 0 then
embeds = {{image = {url = data.image}}}
end
PerformHttpRequest(discordWebhookURL, function(Error, Content, Head) end, 'POST', json.encode({username = data.username, embeds = embeds, content = data.message, avatar_url = data.picture}), {['Content-Type'] = 'application/json'})
end
end
Money Management
If you would like the money taken from the cost per message to be added into a money management fund, you can add in your custom code in the server.lua here:
function moneyTakenForPost(source, costPerMessage)
-- You can add your own code here to add money that is taken from the player to a management fund.
end
Emojis
The following emoji's can be used within the chat with the following text codes