if (SERVER) then
AddCSLuaFile( "shared.lua" )
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
end
if ( CLIENT ) then
SWEP.Slot = 2
SWEP.SlotPos = 10
SWEP.IconLetter = "x"
SWEP.IconFont = "CSSelectIcons"
SWEP.BounceWeaponIcon = true
SWEP.DrawWeaponInfoBox = false
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = true
SWEP.ViewModelFOV = 75
SWEP.ViewModelFlip = false
SWEP.CSMuzzleFlashes = true
SWEP.SwayScale = 1.0
SWEP.BobScale = 1.0
SWEP.WepSelectIcon = surface.GetTextureID( "weapons/swep" )
--SWEP.SpeechBubbleLid = surface.GetTextureID( "gui/speech_lid" )
surface.CreateFont( "csd", ScreenScale( 60 ), 500, true, true, "CSSelectIcons" )
surface.CreateFont( "HalfLife2", ScreenScale( 60 ), 500, true, true, "HL2SelectIcons" )
end
SWEP.PrintName = "Multigun"
SWEP.Author = "Stoned"
SWEP.Contact = ""
SWEP.Purpose = "Control Props"
SWEP.Instructions = "Press Left to unown a prop | right to delete it!"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.ViewModel = "models/weapons/v_357.mdl"
SWEP.WorldModel = "models/weapons/w_357.mdl"
SWEP.Primary.Delay = 0.15
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
module( "UPS", package.seeall )
function SWEP:PrimaryAttack()
if CLIENT then return end
local trace1= {}
trace.start = self.Owner:GetShootPos()
trace.endpos = trace.start + (self.Owner:GetAimVector() * 500)
trace.mask = MASK_SOLID
trace.filter = self.Owner
local tr = util.TraceLine(trace)
if !tr.Entity then return false end
local ent = tr.Entity
if ent:IsValid() ~= true then return false end
if ent:GetClass() == "player" then return false end
if ent:GetClass() == "worldspawn" then return false end
if ent:GetClass() == "gf_bb_spawner" then return false end
if ent:GetClass() == "gf_playerspawn" then return false end
if ent:GetClass() == "func_brush" then return false end
local name = "Unknown" -- Default
local id = ent:UPSGetOwner()
if id == OWNERID_MAP then
name = "1"
elseif id == OWNERID_UPFORGRABS then
name = "2"
elseif id == OWNERID_DEFER then
name = "3"
else
name = nameFromID( id ) or name -- Using "or name" in case we get nil back
end
if name == self.Owner:Name() or self.Owner:IsSuperAdmin() then
self.Owner:EmitSound(Sound("weapons/357/357_spin1.wav"))
ent:UPSClearOwner()
self.Owner:PrintMessage( HUD_PRINTTALK, "Prop has been Cleared!" )
end
self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) -- View model animation
--self.Owner:MuzzleFlash() -- Crappy muzzle light
self.Owner:SetAnimation( PLAYER_ATTACK1 ) -- 3rd Person Animation
end
function SWEP:SecondaryAttack()
if CLIENT then return end
local trace = {}
trace.start = self.Owner:GetShootPos()
trace.endpos = trace2.start + (self.Owner:GetAimVector() * 500)
trace.mask = MASK_SOLID
trace.filter = self.Owner
local tr = util.TraceLine(trace)
if !tr.Entity then return false end
local ent = tr.Entity
if ent:IsValid() ~= true then return false end
if ent:GetClass() == "player" then return false end
if ent:GetClass() == "worldspawn" then return false end
if ent:GetClass() == "gf_bb_spawner" then return false end
if ent:GetClass() == "gf_playerspawn" then return false end
if ent:GetClass() == "func_brush" then return false end
local name = "Unknown" -- Default
local id = ent:UPSGetOwner()
if id == OWNERID_MAP then
name = "1"
elseif id == OWNERID_UPFORGRABS then
name = "2"
elseif id == OWNERID_DEFER then
name = "3"
else
name = nameFromID( id ) or name -- Using "or name" in case we get nil back
end
if name == self.Owner:Name() or name == "2" or self.Owner:IsSuperAdmin() then
self.Owner:EmitSound(Sound("ambient/energy/zap"..math.random(1,3)..".wav"))
ent:Remove()
end
self.Weapon:SendWeaponAnim( ACT_VM_SECONDARYATTACK ) -- View model animation
--self.Owner:MuzzleFlash() -- Crappy muzzle light
self.Owner:SetAnimation( PLAYER_ATTACK2 ) -- 3rd Person Animation
end