I have been coding on a weapon for a few hours now but it seems that I cannot get it to work.The SWEP doesnt show up in my weapon categories or in my console.Im guessing it has something to do with the code.
If you can help,here is my SWEp lua:
if (SERVER) then
AddCSLuaFile ("shared.lua");
SWEP.HoldType = "ar2"
SWEP.Weight = 4;
SWEP.AutoSwitchTo = true;
SWEP.AutoSwitchFrom = true;
end
if (CLIENT) then
include ("shared.lua");
SWEP.PrintName = "Bolter Rifle";
SWEP.Slot = 3;
SWEP.SlotPos = 4;
SWEP.DrawAmmo = 0;
SWEP.DrawCrosshair = true
SWEP.ViewModelFOV = 63
SWEP.IconLetter = "V"
killicon.AddFont("weapon_bolt_rifle", "CSKillIcons", SWEP.IconLetter, Color( 255, 255, 255, 255 ))
end
SWEP.HoldType = "ar2"
SWEP.Author = "Lixx"
SWEP.Contact = "gilsudendorf@yahoo.com"
SWEP.Purpose = "To nail your nemesies..."
SWEP.Instructions = "Do i have to tell you???"
SWEP.Category = "Bolter Rifle"
SWEP.Spawnable = false;
SWEP.AdminSpawnable = true;
SWEP.ViewModel = "models/weapons/v_rif_m4a1.mdl";
SWEP.WorldModel = "models/weapons/w_rif_m4a1.mdl";
SWEP.Primary.ClipSize = 107;
SWEP.Primary.DefaultClip = 214;
SWEP.Primary.Automatic = true;
SWEP.Primary.Ammo = "ar2";
SWEP.Secondary.ClipSize = -1;
SWEP.Secondary.DefaultClip = -1;
SWEP.Secondary.Automatic = false;
SWEP.Secondary.Ammo = "none";
SWEP.Sound = Sound ("Weapon_TMP.Single")
SWEP.Damage = 240
SWEP.Spread = 0
SWEP.NumBul = 1
SWEP.Delay = 0.05
SWEP.Force = 25
function SWEP:Deploy()
return true
end
function SWEP:Holster()
return true
end
function SWEP:Think()
end
function SWEP:PrimaryAttack()
if ( !self:CanPrimaryAttack() ) then return end
local nail = ents.Create("crossbow_bolt")
nail:SetVelocity(owner:EyeAngles():Forward()*2000)
nail:SetPos(owner:GetShootPos())
nail.Damage = 100
nail:SetAngles(owner:EyeAngles())
nail:Spawn()
nail:SetOwner(owner)
self.Owner:FireBullets( nail )
self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
self.Owner:MuzzleFlash()
//self.Owner:SetAnimation( PLAYER_ATTACK )
self.Weapon:EmitSound(Sound(self.Primary.Sound))
self.Owner:ViewPunch(Angle( -self.Primary.Recoil, 0, 0 ))
if (self.Primary.TakeAmmoPerBullet) then
self:TakePrimaryAmmo(self.Primary.NumShots)
else
self:TakePrimaryAmmo(0)
end
function SWEP:SecondaryAttack()
end
function SWEP:Reload()
end
end
If you can find a solution to why it does not show up please reply :)
Found this in [B][I][U]3[/U][/I][/B] seconds on [B][I][U]Google[/U][/I][/B].
[URL="http://facepunch.com/showthread.php?t=1201176"]http://facepunch.com/showthread.php?t=1201176[/URL]
Sorry, you need to Log In to post a reply to this thread.