simplify this a lot more
This commit is contained in:
parent
6b6438e05f
commit
b25ce7ce1e
|
@ -7,18 +7,15 @@ end
|
||||||
|
|
||||||
concommand.Add("benny_debug_give", function(ply, cmd, args)
|
concommand.Add("benny_debug_give", function(ply, cmd, args)
|
||||||
assert(SERVER, "not server")
|
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 inv = ply:INV_Get()
|
||||||
local str = UUID_generate()
|
local str = UUID_generate()
|
||||||
|
|
||||||
local class = WEAPONS[args[3]]
|
local class = WEAPONS[args[1]]
|
||||||
|
|
||||||
assert(class, "Invalid Class.")
|
assert(class, "Invalid Class.")
|
||||||
|
|
||||||
local item = {
|
local item = {
|
||||||
Class = args[3],
|
Class = args[1],
|
||||||
Loaded = 1,
|
Loaded = 1,
|
||||||
Ammo1 = class.Ammo,
|
Ammo1 = class.Ammo,
|
||||||
Ammo2 = class.Ammo,
|
Ammo2 = class.Ammo,
|
||||||
|
@ -33,21 +30,17 @@ concommand.Add("benny_debug_give", function(ply, cmd, args)
|
||||||
net.WriteString( str )
|
net.WriteString( str )
|
||||||
net.WriteTable( item )
|
net.WriteTable( item )
|
||||||
net.Send( ply )
|
net.Send( ply )
|
||||||
|
end,
|
||||||
local slot = tonumber(args[2])
|
function(cmd, args)
|
||||||
|
args = string.Trim(args:lower())
|
||||||
if slot == 1 then
|
local meow = {}
|
||||||
wep:SetWep1( str )
|
for i, v in SortedPairs( WEAPONS ) do
|
||||||
wep:SetWep1Clip( item.Loaded )
|
if string.lower(i):find(args) then
|
||||||
wep:SetClip1( item[ "Ammo" .. item.Loaded ] )
|
table.insert( meow, cmd .. " " .. i )
|
||||||
elseif slot == 2 then
|
end
|
||||||
wep:SetWep2( str )
|
|
||||||
wep:SetWep2Clip( item.Loaded )
|
|
||||||
wep:SetClip2( item[ "Ammo" .. item.Loaded ] )
|
|
||||||
else
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end)
|
return meow
|
||||||
|
end, "arg 1: player ent index, arg 2: classname")
|
||||||
|
|
||||||
-- PROTO: Move this all into weapon code.
|
-- PROTO: Move this all into weapon code.
|
||||||
concommand.Add("benny_inv_equip", function( ply, cmd, args )
|
concommand.Add("benny_inv_equip", function( ply, cmd, args )
|
||||||
|
@ -203,7 +196,7 @@ if CLIENT then
|
||||||
|
|
||||||
-- PROTO: These functions don't need to be remade over and over like this.
|
-- PROTO: These functions don't need to be remade over and over like this.
|
||||||
function button:DoClick()
|
function button:DoClick()
|
||||||
RunConsoleCommand( "benny_debug_give", LocalPlayer():EntIndex(), 0, New.ClassName )
|
RunConsoleCommand( "benny_debug_give", New.ClassName )
|
||||||
end
|
end
|
||||||
|
|
||||||
function button:DoRightClick()
|
function button:DoRightClick()
|
||||||
|
|
Loading…
Reference in New Issue