48 lines
1.4 KiB
Text
48 lines
1.4 KiB
Text
--@name awp
|
|
--@author Niko
|
|
--@server
|
|
|
|
|
|
|
|
|
|
chip():setPos(Vector(0))
|
|
local weapon = {
|
|
--main
|
|
base = "simple_css_scout",
|
|
model = "models/weapons/w_combine_sniper.mdl",
|
|
--stats
|
|
damage = 40,
|
|
delay = 3,
|
|
spread = 0,
|
|
force = 1000,
|
|
--sys
|
|
active = false
|
|
}
|
|
local holo = hologram.create(owner():getPos(),Angle(0),weapon.model)
|
|
holo:setNoDraw(true)
|
|
local attach = 5
|
|
hook.add("PlayerSwitchWeapon","",function(ply,old,new)
|
|
if ply == owner() then
|
|
weapon.active = weapon.base == new:getClass()
|
|
holo:setNoDraw(not weapon.active)
|
|
if weapon.active then
|
|
timer.simple(1,function()
|
|
try(function()
|
|
local pos,ang = owner():getAttachment(attach)
|
|
holo:setPos(pos+Vector(15,0,7):getRotated(ang))
|
|
holo:setAngles(Angle(ang[1]+170,ang[2],ang[3]+180))
|
|
holo:setParent(owner(),attach)
|
|
new:setMaterial("null")
|
|
end)
|
|
end)
|
|
end
|
|
end
|
|
end)
|
|
hook.add("EntityFireBullets","",function(ent,data)
|
|
if weapon.active and ent == owner() then
|
|
local pos = trace.line(data.Src,data.Src+Vector(data.Distance,0,0):getRotated(data.Dir:getAngle()),ent).HitPos
|
|
local pr = prop.create(pos,Angle(0),"models/props_phx/ww2bomb.mdl",true)
|
|
pr:setNoDraw(true)
|
|
pr:breakEnt()
|
|
end
|
|
end)
|