mirror of
https://github.com/citizenfx/cfx-server-data.git
synced 2025-12-12 06:14:09 +01:00
initial
This commit is contained in:
7
resources/[gameplay]/obituary/__resource.lua
Normal file
7
resources/[gameplay]/obituary/__resource.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
dependency 'channelfeed'
|
||||
|
||||
client_script 'obituary.lua'
|
||||
|
||||
export 'printObituary'
|
||||
|
||||
files 'obituary.css'
|
||||
46
resources/[gameplay]/obituary/obituary.css
Normal file
46
resources/[gameplay]/obituary/obituary.css
Normal file
@@ -0,0 +1,46 @@
|
||||
@font-face {
|
||||
font-family: 'Roboto Condensed';
|
||||
src: url('nui://channelfeed/client/fonts/roboto-condensed.ttf') format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
src: url('nui://channelfeed/client/fonts/roboto-regular.ttf') format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
#channel-obituary
|
||||
{
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
#channel-obituary > div
|
||||
{
|
||||
width: 100%;
|
||||
|
||||
font-family: 'Roboto';
|
||||
}
|
||||
|
||||
#channel-obituary div.item
|
||||
{
|
||||
background-color: rgba(50, 50, 50, .6);
|
||||
padding: 4px;
|
||||
padding-left: 8px;
|
||||
padding-right: 8px;
|
||||
border-radius: 4px;
|
||||
color: #eee;
|
||||
margin-bottom: 3px;
|
||||
|
||||
font-size: 65%;
|
||||
}
|
||||
|
||||
#channel-obituary div.item b
|
||||
{
|
||||
font-family: 'Roboto Condensed';
|
||||
font-size: 125%;
|
||||
font-weight: normal;
|
||||
color: #09f;
|
||||
}
|
||||
51
resources/[gameplay]/obituary/obituary.lua
Normal file
51
resources/[gameplay]/obituary/obituary.lua
Normal file
@@ -0,0 +1,51 @@
|
||||
AddEventHandler('onClientResourceStart', function(name)
|
||||
if name == GetCurrentResource() then
|
||||
local x, y = GetHudPosition('HUD_RADAR')
|
||||
local w, h = GetHudSize('HUD_RADAR')
|
||||
|
||||
x = x - 0.01
|
||||
w = w + 0.02
|
||||
|
||||
if GetIsWidescreen() then
|
||||
x = x / 1.333
|
||||
w = w / 1.333
|
||||
end
|
||||
|
||||
exports.channelfeed:addChannel('obituary', {
|
||||
method = 'append',
|
||||
styleUrl = 'nui://obituary/obituary.css',
|
||||
styles = { -- temporary
|
||||
left = tostring(x * 100) .. '%',
|
||||
bottom = 'calc(' .. tostring((1 - y) * 100) .. '% + 10px)',
|
||||
width = tostring(w * 100) .. '%'
|
||||
},
|
||||
template = '<div class="item">{{{text}}}</div>'
|
||||
})
|
||||
end
|
||||
end)
|
||||
|
||||
function printObituary(format, ...)
|
||||
local args = table.pack(...)
|
||||
|
||||
for i = 1, args.n do
|
||||
if type(args[i]) == 'string' then
|
||||
args[i] = args[i]:gsub('<', '<')
|
||||
end
|
||||
end
|
||||
|
||||
echo("obituary: printObituary\n")
|
||||
|
||||
exports.channelfeed:printTo('obituary', {
|
||||
text = string.format(format, table.unpack(args))
|
||||
})
|
||||
end
|
||||
|
||||
--[[AddEventHandler('chatMessage', function(name, color, message)
|
||||
exports.channelfeed:printTo('obituary', {
|
||||
text = message:gsub('<', '<')
|
||||
})
|
||||
end)]]
|
||||
|
||||
AddEventHandler('onClientResourceStop', function()
|
||||
-- todo: remove channel
|
||||
end)
|
||||
Reference in New Issue
Block a user