Config
Config.CMD = {}
Config.CMD.ServerSuggestion = true -- Display server cmd suggestion in ChatBox.
Config.GetPlayerName = function(source)
return GetPlayerName(source)
end
--[[ Chat style format.
^0Test
^1Test
^2Test
^3Test
^4Test
^5Test
^6Test
^7Test
^8Test
^9Test
^rTest
^*Test
^=Test
^/Test
^~Test
]]
--[[
This is global message textbox
Can custom in "./html/confog.js" GetAwesomeBox()
TriggerClientEvent("sendGlobalMessage", -1, "Name", "message", "https://avatars.cloudflare.steamstatic.com/fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb_full.jpg", "twitter")
TriggerClientEvent("sendGlobalMessage", -1, "Name", "message", "https://avatars.cloudflare.steamstatic.com/fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb_full.jpg", "ambulance")
TriggerClientEvent("sendGlobalMessage", -1, "Name", "message", "https://avatars.cloudflare.steamstatic.com/fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb_full.jpg", "mecano")
TriggerClientEvent("sendGlobalMessage", -1, "Name", "message", "https://avatars.cloudflare.steamstatic.com/fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb_full.jpg", "reporter")
TriggerClientEvent("sendGlobalMessage", -1, "Name", "message", "https://avatars.cloudflare.steamstatic.com/fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb_full.jpg", "police")
]]
Config.Dist = 40 -- Distance other player can see chat, set to -1 for all player see chat
Config.CMD = {}
Config.CMD.ClientSuggestion = true -- Display client cmd suggestion in ChatBox.
Config.CMD.BlockSuggestion = { -- Hide cmd of server and client in ChatBox.
["/admin"], -- Block command /admin
["+%"], -- Block all command with letters "+" ( +vstr )
["-%"], -- Block all command with letters "-" ( -vstr )
["_%"], -- Block all command with letters "_" ( _crash )
}
Config.Mask = {}
Config.Mask.Enable = true -- If player masked chat will hide player name.
Config.Mask.Stranger = "^1Stranger" -- Name of player masked.
Config.HideChat = false
AddEventHandler('DarkRP_Chat:toggle', function(toggle) -- Use this event to hide chatbox for other script, maybe you need clean UI.
Config.HideChat = toggle
if Config.HideChat then
SendNUIMessage({action = "hidechat"})
end
end)
Config.ChatInputActive = false
RegisterCommand('+DarkRP_Chat', function() -- Press T to open ChatBox.
if not NetworkIsInSession() or not NetworkIsPlayerActive(PlayerId()) then
return
end
if not Config.ChatInputActive then
Config.ChatInputActive = true
SetNuiFocus(Config.ChatInputActive)
SendNUIMessage({
action = 'openChatBox',
safezone = getMapPosition(),
})
RequestAnimDictC("random@arrests")
TaskPlayAnim(PlayerPedId(), "random@arrests", "generic_radio_chatter", 8.0001, -8.0001, -1 , 49, 0, 0, 0, 0)
end
end, false)
RegisterCommand('-DarkRP_Chat', function()
end, false)
RegisterKeyMapping('+DarkRP_Chat', 'Chat', 'keyboard', 'T')
RegisterCommand('+DarkRP_Chat_EXIT', function() -- Press Escape to close ChatBox.
if chatInputActive then
ExitChat()
end
end, false)
RegisterCommand('-DarkRP_Chat_EXIT', function()
end, false)
RegisterKeyMapping('+DarkRP_Chat_EXIT', 'Chat Exit', 'keyboard', 'ESCAPE')
-- Regiser you custom font here.
CreateThread(function()
-- RegisterFontFile('DarkRP') -- the name of your .gfx, without .gfx
-- fontId = RegisterFontId('DarkRP')
end)
--[[ Example code
CreateThread(function()
Wait(1000)
TriggerEvent("chat:removeSuggestion", "/version")
TriggerEvent('chat:addMessage', {
color = { 255, 0, 0},
multiline = true,
args = {"Me", "Please be careful to not step on too many snails!"}
})
end)
]]
let uploadurl = "https://darkrpth.com/upload.php"; // Change this to your server host.
let suggestion_common = `
Press <kbd class="fab fa-windows windows" style="font-weight: 1;"></kbd>+<kbd>Shift</kbd>+<kbd>S</kbd> to take screenshot.
<br>
Press <kbd>Ctrl</kbd>+<kbd>V</kbd> to paste image.
`; // Change to your language
let suggestion_display = true; // On or Off chat command suggestion
let suggestion_max_display = 5; // How many display command suggestion
let upload_text = "Uploading"; // Change to your language
let chat_styleDict = { // Chat style format css.
'*': 'font-weight: bold; font-style: inherit;',
'_': 'text-decoration: underline; font-style: inherit;',
'~': 'text-decoration: line-through; font-style: inherit;',
'=': 'text-decoration: underline line-through; font-style: inherit;',
'/': 'font-style: italic;',
'r': 'text-decoration: none; font-weight: normal; font-style: inherit;',
}
function GetAwesomeBox(buf, type, avatar, name, message) { // Add more message box
if(type=="twitter"){
buf.find('ul').append("<li class='w3-animate-left'><pre class='awesome messageblock' style='background: linear-gradient(90deg, rgba(16,101,153,0.8) 0%, rgba(29,161,242,0.8) 30%);'><img class='avatar-awesome' src='"+avatar+"' onerror='imageerrortwitter(this)'> " + name +"<i class='float-right fab fa-twitter faa-shake animated'></i><br><div class='message'>"+ message + "</pre></li>");
audioPlayer = new Howl({src: ["./sounds/twitter.ogg"], volume: 0.05});
audioPlayer.play();
}
if (type == "ambulance") {
buf.find('ul').append("<li class='w3-animate-left'><pre class='awesome messageblock' style='background: linear-gradient(90deg, rgba(204,0,0,0.8) 0%, rgba(255,68,68,0.8) 30%);'><img class='avatar-awesome' src='"+avatar+"' onerror='imageerror(this)'> " + name +"<i class='float-right fab fa-ambulance faa-flash animated'></i><br><div class='message'>"+ message + "</pre></li>");
}
if (type == "mecano") {
buf.find('ul').append("<li class='w3-animate-left'><pre class='awesome messageblock' style='background: linear-gradient(90deg, rgba(255,136,0,0.8) 0%, rgba(255,187,51,0.8) 30%);'><img class='avatar-awesome' src='"+avatar+"' onerror='imageerror(this)'> " + name +"<i class='float-right fab fa-tools faa-flash animated'></i><br><div class='message'>"+ message + "</pre></li>");
}
if (type == "reporter") {
buf.find('ul').append("<li class='w3-animate-left'><pre class='awesome messageblock' style='background: linear-gradient(90deg, rgba(0,105,92,0.8) 0%, rgba(43,187,173,0.8) 30%);'><img class='avatar-awesome' src='"+avatar+"' onerror='imageerror(this)'> " + name +"<i class='float-right fab fa-newspaper faa-flash animated'></i><br><div class='message'>"+ message + "</pre></li>");
}
if (type == "police") {
buf.find('ul').append("<li class='w3-animate-left'><pre class='awesome messageblock' style='background: linear-gradient(90deg, rgba(13,71,161,0.8) 0%, rgba(66,133,244,0.8) 30%);'><img class='avatar-awesome' src='"+avatar+"' onerror='imageerror(this)'> " + name +"<i class='float-right fab fa-siren faa-flash animated'></i><br><div class='message'>"+ message + "</pre></li>");
}
}
Last updated