Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local deathscreen_admin = {
- ["superadmin"] = true,
- ["admin"] = true,
- ["moderateur"] = true,
- ["moderateur-test"] = true
- }
- local deathscreen_premium = {
- ["premium"] = true
- }
- local deathscreen_time = {
- 80,
- 40
- }
- local noise = Sound("kadabra_sound/kdsound_deathsong.wav")
- if SERVER then
- local t = {}
- -- resource.AddFile("resource/fonts/quartzo_bold_font.ttf")
- -- resource.AddFile("resource/fonts/Roboto-Light.ttf")
- -- resource.AddFile("materials/kadabra_deathscreen/kdicon_death.png")
- -- resource.AddFile("sound/kadabra_sound/testsong.wav")
- resource.AddFile("sound/kadabra_sound/kdsound_deathsong.wav")
- util.AddNetworkString("kadabra_deathscreen")
- util.AddNetworkString("kadabra_deathscreen2")
- local function deathscreen_loadconfig()
- deathscreen_jobsmedic = {
- [TEAM_MEDECIN] = true,
- }
- end
- hook.Add("OnGamemodeLoaded","deathscreen_loadconfig",deathscreen_loadconfig)
- local function IfMedicInCity()
- local t = false
- for a ,b in pairs(player.GetAll()) do
- if deathscreen_jobsmedic[b:Team()] then
- t = true
- break
- end
- end
- return t
- end
- hook.Add("PlayerDeathSound","kadabra_deathscreen_deathsound",function()
- return true
- end)
- local function kadabra_deathscreen_Death(ply)
- net.Start("kadabra_deathscreen")
- local c
- if IfMedicInCity() then
- net.WriteBool(true)
- c = deathscreen_time[1]
- else
- net.WriteBool(false)
- c = deathscreen_time[2]
- end
- if deathscreen_premium[ply:GetUserGroup()] then
- c = c/2
- end
- if deathscreen_admin[ply:GetUserGroup()] then
- c = 0
- end
- if c > 0 then
- t[ply] = CurTime()+c
- end
- c = math.ceil(c)
- net.WriteInt(c,9)
- net.Send(ply)
- return true
- end
- hook.Add("PlayerDeath","kadabra_deathscreen_Death", kadabra_deathscreen_Death)
- hook.Add("PlayerDeathThink","kadabra_deathscreen_DeathThink",function(ply)
- if t[ply] == nil then
- if ( ply:IsBot() || ply:KeyPressed( IN_ATTACK ) || ply:KeyPressed( IN_ATTACK2 ) || ply:KeyPressed( IN_JUMP ) ) then
- ply:Spawn()
- end
- else
- return false
- end
- end)
- hook.Add("PlayerSpawn","kadabra_deathscreen_resetsound",function(ply)
- net.Start("kadabra_deathscreen2")
- net.Send(ply)
- end)
- hook.Add("Think","kadabra_deathscreen_timer",function()
- for a, b in pairs(t) do
- if CurTime() >= b then
- t[a] = nil
- end
- if (not IsValid(a)) or a:Alive() then
- t[a] = nil
- end
- end
- end)
- end
- if CLIENT then
- surface.CreateFont( "kadabra_deathscreen_font1", {
- font = "QUARTZO", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
- extended = false,
- size = 32,
- weight = 500,
- } )
- surface.CreateFont( "kadabra_deathscreen_font2", {
- font = "Roboto Light", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
- extended = false,
- size = 24,
- weight = 500,
- } )
- local blur = Material("pp/blurscreen")
- local function DrawBlur(x,y,amount)
- local scrW, scrH = ScrW(), ScrH()
- surface.SetDrawColor(255, 255, 255)
- surface.SetMaterial(blur)
- for i = 1, 3 do
- blur:SetFloat("$blur", (i / 3) * (amount or 6))
- blur:Recompute()
- render.UpdateScreenEffectTexture()
- surface.DrawTexturedRect(x * -1, y * -1, scrW, scrH)
- end
- end
- local function kadabra_deathscreen_WithMedic()
- if LocalPlayer():Alive() and LocalPlayer():Health() > 0 then
- -- RunConsoleCommand("stopsound")
- hook.Remove("HUDPaint","kadabra_deathscreen")
- end
- local t = math.Round(LocalPlayer().cdeathscreen-CurTime())
- DrawBlur(0,0,8)
- draw.RoundedBox(0,0,0,ScrW(),ScrH(),Color(0,0,0,250))
- -- TEXT AU MILLIEU
- draw.SimpleTextOutlined("VOUS ÊTES DANS LE COMA, ATTENDEZ QU'UN MÉDECIN VOUS RÉANIME","kadabra_deathscreen_font1",ScrW()/2,ScrH()/2,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER,2,Color(0,0,0,255))
- local w, h = 128, 128
- surface.SetDrawColor(255,255,255,255)
- surface.SetMaterial(Material("kadabra_icon/kdicon_death.png"))
- surface.DrawTexturedRect(ScrW()/2-w/2,ScrH()/2-h/2-128,w,h)
- if LocalPlayer().sdeathscreen == 365 then
- draw.SimpleText("Vous êtes Staff du serveur. Appuyer sur ESPACE pour réapparaître maintenant","kadabra_deathscreen_font2",ScrW()/2,ScrH()-34,Color(255,255,255,255),TEXT_ALIGN_CENTER)
- else
- if t > 0 then
- draw.SimpleText("Vous pouvez réapparaitre dans "..t.." secondes","kadabra_deathscreen_font2",ScrW()/2,ScrH()-34,Color(255,255,255,255),TEXT_ALIGN_CENTER)
- else
- draw.SimpleText("Vous pouvez réapparaitre !","kadabra_deathscreen_font2",ScrW()/2,ScrH()-34,Color(255,255,255,255),TEXT_ALIGN_CENTER)
- end
- end
- end
- local function kadabra_deathscreen_WithoutMedic()
- if LocalPlayer():Alive() and LocalPlayer():Health() > 0 then
- -- RunConsoleCommand("stopsound")
- hook.Remove("HUDPaint","kadabra_deathscreen")
- end
- local t = math.Round(LocalPlayer().cdeathscreen-CurTime())
- DrawBlur(0,0,8)
- draw.RoundedBox(0,0,0,ScrW(),ScrH(),Color(0,0,0,250))
- -- TEXT AU MILLIEU
- draw.SimpleTextOutlined("VOUS ÊTES DANS LE COMA","kadabra_deathscreen_font1",ScrW()/2,ScrH()/2,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER,2,Color(0,0,0,255))
- local w, h = 128, 128
- surface.SetDrawColor(255,255,255,255)
- surface.SetMaterial(Material("kadabra_icon/kdicon_death.png"))
- surface.DrawTexturedRect(ScrW()/2-w/2,ScrH()/2-h/2-128,w,h)
- if LocalPlayer().sdeathscreen == 365 then
- draw.SimpleText("Vous êtes Staff du serveur. Appuyer sur ESPACE pour réapparaître maintenant","kadabra_deathscreen_font2",ScrW()/2,ScrH()-34,Color(255,255,255,255),TEXT_ALIGN_CENTER)
- else
- if t > 0 then
- draw.SimpleText("Vous pouvez réapparaitre dans "..t.." secondes","kadabra_deathscreen_font2",ScrW()/2,ScrH()-34,Color(255,255,255,255),TEXT_ALIGN_CENTER)
- else
- draw.SimpleText("Vous pouvez réapparaitre !","kadabra_deathscreen_font2",ScrW()/2,ScrH()-34,Color(255,255,255,255),TEXT_ALIGN_CENTER)
- end
- end
- end
- net.Receive("kadabra_deathscreen",function()
- local m = net.ReadBool()
- -- RunConsoleCommand("stopsound")
- sound.Add( {
- name = "kadabra_deathsound",
- channel = CHAN_STATIC,
- volume = 1.0,
- level = 80,
- pitch = 100,
- sound = noise
- } )
- LocalPlayer().sdeathscreen = net.ReadInt(9)
- timer.Simple(0.0001,function()
- if LocalPlayer().sdeathscreen == 0 then
- LocalPlayer().sdeathscreen = 365
- end
- LocalPlayer().cdeathscreen = CurTime()+LocalPlayer().sdeathscreen
- LocalPlayer():EmitSound("kadabra_deathsound")
- --surface.PlaySound( noise )
- if m then
- hook.Add("HUDPaint","kadabra_deathscreen",kadabra_deathscreen_WithMedic)
- else
- hook.Add("HUDPaint","kadabra_deathscreen",kadabra_deathscreen_WithoutMedic)
- end
- end)
- end)
- net.Receive("kadabra_deathscreen2",function()
- if IsValid(LocalPlayer()) then
- LocalPlayer():StopSound("kadabra_deathsound")
- end
- end)
- --hook.Remove("HUDShouldDraw","kadabra_deathscreen")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement