Hello guys, i tried to make a simple swep for derp inventory addon, but i don't know how to make swep at all. I never done it before.
I remade derp inventory and added a concommand to pickup entities.
When i tried pickup nothing happens.
I tried to make this:
[CODE]if SERVER then
AddCSLuaFile("shared.lua")
end
if CLIENT then
SWEP.PrintName = "Inventory"
SWEP.Slot = 1
SWEP.SlotPos = 2
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = false
end
SWEP.Base = "weapon_cs_base2"
SWEP.Author = ""
SWEP.Instructions = ""
SWEP.Contact = ""
SWEP.Purpose = ""
SWEP.IconLetter = ""
SWEP.ViewModelFOV = 62
SWEP.ViewModelFlip = false
SWEP.AnimPrefix = "rpg"
SWEP.Spawnable = false
SWEP.AdminSpawnable = true
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = 0
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = ""
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = 0
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = ""
if CLIENT then
SWEP.FrameVisible = false
end
function SWEP:Initialize()
self:SetWeaponHoldType("normal")
end
function SWEP:Deploy()
if SERVER then
self.Owner:DrawViewModel(false)
self.Owner:DrawWorldModel(false)
end
end
function SWEP:PrimaryAttack()
self.Weapon:SetNextPrimaryFire(CurTime() + 0.2)
local trace = self.Owner:GetEyeTrace()
if not ValidEntity(trace.Entity) then
return
end
if self.Owner:EyePos():Distance(trace.HitPos) > 65 then
return
end
if CLIENT then return end
self:SendHoldType("pistol")
timer.Simple(0.2, function(wep) if wep:IsValid() then wep:SendHoldType("normal") end end, self)
ConCommand("say drp_pickupitem")
end
function SWEP:SecondaryAttack()
if CLIENT then return end
self:SendHoldType("pistol")
timer.Simple(0.2, function(wep) if wep:IsValid() then wep:SendHoldType("normal") end end, self)
self.Weapon:SetNextSecondaryFire(CurTime() + 0.2)
ConCommand("drp_showinv")
end
[/CODE]
Sorry, you need to Log In to post a reply to this thread.