I have made a scripted weapon from a tutorial (I'm fresh out of the water) I typed down the script by every command and I'm not sure what the problem is. I looked at other weapon scripts but they appear more complicated. I hope you guys can find what I did wrong.
[code]
-- Basic scripted weapon
-- By Hellsing4682
if (SERVER) then
AddCSLuaFile ("shared.lua");
SWEP.Weight = 5;
SWEP.AutoSwitchTo = false;
SWEP.AutoSwitchFrom = false;
end
if (CLIENT) then
SWEP.PrintName = "Chair throwing gun";
SWEP.Slot = 4;
SWEP.SlotPos = 1;
SWEP.DrawAmmo = false;
SWEP.DrawCrosshair = false;
end
SWEP.Author = "Hellsing4682";
SWEP.Contact = "Contact me on Steam.";
SWEP.Purpose = "Launches chairs at your enemies!.";
SWEP.Instructions = "Left click to fire Chair 1, right click to fire Chair 2.";
SWEP.Category = "Test Category"
SWEP.Spawnable = true;
SWEP.AdminSpawnable = true;
SWEP.ViewModel = "models/weapons/v_RPG.mdl";
SWEP.WorldModel = "models/weapons/w_RPG.mdl";
SWEP.Primary.ClipSize = -1;
SWEP.Primary.DefaultClip = -1;
SWEP.Primary.Automatic = false;
SWEP.Primary.Ammo = "none";
SWEP.Secondary.Clipsize = -1;
SWEP.Secondary.DefaultClip = 1;
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 (model_file)
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 (model_file);
ent:SetPos (self.Owner:EyePos() + (self.Owner:GetAimVector() * 16));
ent:SetAngles (self.Owner:EyeAngles());
ent:Spawn();
local phys = ent:GetPhysicsObject();
phys:ApplyForceCenter (self.Owner:GetAimVector():GetNormalized() * math.pow(shot_length, 3));
cleanup.Add (self.Owner, "props", ent);
undo.Create ("Thrown SWEP Entity");
undo.AddEntity (ent);
undo.SetPlayer (self.Owner);
undo.Finish();
end
function SWEP:PrimaryAttack()
//Call the throw attack function
self:throw_attack ("models/props/cs_office/Chair_office.mdl");
end
function SWEP: SecondaryAttack()
//Call the throw attack function
self:throw_attack ("models/props_c17/FurnitureChair001a.mdl");
end
[/code]
Sorry, you need to Log In to post a reply to this thread.