SWEP help Syntax fail (model finding help needed)

Okay, so I am making my first SWEP. I need help with something pretty basic; proper syntax on selecting models. Here’s my code:


if (SERVER) then
 
 
   AddCSLuaFile ("shared.lua");
 
 
   SWEP.Weight = 5;
   SWEP.AutoSwitchTo = false;
   SWEP.AutoSwitchFrom = false;
 
end
 
if (CLIENT) then 
 
 
   SWEP.PrintName = "Baby throwing gun";
   SWEP.Slot = 3;
   SWEP.SlotPos = 1;
   SWEP.DrawAmmo = false;
   SWEP.DrawCrosshair = false;
 
end
 
 
SWEP.Author = "Matt Lesslie";
SWEP.Contact = "mattlesslie@gmail.com";
SWEP.Purpose = "A pistol that shoots babies, second best thing.";
SWEP.Instructions = "Shoot them babies";
SWEP.Category = "Prop Launchers"
 
SWEP.Spawnable = true;
SWEP.AdminSpawnable = true;
 
SWEP.ViewModel = "models/weapons/v_pistol.mdl";
SWEP.WorldModel = "models/weapons/w_pistol.mdl";
 
SWEP.Primary.ClipSize = 60;
SWEP.Primary.DefaultClip = 240;
SWEP.Primary.Automatic = true;
SWEP.Primary.Ammo = "none";
 
SWEP.Secondary.ClipSize = 0;
SWEP.Secondary.DefaultClip = 0;
SWEP.Secondary.Automatic = false;
SWEP.Secondary.Ammo = "none";
 
local ShootSound = Sound ("Metal.SawbladeStick");
 
function SWEP:Reload()
end
 
function SWEP:Think()
end
 
function SWEP:throw_attack ("../props_c17/doll01.mdl")
	local tr = self.Owner:GetEyeTrace();
 

	self.Weapon:EmitSound (ShootSound);
	self.BaseClass.ShootEffects (self);
 
	if (!SERVER) then return end;

	local ent = ents.Create ("prop_physics");
	ent:SetModel ("../props_c17/doll01.mdl");
 
	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:GetAimVector():GetNormalized() *  math.pow(shot_length, 3));

	cleanup.Add (self.Owner, "props", ent);
 
	undo.Create ("Thrown chair");
	undo.AddEntity (ent);
	undo.SetPlayer (self.Owner);
	undo.Finish();
end

function SWEP:PrimaryAttack()
	self:throw_attack ("../props_c17/doll01.mdl");
end

function SWEP:SecondaryAttack()
return false end
end
 

I keep getting errors similar to:

weapons/mahpistol/shared.lua:55: <name> or ‘…’ expected near ‘"…/props_c17/doll01.mdl"’

Please help?

Thanks, Matt.

When using models, you don’t need the “…/” at the beginning. Just “models/props_c17/doll01.mdl” should suffice.

Second, the arguments to a function are variables, not strings. The SWEP:throw_attack function has an argument like modelname or something, not a string.