first commit

This commit is contained in:
2026-06-23 11:41:04 +02:00
commit d3fae3aff5
24 changed files with 600 additions and 0 deletions
@@ -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 quun 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."
+63
View File
@@ -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)