first commit
@@ -0,0 +1,55 @@
|
|||||||
|
xyghtBladWinRPMenu = xyghtBladWinRPMenu or {}
|
||||||
|
|
||||||
|
AddCSLuaFile("bladw_deathscreen/config/sh_config.lua")
|
||||||
|
|
||||||
|
if SERVER then
|
||||||
|
AddCSLuaFile("bladw_hud/client/cl_hud.lua")
|
||||||
|
AddCSLuaFile("bladw_cMenu/client/cl_cMenu.lua")
|
||||||
|
AddCSLuaFile("bladw_deathscreen/client/cl_interface_ds.lua")
|
||||||
|
|
||||||
|
include("bladw_deathscreen/server/sv_hooks.lua")
|
||||||
|
|
||||||
|
resource.AddSingleFile("resource/fonts/Poppins-SemiBold.ttf")
|
||||||
|
resource.AddSingleFile("resource/fonts/Poppins-Medium.ttf")
|
||||||
|
resource.AddSingleFile("resource/fonts/Poppins-Bold.ttf")
|
||||||
|
resource.AddSingleFile("resource/fonts/Poppins-Regular.ttf")
|
||||||
|
else
|
||||||
|
include("bladw_hud/client/cl_hud.lua")
|
||||||
|
include("bladw_cMenu/client/cl_cMenu.lua")
|
||||||
|
include("bladw_deathscreen/client/cl_interface_ds.lua")
|
||||||
|
|
||||||
|
surface.CreateFont("bladw_text", {
|
||||||
|
font = "Poppins-SemiBold",
|
||||||
|
size = 25,
|
||||||
|
weight = 600,
|
||||||
|
antialias = true
|
||||||
|
})
|
||||||
|
|
||||||
|
surface.CreateFont("bladw_text_Medium", {
|
||||||
|
font = "Poppins-SemiBold",
|
||||||
|
size = 20,
|
||||||
|
weight = 800,
|
||||||
|
antialias = true
|
||||||
|
})
|
||||||
|
|
||||||
|
surface.CreateFont("bladw_text_Bold", {
|
||||||
|
font = "Poppins-Bold",
|
||||||
|
size = 70,
|
||||||
|
weight = 700,
|
||||||
|
antialias = true
|
||||||
|
})
|
||||||
|
|
||||||
|
surface.CreateFont("bladw_text_Regular", {
|
||||||
|
font = "Poppins-Regular",
|
||||||
|
size = 35,
|
||||||
|
weight = 400,
|
||||||
|
antialias = true
|
||||||
|
})
|
||||||
|
|
||||||
|
surface.CreateFont("bladw_text2", {
|
||||||
|
font = "Poppins-SemiBold",
|
||||||
|
size = 21.5,
|
||||||
|
weight = 800,
|
||||||
|
antialias = true
|
||||||
|
})
|
||||||
|
end
|
||||||
@@ -0,0 +1,239 @@
|
|||||||
|
local function RX(x) return x * (ScrW() / 1920) end
|
||||||
|
local function RY(y) return y * (ScrH() / 1080) end
|
||||||
|
|
||||||
|
local bladw_materials = {
|
||||||
|
background = Material("xyoss/cMenu/background.png"),
|
||||||
|
backgroundButton = Material("xyoss/cMenu/backgroundButton.png"),
|
||||||
|
backgroundButtonHover = Material("xyoss/cMenu/backgroundButtonHover.png"),
|
||||||
|
backpoliciers = Material("xyoss/cMenu/backpoliciers.png"),
|
||||||
|
backpompiers = Material("xyoss/cMenu/backpompiers.png"),
|
||||||
|
discord = Material("xyoss/cMenu/discordbutton.png"),
|
||||||
|
steam = Material("xyoss/cMenu/steambutton.png"),
|
||||||
|
website = Material("xyoss/cMenu/webButton.png"),
|
||||||
|
}
|
||||||
|
|
||||||
|
local CMenu
|
||||||
|
|
||||||
|
local function HoveredButton(button, mat, label, font)
|
||||||
|
|
||||||
|
if type(mat) == "string" then
|
||||||
|
mat = Material(mat, "noclamp smooth")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
button.Paint = function(self, w, h)
|
||||||
|
local bgcolor = Color(0, 0, 0, 215)
|
||||||
|
local textcolor = Color(255, 255, 255, 255)
|
||||||
|
|
||||||
|
if self:IsHovered() then
|
||||||
|
bgcolor = Color(255, 255, 255, 111)
|
||||||
|
textcolor = Color(0, 0, 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
draw.RoundedBox(12, 0, 0, w, h, bgcolor)
|
||||||
|
surface.SetDrawColor(255, 255, 255)
|
||||||
|
surface.SetMaterial(mat)
|
||||||
|
surface.DrawTexturedRect(15, 12.5, w / 4 , h / 2)
|
||||||
|
draw.SimpleText(label, font, w / 1.55, h / 2.1, textcolor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function HoveredButton2(button, label, font)
|
||||||
|
|
||||||
|
button.Paint = function(self, w, h)
|
||||||
|
local bgmat = bladw_materials.backgroundButton
|
||||||
|
|
||||||
|
if self:IsHovered() then
|
||||||
|
bgmat = bladw_materials.backgroundButtonHover
|
||||||
|
end
|
||||||
|
|
||||||
|
surface.SetDrawColor(255, 255, 255)
|
||||||
|
surface.SetMaterial(bgmat)
|
||||||
|
surface.DrawTexturedRect(0, 0, w, h)
|
||||||
|
draw.SimpleText(label, font, w / 1.9, h / 2.1, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function CloseCMenu()
|
||||||
|
if IsValid(CMenu) then
|
||||||
|
CMenu:Remove()
|
||||||
|
CMenu = nil
|
||||||
|
gui.EnableScreenClicker(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function GetStats()
|
||||||
|
local nbplayer = player.GetCount()
|
||||||
|
local nbpolice = team.NumPlayers(TEAM_POLICE)
|
||||||
|
local nbpompiers = team.NumPlayers(TEAM_POMPIERS)
|
||||||
|
|
||||||
|
return nbplayer, nbpolice, nbpompiers
|
||||||
|
end
|
||||||
|
|
||||||
|
local nbplayer, nbpolice, nbpompiers = GetStats()
|
||||||
|
|
||||||
|
function OpenCMenu()
|
||||||
|
if IsValid(CMenu) then return end
|
||||||
|
|
||||||
|
local ply = LocalPlayer()
|
||||||
|
|
||||||
|
CMenu = vgui.Create("DFrame")
|
||||||
|
CMenu:SetSize(RX(400), ScrH())
|
||||||
|
CMenu:SetTitle("")
|
||||||
|
CMenu:SetPos(ScrW() - RX(400), 0)
|
||||||
|
CMenu:SetDraggable(false)
|
||||||
|
CMenu:ShowCloseButton(false)
|
||||||
|
CMenu:SetCursor("arrow")
|
||||||
|
CMenu:SetAlpha(0)
|
||||||
|
CMenu:AlphaTo(255, 0.4, 0)
|
||||||
|
CMenu.Paint = function(self, w, h)
|
||||||
|
surface.SetDrawColor(255, 255, 255)
|
||||||
|
surface.SetMaterial(bladw_materials.background)
|
||||||
|
surface.DrawTexturedRect(0, 0, w, h)
|
||||||
|
|
||||||
|
surface.SetFont("bladw_text")
|
||||||
|
local before = "Il y a "
|
||||||
|
local count = tostring(nbplayer)
|
||||||
|
local after = " joueurs sur le serveur"
|
||||||
|
|
||||||
|
local beforeW, _ = surface.GetTextSize(before)
|
||||||
|
local countW, _ = surface.GetTextSize(count)
|
||||||
|
local totalW, _ = surface.GetTextSize(before .. count .. after)
|
||||||
|
local startX = w / 2 - totalW / 2
|
||||||
|
|
||||||
|
draw.SimpleText(before, "bladw_text", startX, RY(900), Color(255, 255, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
|
||||||
|
draw.SimpleText(count, "bladw_text", startX + beforeW, RY(900), Color(255, 165, 0), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
|
||||||
|
draw.SimpleText(after, "bladw_text", startX + beforeW + countW, RY(900), Color(255, 255, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
|
||||||
|
end
|
||||||
|
|
||||||
|
button3pers = vgui.Create("DButton", CMenu)
|
||||||
|
button3pers:SetSize(RX(400), RY(122))
|
||||||
|
button3pers:SetPos(RX(0), RY(250))
|
||||||
|
button3pers:SetText("")
|
||||||
|
HoveredButton2(button3pers, "3ème personne", "bladw_text")
|
||||||
|
button3pers.DoClick = function()
|
||||||
|
ply:ConCommand("bladw_3pers")
|
||||||
|
end
|
||||||
|
|
||||||
|
SoundButton = vgui.Create("DButton", CMenu)
|
||||||
|
SoundButton:SetSize(RX(400), RY(122))
|
||||||
|
SoundButton:SetPos(RX(0), RY(325))
|
||||||
|
SoundButton:SetText("")
|
||||||
|
HoveredButton2(SoundButton, "Stopsound", "bladw_text")
|
||||||
|
SoundButton.DoClick = function()
|
||||||
|
ply:ConCommand("bladw_sound")
|
||||||
|
end
|
||||||
|
|
||||||
|
staffbutton = vgui.Create("DButton", CMenu)
|
||||||
|
staffbutton:SetSize(RX(400), RY(122))
|
||||||
|
staffbutton:SetPos(RX(0), RY(400))
|
||||||
|
staffbutton:SetText("")
|
||||||
|
HoveredButton2(staffbutton, "Appelez un staff", "bladw_text")
|
||||||
|
staffbutton.DoClick = function()
|
||||||
|
ply:ConCommand("bladw_staff")
|
||||||
|
end
|
||||||
|
|
||||||
|
moneybutton = vgui.Create("DButton", CMenu)
|
||||||
|
moneybutton:SetSize(RX(400), RY(122))
|
||||||
|
moneybutton:SetPos(RX(0), RY(475))
|
||||||
|
moneybutton:SetText("")
|
||||||
|
HoveredButton2(moneybutton, "Jeter de l'argent", "bladw_text")
|
||||||
|
moneybutton.DoClick = function()
|
||||||
|
ply:ConCommand("bladw_money")
|
||||||
|
end
|
||||||
|
|
||||||
|
weaponbutton = vgui.Create("DButton", CMenu)
|
||||||
|
weaponbutton:SetSize(RX(400), RY(122))
|
||||||
|
weaponbutton:SetPos(RX(0), RY(550))
|
||||||
|
weaponbutton:SetText("")
|
||||||
|
HoveredButton2(weaponbutton, "Jeter une arme", "bladw_text")
|
||||||
|
weaponbutton.DoClick = function()
|
||||||
|
ply:ConCommand("bladw_weapon")
|
||||||
|
end
|
||||||
|
|
||||||
|
PoliceButton = vgui.Create("DPanel", CMenu)
|
||||||
|
PoliceButton:SetSize(RX(260), RY(51))
|
||||||
|
PoliceButton:SetPos(RX(75), RY(732))
|
||||||
|
PoliceButton.Paint = function(self, w, h)
|
||||||
|
surface.SetDrawColor(255, 255, 255)
|
||||||
|
surface.SetMaterial(bladw_materials.backpoliciers)
|
||||||
|
surface.DrawTexturedRect(0, 0, w, h)
|
||||||
|
|
||||||
|
surface.SetFont("bladw_text")
|
||||||
|
local count = nbpolice
|
||||||
|
local after = " Gendarmes en service"
|
||||||
|
|
||||||
|
local countW, _ = surface.GetTextSize(count)
|
||||||
|
local totalW, _ = surface.GetTextSize(count .. after)
|
||||||
|
local startX = w - totalW / 1.2
|
||||||
|
|
||||||
|
draw.SimpleText(count, "bladw_text_Medium", startX, h / 2, Color(100, 180, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
|
||||||
|
draw.SimpleText(after, "bladw_text_Medium", startX + countW, h / 2, Color(255, 255, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
|
||||||
|
end
|
||||||
|
|
||||||
|
PompiersButton = vgui.Create("DPanel", CMenu)
|
||||||
|
PompiersButton:SetSize(RX(260), RY(51))
|
||||||
|
PompiersButton:SetPos(RX(75), RY(790))
|
||||||
|
PompiersButton.Paint = function(self, w, h)
|
||||||
|
surface.SetDrawColor(255, 255, 255)
|
||||||
|
surface.SetMaterial(bladw_materials.backpompiers)
|
||||||
|
surface.DrawTexturedRect(0, 0, w, h)
|
||||||
|
|
||||||
|
surface.SetFont("bladw_text")
|
||||||
|
local count = nbpompiers
|
||||||
|
local after = " Pompiers en service"
|
||||||
|
|
||||||
|
local countW, _ = surface.GetTextSize(count)
|
||||||
|
local totalW, _ = surface.GetTextSize(count .. after)
|
||||||
|
local startX = w - totalW / 1.11
|
||||||
|
|
||||||
|
draw.SimpleText(count, "bladw_text_Medium", startX, h / 2, Color(255, 100, 50), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
|
||||||
|
draw.SimpleText(after, "bladw_text_Medium", startX + countW, h / 2, Color(255, 255, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
|
||||||
|
end
|
||||||
|
|
||||||
|
DiscordButton = vgui.Create("DButton", CMenu)
|
||||||
|
DiscordButton:SetSize(RX(150), RY(51))
|
||||||
|
DiscordButton:SetPos(RX(50), RY(942))
|
||||||
|
DiscordButton:SetText("")
|
||||||
|
HoveredButton(DiscordButton, bladw_materials.discord, "Discord", "bladw_text_Medium")
|
||||||
|
|
||||||
|
DiscordButton.DoClick = function()
|
||||||
|
gui.OpenURL("https://discord.gg/KsE4Xef6vg")
|
||||||
|
end
|
||||||
|
|
||||||
|
SteamButton = vgui.Create("DButton", CMenu)
|
||||||
|
SteamButton:SetSize(RX(150), RY(51))
|
||||||
|
SteamButton:SetPos(RX(207), RY(942))
|
||||||
|
SteamButton:SetText("")
|
||||||
|
HoveredButton(SteamButton, bladw_materials.steam, "Steam", "bladw_text_Medium")
|
||||||
|
SteamButton.DoClick = function()
|
||||||
|
gui.OpenURL("")
|
||||||
|
end
|
||||||
|
|
||||||
|
WebButton = vgui.Create("DButton", CMenu)
|
||||||
|
WebButton:SetSize(RX(150), RY(51))
|
||||||
|
WebButton:SetPos(RX(125), RY(1005))
|
||||||
|
WebButton:SetText("")
|
||||||
|
HoveredButton(WebButton, bladw_materials.website, "Website", "bladw_text_Medium")
|
||||||
|
WebButton.DoClick = function()
|
||||||
|
gui.OpenURL("")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
hook.Add("PlayerButtonDown", "bladw_CMenu_open", function(ply, key)
|
||||||
|
if key == KEY_C then
|
||||||
|
OpenCMenu()
|
||||||
|
gui.EnableScreenClicker(true)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
hook.Add("PlayerButtonUp", "bladw_CMenu_close", function(ply, key)
|
||||||
|
if key == KEY_C then
|
||||||
|
CloseCMenu()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
hook.Add("OnContextMenuOpen", "bladw_blockC", function()
|
||||||
|
return true
|
||||||
|
end)
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
local function RX(x) return x * (ScrW() / 1920) end
|
||||||
|
local function RY(y) return y * (ScrH() / 1080) end
|
||||||
|
|
||||||
|
|
||||||
|
local ds = {
|
||||||
|
active = false,
|
||||||
|
startTime = 0,
|
||||||
|
duration = 0,
|
||||||
|
killerName = "Inconnu",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
local CFG = bladw_deathscreen and bladw_deathscreen.Config or {}
|
||||||
|
local deathscreen = nil
|
||||||
|
|
||||||
|
local function closeDeathscreen()
|
||||||
|
if IsValid(deathscreen) then deathscreen:Remove() end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function openDeathscreen()
|
||||||
|
|
||||||
|
local sw, sh = ScrW(), ScrH()
|
||||||
|
|
||||||
|
deathscreen = vgui.Create("DFrame")
|
||||||
|
deathscreen:SetSize(sw, sh)
|
||||||
|
deathscreen:SetPos(0, 0)
|
||||||
|
deathscreen:SetTitle("")
|
||||||
|
deathscreen:ShowCloseButton(false)
|
||||||
|
deathscreen.Paint = function(self, w, h)
|
||||||
|
draw.RoundedBox(0, 0, 0, w, h, Color(0, 0, 0, 253))
|
||||||
|
|
||||||
|
draw.SimpleText("TU ES MORT TROP TÔT.", "bladw_text_Bold", w / 2, h / 2.7, Color(76, 119, 227), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
|
||||||
|
draw.SimpleText("TUÉ PAR ".. ds.killerName, "bladw_text_Regular", w / 2, h / 2.4, Color(255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
|
||||||
|
|
||||||
|
-- Barre de progression
|
||||||
|
local barW = w * 0.47 -- largeur totale de la barre
|
||||||
|
local barH = 12 -- épaisseur
|
||||||
|
local barX = (w - barW) / 2 -- centrée
|
||||||
|
local barY = h / 1.6 -- position verticale
|
||||||
|
|
||||||
|
local elapsed = CurTime() - ds.startTime
|
||||||
|
local progress = math.Clamp(elapsed / ds.duration, 0, 1)
|
||||||
|
local filledW = barW * progress
|
||||||
|
|
||||||
|
-- Fond gris (temps restant)
|
||||||
|
draw.RoundedBox(barH / 2, barX, barY, barW, barH, Color(60, 60, 60))
|
||||||
|
|
||||||
|
-- Remplissage bleu (temps écoulé)
|
||||||
|
if filledW > 0 then
|
||||||
|
draw.RoundedBox(barH / 2, barX, barY, filledW, barH, Color(76, 119, 227))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Curseur blanc
|
||||||
|
local cursorR = 8
|
||||||
|
local cursorX = barX + filledW
|
||||||
|
local cursorY = barY + barH / 2
|
||||||
|
draw.RoundedBox(cursorR, cursorX - cursorR, cursorY - cursorR, cursorR * 2, cursorR * 2, Color(255, 255, 255, 255))
|
||||||
|
|
||||||
|
local remaining = ds.duration - (CurTime() - ds.startTime)
|
||||||
|
|
||||||
|
if ds.active and remaining <= 0 then
|
||||||
|
draw.SimpleText("Cliquez pour réapparaître.", "bladw_text2", w / 2, h / 1.47, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM)
|
||||||
|
else
|
||||||
|
draw.SimpleText("PATIENTEZ JUSQU'A CE QU'UN MEDECIN VOUS STABILISE. LES MEDECINS SONT EN ROUTE", "bladw_text2", w / 2, h / 1.47, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
net.Receive("bladw_deathscreen_open", function()
|
||||||
|
ds.duration = net.ReadUInt(16)
|
||||||
|
ds.killerName = net.ReadString()
|
||||||
|
ds.startTime = CurTime()
|
||||||
|
ds.active = true
|
||||||
|
openDeathscreen()
|
||||||
|
end)
|
||||||
|
|
||||||
|
net.Receive("bladw_deathscreen_close", function()
|
||||||
|
ds.active = false
|
||||||
|
closeDeathscreen()
|
||||||
|
end)
|
||||||
|
|
||||||
|
hook.Add("HUDShouldDraw", "bladw_ds_hidehud", function(name)
|
||||||
|
if not ds.active then return end
|
||||||
|
return false
|
||||||
|
end)
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
bladw_deathscreen = bladw_deathscreen or {}
|
||||||
|
bladw_deathscreen.Config = bladw_deathscreen.Config or {}
|
||||||
|
|
||||||
|
bladw_deathscreen.Config.Timer = 60 -- Temps en secondes avant de respawn
|
||||||
|
|
||||||
|
bladw_deathscreen.Config.Title = "Tu es mort trop tôt."
|
||||||
|
bladw_deathscreen.Config.Subtitle = "Patientez jusqu’à ce qu’un médecin vous stabilise. Les médecins sont en route."
|
||||||
|
bladw_deathscreen.Config.Stabilizer = "Vous avez été stabilisé par un médecin, veuillez patienter…"
|
||||||
|
bladw_deathscreen.Config.Respawn = "Cliquez pour réapparaitre."
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
-- sv_deathscreen.lua
|
||||||
|
|
||||||
|
util.AddNetworkString("bladw_deathscreen_open")
|
||||||
|
util.AddNetworkString("bladw_deathscreen_close")
|
||||||
|
|
||||||
|
local CFG = bladw_deathscreen and bladw_deathscreen.Config or {}
|
||||||
|
local RespawnTime = CFG.Timer or 60
|
||||||
|
|
||||||
|
local function Open_ds(ply, remaining, killerName)
|
||||||
|
if not IsValid(ply) or not ply:IsPlayer() then return end
|
||||||
|
|
||||||
|
local now = CurTime()
|
||||||
|
local dur = math.max(0, tonumber(remaining or RespawnTime) or 0)
|
||||||
|
ply._bladwUnLock = now + dur
|
||||||
|
|
||||||
|
net.Start("bladw_deathscreen_open")
|
||||||
|
net.WriteUInt(math.Clamp(dur, 0, 65535), 16)
|
||||||
|
net.WriteString(killerName or "Inconnu")
|
||||||
|
net.Send(ply)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function Close_ds(ply)
|
||||||
|
if not IsValid(ply) or not ply:IsPlayer() then return end
|
||||||
|
net.Start("bladw_deathscreen_close")
|
||||||
|
net.Send(ply)
|
||||||
|
end
|
||||||
|
|
||||||
|
hook.Add("PlayerDeath", "bladw_ds_open", function(victim, inflictor, attacker)
|
||||||
|
local killerName = "INCONNU"
|
||||||
|
if IsValid(attacker) and attacker:IsPlayer() then
|
||||||
|
killerName = string.upper(attacker:Nick())
|
||||||
|
end
|
||||||
|
|
||||||
|
local hasResponder = false
|
||||||
|
for _, p in ipairs(player.GetAll()) do
|
||||||
|
local job = p:getDarkRPVar("job")
|
||||||
|
if job == "Citizen" or job == "Citizen" then
|
||||||
|
hasResponder = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local respawnTime = hasResponder and 10 or RespawnTime
|
||||||
|
|
||||||
|
timer.Simple(0, function()
|
||||||
|
if IsValid(victim) then Open_ds(victim, respawnTime, killerName) end
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
hook.Add("CanPlayerSuicide", "bladw_ds_blocksuicide", function(ply)
|
||||||
|
local unlock = ply._bladwUnLock or 0
|
||||||
|
if CurTime() < unlock then return false end
|
||||||
|
end)
|
||||||
|
|
||||||
|
hook.Add("PlayerDeathThink", "bladw_ds_blockThink", function(ply)
|
||||||
|
local unlock = ply._bladwUnLock or 0
|
||||||
|
if CurTime() < unlock then return false end
|
||||||
|
end)
|
||||||
|
|
||||||
|
hook.Add("PlayerSpawn", "bladw_ds_close", function(ply)
|
||||||
|
Close_ds(ply)
|
||||||
|
ply._bladwUnLock = nil
|
||||||
|
end)
|
||||||
@@ -0,0 +1,149 @@
|
|||||||
|
local function RX(x) return x * (ScrW() / 1920) end
|
||||||
|
|
||||||
|
local function RY(y) return y * (ScrH() / 1080) end
|
||||||
|
|
||||||
|
function DrawDisc(x, y, iRadius, iProgress, iOffset)
|
||||||
|
|
||||||
|
iX = iX or 0
|
||||||
|
iY = iY or 0
|
||||||
|
iOffset = iOffset or 0
|
||||||
|
iRadius = iRadius or 25
|
||||||
|
iProgress = iProgress or 360
|
||||||
|
|
||||||
|
local tDisc = {
|
||||||
|
{ x = x, y = y }
|
||||||
|
}
|
||||||
|
|
||||||
|
for i = 0, iProgress do
|
||||||
|
local iRad = math.rad(-i + iOffset)
|
||||||
|
table.insert(tDisc, { x = x + math.sin(iRad) * iRadius, y = y + math.cos(iRad) * iRadius })
|
||||||
|
end
|
||||||
|
|
||||||
|
table.insert(tDisc, { x = x, y = y })
|
||||||
|
|
||||||
|
draw.NoTexture()
|
||||||
|
surface.DrawPoly(tDisc)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
local function DrawVerticalDisc(x, y, outerR, innerR, progress)
|
||||||
|
progress = math.Clamp(progress, 0, 100)
|
||||||
|
if progress <= 0 then return end
|
||||||
|
|
||||||
|
local segments = 128
|
||||||
|
local topY = y - outerR
|
||||||
|
local bottomY = y + outerR
|
||||||
|
local fillY = bottomY - (progress / 100) * (outerR * 2)
|
||||||
|
|
||||||
|
local points = {}
|
||||||
|
|
||||||
|
for i = 0, segments do
|
||||||
|
local iRad = math.rad((i / segments) * 360 - 90)
|
||||||
|
local px = x + math.cos(iRad) * outerR
|
||||||
|
local py = y + math.sin(iRad) * outerR
|
||||||
|
|
||||||
|
if py >= fillY then
|
||||||
|
points[#points + 1] = { x = px, y = py }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if #points < 3 then return end
|
||||||
|
|
||||||
|
local dy = math.Clamp(fillY - y, -outerR, outerR)
|
||||||
|
local dx = math.sqrt(outerR * outerR - dy * dy)
|
||||||
|
|
||||||
|
table.insert(points, 1, { x = x - dx, y = fillY })
|
||||||
|
table.insert(points, { x = x + dx, y = fillY })
|
||||||
|
|
||||||
|
draw.NoTexture()
|
||||||
|
surface.DrawPoly(points)
|
||||||
|
DrawDisc(x, y, innerR, 360, 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
local materials = {
|
||||||
|
heart = Material("materials/xyoss/hud/heartIcon.png"),
|
||||||
|
hunger = Material("materials/xyoss/hud/hungerIcon.png"),
|
||||||
|
job = Material("materials/xyoss/hud/jobIcon.png"),
|
||||||
|
money = Material("materials/xyoss/hud/moneyIcon.png"),
|
||||||
|
name = Material("materials/xyoss/hud/nameIcon.png"),
|
||||||
|
shield = Material("materials/xyoss/hud/shieldIcon.png"),
|
||||||
|
}
|
||||||
|
|
||||||
|
local displayMoney = 0
|
||||||
|
hook.Add("DarkRPVarChanged", "bladw_HUD_money", function(ply, var, oldVal, newVal)
|
||||||
|
if ply == LocalPlayer() and var == "money" then
|
||||||
|
displayMoney = newVal
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
hook.Add("HUDPaint", "bladw_HUD", function()
|
||||||
|
local ply = LocalPlayer()
|
||||||
|
local x, y = RX(100), RY(830)
|
||||||
|
|
||||||
|
local name = ply:Nick()
|
||||||
|
local job = ply:getDarkRPVar("job") or "Unknown"
|
||||||
|
local health = ply:Health()
|
||||||
|
local armor = ply:Armor()
|
||||||
|
local hunger = ply:getDarkRPVar("Energy") or 100
|
||||||
|
|
||||||
|
-- health
|
||||||
|
surface.SetDrawColor(255, 63, 63)
|
||||||
|
DrawVerticalDisc(x, y + RY(65), RX(40), RX(30), health)
|
||||||
|
surface.SetDrawColor(50, 50, 50, 250)
|
||||||
|
DrawDisc(x, y + RY(65), RX(35), 360)
|
||||||
|
-- armor
|
||||||
|
surface.SetDrawColor(81, 136, 255)
|
||||||
|
DrawVerticalDisc(x + RX(90), y + RY(65), RX(40), RX(30), hunger)
|
||||||
|
surface.SetDrawColor(50, 50, 50, 250)
|
||||||
|
DrawDisc(x + RX(90), y + RY(65), RX(35), 360)
|
||||||
|
|
||||||
|
-- hunger
|
||||||
|
surface.SetDrawColor(255, 166, 0)
|
||||||
|
DrawVerticalDisc(x + RX(180), y + RY(65), RX(40), RX(30), hunger)
|
||||||
|
surface.SetDrawColor(50, 50, 50, 250)
|
||||||
|
DrawDisc(x + RX(180), y + RY(65), RX(35), 360)
|
||||||
|
|
||||||
|
-- icônes
|
||||||
|
surface.SetDrawColor(255, 255, 255)
|
||||||
|
surface.SetMaterial(materials.heart)
|
||||||
|
surface.DrawTexturedRect(x - RX(12.5), y + RY(50), RX(25), RY(25))
|
||||||
|
surface.SetMaterial(materials.shield)
|
||||||
|
surface.DrawTexturedRect(x + RX(90) - RX(12.5), y + RY(50), RX(25), RY(27))
|
||||||
|
surface.SetMaterial(materials.hunger)
|
||||||
|
surface.DrawTexturedRect(x + RX(180) - RX(15), y + RY(50), RX(25), RY(30))
|
||||||
|
|
||||||
|
-- textes
|
||||||
|
surface.SetDrawColor(255, 255, 255)
|
||||||
|
surface.SetMaterial(materials.name)
|
||||||
|
surface.DrawTexturedRect(x - RX(50), y + RY(120), RX(22), RY(27))
|
||||||
|
draw.SimpleText(name, "bladw_text", x + RX(5), y + RY(135), Color(255, 255, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
|
||||||
|
|
||||||
|
surface.SetMaterial(materials.job)
|
||||||
|
surface.DrawTexturedRect(x - RX(60), y + RY(160), RX(40), RY(40))
|
||||||
|
draw.SimpleText(job, "bladw_text", x + RX(5), y + RY(180), Color(255, 255, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
|
||||||
|
|
||||||
|
surface.SetMaterial(materials.money)
|
||||||
|
surface.DrawTexturedRect(x - RX(50), y + RY(215), RX(20), RY(20))
|
||||||
|
draw.SimpleText(displayMoney .. " €", "bladw_text", x + RX(5), y + RY(225), Color(85, 255, 116), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
|
||||||
|
end)
|
||||||
|
|
||||||
|
local hideElement = {
|
||||||
|
["CHudHealth"] = true,
|
||||||
|
["CHudBattery"] = true,
|
||||||
|
["CHudAmmo"] = true,
|
||||||
|
["CHudSecondaryAmmo"] = true,
|
||||||
|
["CHudCrosshair"] = true,
|
||||||
|
["CHudWeaponSelection"] = true,
|
||||||
|
["DarkRP_HUD"] = true,
|
||||||
|
["DarkRP_EntityDisplay"] = true,
|
||||||
|
["DarkRP_LocalPlayerHUD"] = true,
|
||||||
|
["DarkRP_Hungermod"] = true,
|
||||||
|
["DarkRP_Agenda"] = true,
|
||||||
|
["DarkRP_LockdownHUD"] = true,
|
||||||
|
["DarkRP_ArrestedHUD"] = true,
|
||||||
|
["DarkRP_ChatReceivers"] = true,
|
||||||
|
}
|
||||||
|
|
||||||
|
hook.Add("HUDShouldDraw", "bladw_HUD_ShouldDraw", function(name)
|
||||||
|
if hideElement[name] then return false end
|
||||||
|
end)
|
||||||
|
After Width: | Height: | Size: 1.9 MiB |
|
After Width: | Height: | Size: 104 KiB |
|
After Width: | Height: | Size: 104 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 5.3 KiB |
|
After Width: | Height: | Size: 505 B |
|
After Width: | Height: | Size: 807 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 653 B |
|
After Width: | Height: | Size: 316 B |