I am messing around with lua and SWEP, and the weapon I am trying to make is not working and I just might be overlooking something but i cannot find out what is wrong.
if (SERVER) then
AddCSLuaFile("shared.lua")
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
end
if (CLIENT) then
SWEP.PrintName = "Pumpkin Shooter"
SWEP.Slot = 3
SWEP.SlotPos = 1
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = false
end
SWEP.Author = "Monp"
SWEP.Contact = "Monp787@gmail.com"
SWEP.Purpose = "Throwing a Pumpkin."
SWEP.Instructions = "Left Click to throw a pumpkin."
SWEP.Category = "Prop Launcher"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.ViewModel = "models/weapons/v_pistol.mdl"
SWEP.WorldModel = "models/weapons/w_pistol.mdl"
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
local ShootSound = Sound("Metal.SawbladeStick")
function SWEP:Reload()
end
function SWEP:Think()
end
function SWEP:throw_attack(model_file)
local tr = self.Owner:GetEyeTrace()
self.Weapon:EmitSound(ShootSound)
self.BaseClase.ShootEffects(self)
if (!SERVER) then return end
local ent = ents.Create("prop_physics")
ent:SetModel(model_file)
ent:SetPos(self.Owner:EyePos() + (self.Owner.GetAimVector() * 16))
ent:SetAngles(self.Owner:EyeAngles())
ent:Spawn()
local phys = ent:GetPhysicsObject()
local shot_length = tr.HitPos:Length()
phys:ApplyForceCenter(self.Owner:GetVectorAim():GetNormalized() * math.pow(shot_length, 3))
cleanup.Add(self.Owner, "props", ent)
undo.Create("prop_physics")
undo.AddEntity(ent)
undo.SetPlayer(self.Owner)
undo.Finish()
end
function SWEP:PrimaryAttack()
self:throw_attack("models/pumpkin/pumpkin.mdl")
end
function SWEP:SecondaryAttack()
end
whenever i load the game mode it tells me prop at 824 -32 -142 missing modelname