Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.11 KB | None | 0 0
  1. local deathscreen_admin = {
  2. ["superadmin"] = true,
  3. ["admin"] = true,
  4. ["moderateur"] = true,
  5. ["moderateur-test"] = true
  6. }
  7.  
  8. local deathscreen_premium = {
  9. ["premium"] = true
  10. }
  11.  
  12. local deathscreen_time = {
  13. 80,
  14. 40
  15. }
  16.  
  17. local noise = Sound("kadabra_sound/kdsound_deathsong.wav")
  18.  
  19. if SERVER then
  20.  
  21. local t = {}
  22.  
  23. -- resource.AddFile("resource/fonts/quartzo_bold_font.ttf")
  24. -- resource.AddFile("resource/fonts/Roboto-Light.ttf")
  25. -- resource.AddFile("materials/kadabra_deathscreen/kdicon_death.png")
  26. -- resource.AddFile("sound/kadabra_sound/testsong.wav")
  27. resource.AddFile("sound/kadabra_sound/kdsound_deathsong.wav")
  28.  
  29. util.AddNetworkString("kadabra_deathscreen")
  30. util.AddNetworkString("kadabra_deathscreen2")
  31.  
  32. local function deathscreen_loadconfig()
  33.  
  34. deathscreen_jobsmedic = {
  35. [TEAM_MEDECIN] = true,
  36. }
  37.  
  38. end
  39. hook.Add("OnGamemodeLoaded","deathscreen_loadconfig",deathscreen_loadconfig)
  40.  
  41. local function IfMedicInCity()
  42.  
  43. local t = false
  44.  
  45. for a ,b in pairs(player.GetAll()) do
  46.  
  47. if deathscreen_jobsmedic[b:Team()] then
  48.  
  49. t = true
  50. break
  51.  
  52. end
  53.  
  54. end
  55.  
  56. return t
  57.  
  58. end
  59.  
  60. hook.Add("PlayerDeathSound","kadabra_deathscreen_deathsound",function()
  61.  
  62. return true
  63.  
  64. end)
  65.  
  66.  
  67. local function kadabra_deathscreen_Death(ply)
  68.  
  69. net.Start("kadabra_deathscreen")
  70.  
  71. local c
  72.  
  73. if IfMedicInCity() then
  74. net.WriteBool(true)
  75. c = deathscreen_time[1]
  76.  
  77. else
  78.  
  79. net.WriteBool(false)
  80. c = deathscreen_time[2]
  81.  
  82. end
  83.  
  84. if deathscreen_premium[ply:GetUserGroup()] then
  85.  
  86. c = c/2
  87.  
  88. end
  89.  
  90. if deathscreen_admin[ply:GetUserGroup()] then
  91.  
  92. c = 0
  93.  
  94. end
  95.  
  96. if c > 0 then
  97.  
  98. t[ply] = CurTime()+c
  99.  
  100. end
  101.  
  102. c = math.ceil(c)
  103.  
  104. net.WriteInt(c,9)
  105.  
  106. net.Send(ply)
  107.  
  108. return true
  109.  
  110.  
  111. end
  112. hook.Add("PlayerDeath","kadabra_deathscreen_Death", kadabra_deathscreen_Death)
  113.  
  114. hook.Add("PlayerDeathThink","kadabra_deathscreen_DeathThink",function(ply)
  115.  
  116. if t[ply] == nil then
  117. if ( ply:IsBot() || ply:KeyPressed( IN_ATTACK ) || ply:KeyPressed( IN_ATTACK2 ) || ply:KeyPressed( IN_JUMP ) ) then
  118.  
  119. ply:Spawn()
  120.  
  121. end
  122. else
  123. return false
  124. end
  125.  
  126. end)
  127.  
  128. hook.Add("PlayerSpawn","kadabra_deathscreen_resetsound",function(ply)
  129.  
  130. net.Start("kadabra_deathscreen2")
  131. net.Send(ply)
  132.  
  133. end)
  134.  
  135. hook.Add("Think","kadabra_deathscreen_timer",function()
  136.  
  137. for a, b in pairs(t) do
  138.  
  139. if CurTime() >= b then
  140.  
  141. t[a] = nil
  142.  
  143. end
  144.  
  145. if (not IsValid(a)) or a:Alive() then
  146.  
  147. t[a] = nil
  148.  
  149. end
  150.  
  151. end
  152.  
  153. end)
  154.  
  155. end
  156.  
  157. if CLIENT then
  158.  
  159. surface.CreateFont( "kadabra_deathscreen_font1", {
  160. font = "QUARTZO", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
  161. extended = false,
  162. size = 32,
  163. weight = 500,
  164. } )
  165.  
  166. surface.CreateFont( "kadabra_deathscreen_font2", {
  167. font = "Roboto Light", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
  168. extended = false,
  169. size = 24,
  170. weight = 500,
  171. } )
  172.  
  173. local blur = Material("pp/blurscreen")
  174. local function DrawBlur(x,y,amount)
  175. local scrW, scrH = ScrW(), ScrH()
  176. surface.SetDrawColor(255, 255, 255)
  177. surface.SetMaterial(blur)
  178. for i = 1, 3 do
  179. blur:SetFloat("$blur", (i / 3) * (amount or 6))
  180. blur:Recompute()
  181. render.UpdateScreenEffectTexture()
  182. surface.DrawTexturedRect(x * -1, y * -1, scrW, scrH)
  183. end
  184. end
  185.  
  186. local function kadabra_deathscreen_WithMedic()
  187.  
  188. if LocalPlayer():Alive() and LocalPlayer():Health() > 0 then
  189. -- RunConsoleCommand("stopsound")
  190. hook.Remove("HUDPaint","kadabra_deathscreen")
  191. end
  192.  
  193. local t = math.Round(LocalPlayer().cdeathscreen-CurTime())
  194.  
  195. DrawBlur(0,0,8)
  196. draw.RoundedBox(0,0,0,ScrW(),ScrH(),Color(0,0,0,250))
  197.  
  198. -- TEXT AU MILLIEU
  199. 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))
  200.  
  201. local w, h = 128, 128
  202.  
  203. surface.SetDrawColor(255,255,255,255)
  204. surface.SetMaterial(Material("kadabra_icon/kdicon_death.png"))
  205. surface.DrawTexturedRect(ScrW()/2-w/2,ScrH()/2-h/2-128,w,h)
  206.  
  207. if LocalPlayer().sdeathscreen == 365 then
  208.  
  209. 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)
  210.  
  211. else
  212.  
  213. if t > 0 then
  214.  
  215. draw.SimpleText("Vous pouvez réapparaitre dans "..t.." secondes","kadabra_deathscreen_font2",ScrW()/2,ScrH()-34,Color(255,255,255,255),TEXT_ALIGN_CENTER)
  216.  
  217. else
  218.  
  219. draw.SimpleText("Vous pouvez réapparaitre !","kadabra_deathscreen_font2",ScrW()/2,ScrH()-34,Color(255,255,255,255),TEXT_ALIGN_CENTER)
  220.  
  221. end
  222. end
  223.  
  224. end
  225.  
  226. local function kadabra_deathscreen_WithoutMedic()
  227.  
  228. if LocalPlayer():Alive() and LocalPlayer():Health() > 0 then
  229. -- RunConsoleCommand("stopsound")
  230. hook.Remove("HUDPaint","kadabra_deathscreen")
  231. end
  232.  
  233. local t = math.Round(LocalPlayer().cdeathscreen-CurTime())
  234.  
  235. DrawBlur(0,0,8)
  236. draw.RoundedBox(0,0,0,ScrW(),ScrH(),Color(0,0,0,250))
  237.  
  238. -- TEXT AU MILLIEU
  239. 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))
  240.  
  241. local w, h = 128, 128
  242.  
  243. surface.SetDrawColor(255,255,255,255)
  244. surface.SetMaterial(Material("kadabra_icon/kdicon_death.png"))
  245. surface.DrawTexturedRect(ScrW()/2-w/2,ScrH()/2-h/2-128,w,h)
  246.  
  247. if LocalPlayer().sdeathscreen == 365 then
  248.  
  249. 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)
  250.  
  251. else
  252.  
  253. if t > 0 then
  254.  
  255. draw.SimpleText("Vous pouvez réapparaitre dans "..t.." secondes","kadabra_deathscreen_font2",ScrW()/2,ScrH()-34,Color(255,255,255,255),TEXT_ALIGN_CENTER)
  256.  
  257. else
  258.  
  259. draw.SimpleText("Vous pouvez réapparaitre !","kadabra_deathscreen_font2",ScrW()/2,ScrH()-34,Color(255,255,255,255),TEXT_ALIGN_CENTER)
  260.  
  261. end
  262.  
  263. end
  264.  
  265. end
  266.  
  267.  
  268.  
  269. net.Receive("kadabra_deathscreen",function()
  270.  
  271. local m = net.ReadBool()
  272. -- RunConsoleCommand("stopsound")
  273.  
  274.  
  275. sound.Add( {
  276. name = "kadabra_deathsound",
  277. channel = CHAN_STATIC,
  278. volume = 1.0,
  279. level = 80,
  280. pitch = 100,
  281. sound = noise
  282. } )
  283.  
  284. LocalPlayer().sdeathscreen = net.ReadInt(9)
  285. timer.Simple(0.0001,function()
  286. if LocalPlayer().sdeathscreen == 0 then
  287. LocalPlayer().sdeathscreen = 365
  288. end
  289.  
  290. LocalPlayer().cdeathscreen = CurTime()+LocalPlayer().sdeathscreen
  291.  
  292. LocalPlayer():EmitSound("kadabra_deathsound")
  293.  
  294. --surface.PlaySound( noise )
  295.  
  296. if m then
  297.  
  298. hook.Add("HUDPaint","kadabra_deathscreen",kadabra_deathscreen_WithMedic)
  299.  
  300. else
  301.  
  302. hook.Add("HUDPaint","kadabra_deathscreen",kadabra_deathscreen_WithoutMedic)
  303.  
  304. end
  305. end)
  306.  
  307. end)
  308.  
  309. net.Receive("kadabra_deathscreen2",function()
  310.  
  311. if IsValid(LocalPlayer()) then
  312.  
  313. LocalPlayer():StopSound("kadabra_deathsound")
  314.  
  315. end
  316.  
  317. end)
  318.  
  319. --hook.Remove("HUDShouldDraw","kadabra_deathscreen")
  320.  
  321.  
  322.  
  323. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement