Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Dropped = {}
- if SERVER then
- local function GunDropHandler(ply, att, DmgInfo)
- local wep = ply:GetActiveWeapon()
- if not IsValid(wep) then print("NOT VALID") return end
- local ammoleft = wep:Clip1()
- print(ammoleft)
- newwep = ents.Create(wep:GetClass())
- newwep:SetPos(ply:GetPos() + Vector(0, 0, 90))
- newwep:SetClip1(ammoleft)
- newwep:Spawn()
- newwep:SetNWBool("DeathDropped", true)
- table.insert(Dropped, newwep)
- end
- local function GunResetter( wep )
- wep:SetNWBool("DeathDropped", false)
- end
- hook.Add( "DoPlayerDeath", "Testtest", GunDropHandler )
- hook.Add("WeaponEquip", "DADSASDA", GunResetter)
- end
- if CLIENT then
- surface.CreateFont( "GunTitle2", {
- font = "Arial",
- size = 50,
- weight = 500,
- antialias = true,
- } )
- local ply = LocalPlayer()
- hook.Add( "PostDrawOpaqueRenderables", "DrawTheWeaponDrop", function()
- for k, v in pairs(Dropped) do
- local gun = v
- local pos = gun:GetPos() + Vector(0,0,90)
- local eyeang = LocalPlayer():EyeAngles().y - 90
- local ang = Angle( 0, eyeang, 90 )
- -- Start drawing
- cam.Start3D2D(pos, ang, 0.1)
- surface.SetDrawColor( 0, 0, 0, 150) -- A near-transparent black works nicely
- surface.DrawRect(-200 , 200, 250, 330 ) -- Base is used in the bouncing effect
- surface.SetDrawColor( 255,255, 255, 255)
- surface.DrawLine( -150, 20, 0, 20 ) -- The line under the gun name
- draw.DrawText( "Weapon", "GunTitle2", -75, 50 , Color(255,255,255,255), TEXT_ALIGN_CENTER )
- cam.End3D2D()
- end
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement