Advertisement
Exho

Untitled

Oct 1st, 2014
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1.  
  2. local Dropped = {}
  3. if SERVER then
  4. local function GunDropHandler(ply, att, DmgInfo)
  5. local wep = ply:GetActiveWeapon()
  6. if not IsValid(wep) then print("NOT VALID") return end
  7.  
  8. local ammoleft = wep:Clip1()
  9.  
  10. print(ammoleft)
  11. newwep = ents.Create(wep:GetClass())
  12. newwep:SetPos(ply:GetPos() + Vector(0, 0, 90))
  13. newwep:SetClip1(ammoleft)
  14. newwep:Spawn()
  15. newwep:SetNWBool("DeathDropped", true)
  16. table.insert(Dropped, newwep)
  17. end
  18.  
  19. local function GunResetter( wep )
  20. wep:SetNWBool("DeathDropped", false)
  21. end
  22.  
  23. hook.Add( "DoPlayerDeath", "Testtest", GunDropHandler )
  24. hook.Add("WeaponEquip", "DADSASDA", GunResetter)
  25. end
  26.  
  27.  
  28. if CLIENT then
  29. surface.CreateFont( "GunTitle2", {
  30. font = "Arial",
  31. size = 50,
  32. weight = 500,
  33. antialias = true,
  34. } )
  35. local ply = LocalPlayer()
  36. hook.Add( "PostDrawOpaqueRenderables", "DrawTheWeaponDrop", function()
  37. for k, v in pairs(Dropped) do
  38. local gun = v
  39.  
  40. local pos = gun:GetPos() + Vector(0,0,90)
  41. local eyeang = LocalPlayer():EyeAngles().y - 90
  42. local ang = Angle( 0, eyeang, 90 )
  43.  
  44. -- Start drawing
  45. cam.Start3D2D(pos, ang, 0.1)
  46. surface.SetDrawColor( 0, 0, 0, 150) -- A near-transparent black works nicely
  47. surface.DrawRect(-200 , 200, 250, 330 ) -- Base is used in the bouncing effect
  48. surface.SetDrawColor( 255,255, 255, 255)
  49. surface.DrawLine( -150, 20, 0, 20 ) -- The line under the gun name
  50.  
  51. draw.DrawText( "Weapon", "GunTitle2", -75, 50 , Color(255,255,255,255), TEXT_ALIGN_CENTER )
  52.  
  53. cam.End3D2D()
  54. end
  55. end)
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement