Great proggers!
This commit is contained in:
parent
fec4842bb9
commit
3900f1087f
|
@ -6,15 +6,51 @@ SWEP.Base = "weapon_base"
|
||||||
SWEP.PrintName = "Benny Weapon Handler"
|
SWEP.PrintName = "Benny Weapon Handler"
|
||||||
|
|
||||||
SWEP.ViewModel = "models/weapons/c_pistol.mdl"
|
SWEP.ViewModel = "models/weapons/c_pistol.mdl"
|
||||||
|
SWEP.ViewModelFOV = 10
|
||||||
SWEP.WorldModel = "models/weapons/w_pistol.mdl"
|
SWEP.WorldModel = "models/weapons/w_pistol.mdl"
|
||||||
|
|
||||||
|
SWEP.Primary.ClipSize = 0
|
||||||
|
SWEP.Primary.DefaultClip = 0
|
||||||
|
SWEP.Primary.Automatic = true
|
||||||
|
SWEP.Primary.Ammo = "none"
|
||||||
|
|
||||||
|
SWEP.Secondary.ClipSize = 0
|
||||||
|
SWEP.Secondary.DefaultClip = 0
|
||||||
|
SWEP.Secondary.Automatic = true
|
||||||
|
SWEP.Secondary.Ammo = "none"
|
||||||
|
|
||||||
function SWEP:SetupDataTables()
|
function SWEP:SetupDataTables()
|
||||||
self:NetworkVar( "Float", 0, "Aim" )
|
self:NetworkVar( "Float", 0, "Aim" )
|
||||||
|
self:NetworkVar( "Float", 1, "Delay1" )
|
||||||
|
self:NetworkVar( "Float", 2, "Delay2" )
|
||||||
|
self:NetworkVar( "String", 0, "Wep1" )
|
||||||
|
self:NetworkVar( "String", 1, "Wep2" )
|
||||||
|
|
||||||
|
self:NetworkVarNotify( "Wep1", self.OnVarChanged )
|
||||||
|
self:NetworkVarNotify( "Wep2", self.OnVarChanged )
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:OnVarChanged( name, old, new )
|
||||||
|
print( name, old, new )
|
||||||
|
if name == "Wep1" then
|
||||||
|
self.B_WepT1 = self:GetOwner():INV_Get()[new]
|
||||||
|
self.B_ClassT1 = WEAPONS[self.B_WepT1.Class]
|
||||||
|
elseif name == "Wep2" then
|
||||||
|
self.B_WepT2 = self:GetOwner():INV_Get()[new]
|
||||||
|
self.B_ClassT2 = WEAPONS[self.B_WepT1.Class]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:PrimaryAttack()
|
function SWEP:PrimaryAttack()
|
||||||
|
if self:GetDelay1() > CurTime() then
|
||||||
|
return
|
||||||
|
end
|
||||||
if self:Clip1() == 0 then
|
if self:Clip1() == 0 then
|
||||||
self:EmitSound( "benny/weapons/common/06-13.ogg", 80, 100, 1, CHAN_STATIC )
|
self:EmitSound( "benny/weapons/common/06-13.ogg", 80, 100, 1, CHAN_STATIC )
|
||||||
|
self:SetDelay1( CurTime() + 0.2 )
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if !self:B_Wep1() then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -24,16 +60,47 @@ function SWEP:PrimaryAttack()
|
||||||
|
|
||||||
self:EmitSound( "benny/weapons/1911/0".. math.random(1,3) ..".ogg", 110, 100, 1, CHAN_STATIC )
|
self:EmitSound( "benny/weapons/1911/0".. math.random(1,3) ..".ogg", 110, 100, 1, CHAN_STATIC )
|
||||||
|
|
||||||
self:SetClip1( self:Clip1() - 1 )
|
self:B_Ammo1( self:Clip1() - 1 )
|
||||||
|
self:SetDelay1( CurTime() + 0.2 )
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- BENNY shit
|
||||||
|
function SWEP:B_Wep1()
|
||||||
|
return self:GetOwner():INV_Get()[self:GetWep1()]
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:B_Wep2()
|
||||||
|
return self:GetOwner():INV_Get()[self:GetWep2()]
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:B_Ammo1( value )
|
||||||
|
self:SetClip1( value )
|
||||||
|
self:B_Wep1().Ammo = value
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:B_Ammo2( value )
|
||||||
|
self:SetClip2( value )
|
||||||
|
self:B_Wep2().Ammo = value
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:B_MaxAmmo1( value )
|
||||||
|
self:SetClip1( value )
|
||||||
|
self:B_Wep1().Ammo = value
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:B_Class1()
|
||||||
|
return WEAPONS[ self:B_Wep1().Class ]
|
||||||
|
end
|
||||||
|
|
||||||
function SWEP:SecondaryAttack()
|
function SWEP:SecondaryAttack()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:Reload()
|
function SWEP:Reload()
|
||||||
self:SetClip1( 17 )
|
if self:B_Wep1() then
|
||||||
|
self:B_Ammo1( self:B_Class1().Ammo )
|
||||||
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -303,7 +303,7 @@ hook.Add( "CalcView", "MyCalcView", function( ply, pos, ang, fov )
|
||||||
end
|
end
|
||||||
|
|
||||||
-- PROTO: Add correct benny weapon check
|
-- PROTO: Add correct benny weapon check
|
||||||
if IsValid(ply:GetActiveWeapon()) and ply:GetActiveWeapon():GetAim() > 0 then
|
if true or IsValid(ply:GetActiveWeapon()) and ply:GetActiveWeapon():GetAim() > 0 then
|
||||||
view.drawviewer = true
|
view.drawviewer = true
|
||||||
view.origin, view.angles, view.fov = bennyfp( view.origin, view.angles, view.fov )
|
view.origin, view.angles, view.fov = bennyfp( view.origin, view.angles, view.fov )
|
||||||
end
|
end
|
||||||
|
|
|
@ -140,6 +140,11 @@ end
|
||||||
local color_caption = Color( 0, 0, 0, 127 )
|
local color_caption = Color( 0, 0, 0, 127 )
|
||||||
local mat_grad = Material( "benny/hud/grad.png", "mips smooth" )
|
local mat_grad = Material( "benny/hud/grad.png", "mips smooth" )
|
||||||
|
|
||||||
|
local wep1 = {
|
||||||
|
Name = "COBRA .45",
|
||||||
|
Firemode = "SEMI",
|
||||||
|
}
|
||||||
|
|
||||||
hook.Add( "HUDPaint", "Benny_HUDPaint", function()
|
hook.Add( "HUDPaint", "Benny_HUDPaint", function()
|
||||||
local sw, sh = ScrW(), ScrH()
|
local sw, sh = ScrW(), ScrH()
|
||||||
local b = ss(20)
|
local b = ss(20)
|
||||||
|
@ -185,8 +190,42 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
|
||||||
end
|
end
|
||||||
|
|
||||||
do -- Weapon
|
do -- Weapon
|
||||||
|
local inv = p:INV_Get()
|
||||||
|
local wep1 = wep.B_WepT1
|
||||||
|
local wep1c = wep.B_ClassT1
|
||||||
|
local wep2 = wep.B_WepT2
|
||||||
|
local wep2c = wep.B_ClassT2
|
||||||
|
|
||||||
|
do
|
||||||
|
local ox, oy = 170, 24
|
||||||
|
-- Debug
|
||||||
|
surface.SetFont( "Benny_12" )
|
||||||
|
surface.SetTextColor( scheme["fg"] )
|
||||||
|
|
||||||
|
surface.SetTextPos( ss(ox), ss(oy) )
|
||||||
|
surface.DrawText( "Wep1: " .. wep:GetWep1() )
|
||||||
|
|
||||||
|
local num = 1
|
||||||
|
if wep1 then for i, v in pairs( wep1 ) do
|
||||||
|
surface.SetTextPos( ss(ox+16), ss(oy+10*num) )
|
||||||
|
surface.DrawText( i .. ": " .. (v or "[no " .. i .. "]") )
|
||||||
|
num = num + 1
|
||||||
|
end end
|
||||||
|
|
||||||
|
surface.SetTextPos( ss(ox+128), ss(oy) )
|
||||||
|
surface.DrawText( "Wep2: " .. wep:GetWep2() )
|
||||||
|
|
||||||
|
if wep2 then for i, v in pairs( wep2 ) do
|
||||||
|
surface.SetTextPos( ss(ox+128+16), ss(oy+10*num) )
|
||||||
|
surface.DrawText( i .. ": " .. (v or "[no " .. i .. "]") )
|
||||||
|
num = num + 1
|
||||||
|
end end
|
||||||
|
end
|
||||||
|
|
||||||
local w, h = 150, 100
|
local w, h = 150, 100
|
||||||
local BOXHEIGHT = 44
|
local BOXHEIGHT = 44
|
||||||
|
|
||||||
|
if wep1 then
|
||||||
-- BG
|
-- BG
|
||||||
surface.SetDrawColor( scheme["bg"] )
|
surface.SetDrawColor( scheme["bg"] )
|
||||||
surface.DrawRect( sw - b - ss(w), sh - b - ss(BOXHEIGHT), ss(w), ss(BOXHEIGHT) )
|
surface.DrawRect( sw - b - ss(w), sh - b - ss(BOXHEIGHT), ss(w), ss(BOXHEIGHT) )
|
||||||
|
@ -198,7 +237,7 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
|
||||||
|
|
||||||
surface.SetTextColor( scheme["bg"] )
|
surface.SetTextColor( scheme["bg"] )
|
||||||
surface.SetTextPos( sw - b - ss(w-6), sh - b - ss(BOXHEIGHT-3) )
|
surface.SetTextPos( sw - b - ss(w-6), sh - b - ss(BOXHEIGHT-3) )
|
||||||
surface.DrawText( "GLOCK-17" )
|
surface.DrawText( wep1c.Name or "???" )
|
||||||
|
|
||||||
surface.SetDrawColor( scheme["fg"] )
|
surface.SetDrawColor( scheme["fg"] )
|
||||||
surface.DrawRect( sw - b - ss(w-4), sh - b + ss(16) - ss(BOXHEIGHT-4), ss(29), ss(10) )
|
surface.DrawRect( sw - b - ss(w-4), sh - b + ss(16) - ss(BOXHEIGHT-4), ss(29), ss(10) )
|
||||||
|
@ -206,7 +245,7 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
|
||||||
surface.SetFont( "Benny_12" )
|
surface.SetFont( "Benny_12" )
|
||||||
surface.SetTextColor( scheme["bg"] )
|
surface.SetTextColor( scheme["bg"] )
|
||||||
surface.SetTextPos( sw - b - ss(w-7), sh - b + ss(16) - ss(BOXHEIGHT-4) )
|
surface.SetTextPos( sw - b - ss(w-7), sh - b + ss(16) - ss(BOXHEIGHT-4) )
|
||||||
surface.DrawText( "3BST" )
|
surface.DrawText( wep1c.Firemode or "???" )
|
||||||
|
|
||||||
surface.SetFont( "Benny_12" )
|
surface.SetFont( "Benny_12" )
|
||||||
local text = wep:Clip1() .. " - MAG 3"
|
local text = wep:Clip1() .. " - MAG 3"
|
||||||
|
@ -215,7 +254,7 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
|
||||||
surface.SetTextPos( sw - b - ss(4) - tw, sh - b - ss(24) )
|
surface.SetTextPos( sw - b - ss(4) - tw, sh - b - ss(24) )
|
||||||
surface.DrawText( text )
|
surface.DrawText( text )
|
||||||
|
|
||||||
for i=1, 17 do
|
for i=1, math.max( wep:Clip1(), wep.B_ClassT1.Ammo ) do
|
||||||
surface.SetDrawColor( scheme["fg"] )
|
surface.SetDrawColor( scheme["fg"] )
|
||||||
surface.DrawOutlinedRect( sw - b - ss(3+4) - ( ss(5) * (i-1) ), sh - b - ss(8+4), ss(3), ss(8), ss(0.5) )
|
surface.DrawOutlinedRect( sw - b - ss(3+4) - ( ss(5) * (i-1) ), sh - b - ss(8+4), ss(3), ss(8), ss(0.5) )
|
||||||
if i <= wep:Clip1() then
|
if i <= wep:Clip1() then
|
||||||
|
@ -223,6 +262,7 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
do -- Captions
|
do -- Captions
|
||||||
local space = b
|
local space = b
|
||||||
|
|
|
@ -5,3 +5,52 @@ function GM:PlayerSpawn( ply )
|
||||||
ply:SetPlayerColor( Vector( 0.275, 0.2, 0.145 ) )
|
ply:SetPlayerColor( Vector( 0.275, 0.2, 0.145 ) )
|
||||||
ply:Give( "benny" )
|
ply:Give( "benny" )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if SERVER then
|
||||||
|
util.AddNetworkString( "benny_sendinv" )
|
||||||
|
end
|
||||||
|
|
||||||
|
concommand.Add("benny_debug_give", function(ply, cmd, args)
|
||||||
|
assert(SERVER, "not server")
|
||||||
|
-- PROTO: Check for the correct 'benny' weapon.
|
||||||
|
local ply = Entity( args[1] )
|
||||||
|
local wep = ply:GetActiveWeapon()
|
||||||
|
local inv = ply:INV_Get()
|
||||||
|
local str = UUID_generate()
|
||||||
|
|
||||||
|
local class = WEAPONS[args[3]]
|
||||||
|
|
||||||
|
local item = {
|
||||||
|
Class = args[3],
|
||||||
|
Ammo = class.Ammo,
|
||||||
|
}
|
||||||
|
|
||||||
|
inv[str] = item
|
||||||
|
|
||||||
|
-- PROTO: WriteTable.
|
||||||
|
net.Start( "benny_sendinv" )
|
||||||
|
net.WriteString( str )
|
||||||
|
net.WriteTable( item )
|
||||||
|
net.Send( ply )
|
||||||
|
|
||||||
|
local slot = tonumber(args[2])
|
||||||
|
|
||||||
|
if slot == 1 then
|
||||||
|
wep:SetWep1( str )
|
||||||
|
wep:SetClip1( class.Ammo )
|
||||||
|
elseif slot == 2 then
|
||||||
|
wep:SetWep2( str )
|
||||||
|
wep:SetClip2( class.Ammo )
|
||||||
|
else
|
||||||
|
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
if CLIENT then
|
||||||
|
net.Receive( "benny_sendinv", function( len, ply )
|
||||||
|
assert(CLIENT, "not client")
|
||||||
|
local ply = LocalPlayer()
|
||||||
|
assert(IsValid( ply ), "ply is invalid?")
|
||||||
|
ply:INV_Get()[net.ReadString()] = net.ReadTable()
|
||||||
|
end)
|
||||||
|
end
|
|
@ -1,47 +1,97 @@
|
||||||
|
|
||||||
WEAPONS = {}
|
WEAPONS = {}
|
||||||
|
|
||||||
|
local wep = {}
|
||||||
|
WEAPONS["1911"] = wep
|
||||||
|
wep.Name = "COBRA .45"
|
||||||
|
wep.Description = "Hits hard. They don't make them like they used to! Low capacity."
|
||||||
|
|
||||||
|
wep.WModel = "models/weapons/w_pist_usp.mdl"
|
||||||
|
|
||||||
|
wep.Delay = (60/300)
|
||||||
|
wep.Ammo = 8
|
||||||
|
wep.Damage = 30
|
||||||
|
|
||||||
|
local wep = {}
|
||||||
|
WEAPONS["usp"] = wep
|
||||||
|
wep.Name = "USP .45"
|
||||||
|
wep.Description = "It works for hardasses around the world, it works for you. Higher capacity."
|
||||||
|
|
||||||
|
wep.WModel = "models/weapons/w_pist_usp.mdl"
|
||||||
|
|
||||||
|
wep.Delay = (60/300)
|
||||||
|
wep.Ammo = 12
|
||||||
|
wep.Damage = 30
|
||||||
|
|
||||||
local wep = {}
|
local wep = {}
|
||||||
WEAPONS["glock"] = wep
|
WEAPONS["glock"] = wep
|
||||||
wep.Name = "GLOCK-18"
|
wep.Name = "GLOCK-18"
|
||||||
wep.WModel = "models/weapons/w_pist_glock18.mdl"
|
|
||||||
wep.Description = "Superb precision but poor capacity."
|
wep.Description = "Superb precision but poor capacity."
|
||||||
|
|
||||||
|
wep.WModel = "models/weapons/w_pist_glock18.mdl"
|
||||||
|
|
||||||
|
wep.Delay = (60/800)
|
||||||
wep.Ammo = 17
|
wep.Ammo = 17
|
||||||
wep.Damage = 18
|
wep.Damage = 18
|
||||||
|
|
||||||
local wep = {}
|
local wep = {}
|
||||||
WEAPONS["python"] = wep
|
WEAPONS["nambu"] = wep
|
||||||
wep.Name = "PYTHON"
|
wep.Name = "NAMBU .38"
|
||||||
wep.Description = "Superb precision but poor capacity."
|
wep.Description = "Eastern revolver that hits as much as it costs. Low capacity."
|
||||||
|
|
||||||
|
wep.Delay = (60/180)
|
||||||
wep.Ammo = 6
|
wep.Ammo = 6
|
||||||
wep.Damage = 36
|
wep.Damage = 26
|
||||||
|
|
||||||
|
local wep = {}
|
||||||
|
WEAPONS["anaconda"] = wep
|
||||||
|
wep.Name = "ANACONDA"
|
||||||
|
wep.Description = "Precise and kicks like a mule, but low capacity."
|
||||||
|
|
||||||
|
wep.Delay = (60/180)
|
||||||
|
wep.Ammo = 6
|
||||||
|
wep.Damage = 40
|
||||||
|
|
||||||
local wep = {}
|
local wep = {}
|
||||||
WEAPONS["tmp"] = wep
|
WEAPONS["tmp"] = wep
|
||||||
wep.Name = "TMP"
|
wep.Name = "TMP"
|
||||||
wep.Description = "Precise."
|
wep.Description = "Precise."
|
||||||
|
wep.Delay = (60/800)
|
||||||
wep.Ammo = 15
|
wep.Ammo = 15
|
||||||
|
wep.Damage = 18
|
||||||
|
|
||||||
local wep = {}
|
local wep = {}
|
||||||
WEAPONS["mp7"] = wep
|
WEAPONS["mp7"] = wep
|
||||||
wep.Name = "MP7"
|
wep.Name = "MP7"
|
||||||
wep.Description = "Small, pistol-sized, and simple."
|
wep.Description = "Small, pistol-sized, and simple."
|
||||||
|
|
||||||
|
wep.Delay = (60/700)
|
||||||
wep.Ammo = 15
|
wep.Ammo = 15
|
||||||
|
wep.Damage = 16
|
||||||
|
|
||||||
local wep = {}
|
local wep = {}
|
||||||
WEAPONS["mp5k"] = wep
|
WEAPONS["mp5k"] = wep
|
||||||
wep.Name = "MP5K"
|
wep.Name = "MP5K"
|
||||||
wep.Description = "Quality manufacturing, but cumbersome."
|
wep.Description = "Quality manufacturing, but cumbersome."
|
||||||
|
|
||||||
|
wep.Delay = (60/700)
|
||||||
wep.Ammo = 15
|
wep.Ammo = 15
|
||||||
|
wep.Damage = 18
|
||||||
|
|
||||||
local wep = {}
|
local wep = {}
|
||||||
WEAPONS["mac11"] = wep
|
WEAPONS["mac11"] = wep
|
||||||
wep.Name = "MAC-11"
|
wep.Name = "MAC-11"
|
||||||
wep.Description = "More fit for combat in a phone booth."
|
wep.Description = "More fit for combat in a phone booth."
|
||||||
wep.Ammo = 15
|
|
||||||
|
wep.Delay = (60/800)
|
||||||
|
wep.Ammo = 16
|
||||||
|
wep.Damage = 16
|
||||||
|
|
||||||
local wep = {}
|
local wep = {}
|
||||||
WEAPONS["bizon"] = wep
|
WEAPONS["bizon"] = wep
|
||||||
wep.Name = "BIZON"
|
wep.Name = "BIZON"
|
||||||
wep.Description = "Unwieldy bullet storm."
|
wep.Description = "Unwieldy bullet storm."
|
||||||
|
|
||||||
|
wep.Delay = (60/600)
|
||||||
wep.Ammo = 40
|
wep.Ammo = 40
|
||||||
|
wep.Damage = 16
|
Loading…
Reference in New Issue